Skip to content

service: allow telemetry.Factory to be injected #13307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

axw
Copy link
Contributor

@axw axw commented Jul 1, 2025

Description

  • Change service.Config.Telemetry's type to component.Config, so the concrete type can be controlled by the factory.
  • Add service.Config.Settings.TelemetryFactory, so callers (i.e. otelcol) can inject the factory.
  • Add otelcol.Factories.Telemetry, so distributions can control the telemetry factory, and inject it into the service settings.
  • Change the telemetry.Factory interface to create all the providers together. There's a few reasons for this:
    • The service always creates all of them
    • At least in the default implementation, they are tightly coupled in that they share an SDK object
    • It simplifies accessing the logger during creation of meter and tracer providers, e.g. to log that they are disabled
  • Add a telemetry.Factory method for creating a pcommon.Resource. This is needed since the resource may be configured through service::telemetry, which is now opaque to the service code.
  • Move the view configuration into service/telemetry. This is not ideal, and should rather be injected as options when creating the MeterProvider. This is not currently possible, as otelconf does not support it.

Link to tracking issue

Fixes #4970

Testing

Documentation

- Change service.Config.Telemetry's type to component.Config,
  so the concrete type can be controlled by the factory.
- Add service.Config.Settings.TelemetryFactory, so callers
  (i.e. otelcol) can inject the factory.
- Add otelcol.Factories.Telemetry, so distributions can
  control the telemetry factory, and inject it into the
  service settings.
- Change the telemetry.Factory interface to create all the
  providers together. There's a few reasons for this:
  * The service always creates all of them
  * At least in the default implementation, they
    are tightly coupled in that they share an SDK object
  * It simplifies accessing the logger during creation
    of meter and tracer providers, e.g. to log that they
    are disabled
- Add a telemetry.Factory method for creating a
  pcommon.Resource. This is needed since the resource
  may be configured through service::telemetry,
  which is now opaque to the service code.
- Move the view configuration into service/telemetry.
  This is not ideal, and should rather be injected as
  options when creating the MeterProvider. This is not
  currently possible, as otelconf does not support it.
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.

Allow overriding telemetry providers
1 participant