Skip to content

feat(otel): automatic setup based on config#1015

Draft
solnic wants to merge 3 commits intomasterfrom
solnic/feat-auto-setup-for-otel
Draft

feat(otel): automatic setup based on config#1015
solnic wants to merge 3 commits intomasterfrom
solnic/feat-auto-setup-for-otel

Conversation

@solnic
Copy link
Copy Markdown
Collaborator

@solnic solnic commented Mar 10, 2026

Another follow-up to #886

Automatically configure OpenTelemetry SDK and instrumentation libraries when tracing is enabled, eliminating manual setup boilerplate from user applications.

Before

Users had to manually configure config :opentelemetry and call .setup() on each instrumentation library in Application.start/2:

# application.ex
def start(_type, _args) do
  OpentelemetryBandit.setup()
  Sentry.OpenTelemetry.LiveViewPropagator.setup()
  OpentelemetryPhoenix.setup(adapter: :bandit)
  OpentelemetryOban.setup()
  OpentelemetryEcto.setup([:my_app, :repo], db_statement: :enabled)
  OpentelemetryLoggerMetadata.setup()
  # ...
end

After

All setup is config-driven under integrations: [opentelemetry: [...]]:

config :sentry,
  traces_sample_rate: 1.0,
  integrations: [
    opentelemetry: [
      phoenix: [adapter: :bandit],
      ecto: [repos: [[:my_app, :repo]], db_statement: :enabled]
    ]
  ]

@solnic solnic force-pushed the solnic/feat-auto-setup-for-otel branch from 20d2494 to 446c745 Compare March 10, 2026 15:04
@grantwest
Copy link
Copy Markdown

This is not exclusively a Sentry problem. Not sure the extra complexity is worth it here given that everyone who has telemetry setup is already going to have all of the setup calls in their Application. Additionally all of the Opentelemetry package documentations say to call setup.

Technically a little cleaner, I will certainly grant you that, but maybe going to cause more pain than it is worth.

@solnic
Copy link
Copy Markdown
Collaborator Author

solnic commented Mar 11, 2026

@grantwest thanks for the input. I believe it is worth the effort and a little bit of extra complexity because it helps with getting started AND hides various implementation details too, actually.

Having said that, this PR will be a proposal, so I welcome all the feedback and we'll figure out if we want to proceed or not 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants