opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

otelcol: remove dependency on otelconftelemetry

Open axw opened this issue 1 month ago • 1 comments
trafficstars

The Windows service code in otelcol has a direct dependency on the otelconftelemetry configuration:

https://github.com/open-telemetry/opentelemetry-collector/blob/6cd9c4e26feb910f19720950c8337af28194a70d/otelcol/collector_windows.go#L218

We should either move the Windows Event Log core into otelconftelemetry, or otherwise find a way to inject it as the default core in case no file path has been specified. The latter seems preferable to me; one option for that would be to add a field to telemetry.LoggerSettings like:

type LoggerSettings struct {
    Settings

    // ZapOptions contains options for creating the zap logger.
    ZapOptions []zap.Option

    // (new)

    // ZapBuildLogger holds an optional function for creating a Zap
    // logger from a zap.Config and options. If this is unspecified,
    // zap.Config.Build will be used.
    ZapBuildLogger func(zap.Config, ...zap.Option) (*zap.Logger, error)
}

Then otelcol can set that, and check the zap.Config and inject a WrapCore option.

axw avatar Oct 13 '25 03:10 axw