opentelemetry-collector: Start order of extensions is not guaranteed?

Describe the bug Maybe I am misreading the situation, but this code iterates over map when starting extensions, so it cannot guarantee in which order they are started: https://github.com/open-telemetry/opentelemetry-collector/blob/e97ceca47f9eacf50688a5b2e40c0ad22261579b/service/extensions/extensions.go#L34

Even though the documentation implies that the order is define by the declaration order: https://github.com/open-telemetry/opentelemetry-collector/blob/e97ceca47f9eacf50688a5b2e40c0ad22261579b/docs/service-extensions.md?plain=1#L63-L66

I observed some spontaneous failures in my experiments with JaegerV2 which declares extensions with an order expectation: extensions: [jaeger_storage, jaeger_query] but the logs show differently:

2023-10-24T01:17:01.143Z	info	extensions/extensions.go:33	Starting extensions...
2023-10-24T01:17:01.143Z	info	extensions/extensions.go:36	Extension is starting...	{"kind": "extension", "name": "jaeger_query"}

Steps to reproduce It’s random behavior, hard to reproduce reliably.

What did you expect to see? Extensions should be starting in the order defined in the config.

What did you see instead? Seeing different order.

What version did you use? Version: v0.87.0

What config did you use? https://github.com/jaegertracing/jaeger/blob/28520b31471b36d9e949de4ffaa016c2640a3be7/cmd/jaeger-v2/internal/all-in-one.yaml#L1

Environment OS: MacOS, Linux Compiler(if manually compiled): go 1.20.x

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

I just wanted to confirm that exposing the extensions as different components in the configuration interface is useful for Jaeger end-users. If it is, I’m ok with merging the PR. Sooner or later, we eventually might run into other extensions with interdependencies.

Would it be sufficient to start extensions in order, then start pipeline components as we do now? Stopping would be the opposite - pipeline components, then extensions in reverse order.

That would work for me, and what the open PR is doing.