[chore] service/telemetry: encapsulate SDK creation#13606
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13606 +/- ##
=======================================
Coverage ? 92.45%
=======================================
Files ? 613
Lines ? 35168
Branches ? 0
=======================================
Hits ? 32515
Misses ? 2113
Partials ? 540 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| if cfg.Level == configtelemetry.LevelNone || len(cfg.Readers) == 0 { | ||
| logger.Info("Skipped telemetry setup.") | ||
| return | ||
| } |
There was a problem hiding this comment.
This logging is now done inside otelconftelemetry.
| if lmp, ok := mp.(interface { | ||
| LogAboutServers(logger *zap.Logger, cfg otelconftelemetry.MetricsConfig) | ||
| }); ok { | ||
| lmp.LogAboutServers(logger, cfg) | ||
| } |
There was a problem hiding this comment.
Dead code, nothing implements this interface.
| } | ||
| } | ||
|
|
||
| func TestTelemetryConfiguration(t *testing.T) { |
There was a problem hiding this comment.
This is covered by other tests that create valid/invalid loggers.
| } | ||
| } | ||
|
|
||
| func TestSampledLogger(t *testing.T) { |
There was a problem hiding this comment.
This is covered in logger_test.go.
| } else { | ||
| lp = noop.NewLoggerProvider() | ||
| } | ||
| lp := sdk.LoggerProvider() |
There was a problem hiding this comment.
SDK creation is encapsulated in createProviders, which is now the only caller of newLogger. It is impossible for the SDK to be nil at this point.
2b6f2a3 to
000ba41
Compare
Encapsulate SDK creation in otelconftelemetry. This refactors the factory to have a single "CreateTelemetry" method, and introduces the unified telemetry.Telemetry interface that provides access to telemetry providers.
000ba41 to
44f6ab5
Compare
mx-psi
left a comment
There was a problem hiding this comment.
Approving modulo the sealing interface discussion
|
Created #13722 to continue the dsicussion in the thread |
5a5da91
Logging was changed in open-telemetry/opentelemetry-collector#13606
* feat: Update OTel Collector components to v0.135.0 * chore: update Elastic OTel components go get github.com/elastic/opentelemetry-collector-components/connector/elasticapmconnector go get github.com/elastic/opentelemetry-collector-components/extension/apikeyauthextension go get github.com/elastic/opentelemetry-collector-components/extension/apmconfigextension go get github.com/elastic/opentelemetry-collector-components/processor/elasticinframetricsprocessor github.com/elastic/opentelemetry-collector-components/processor/elastictraceprocessor go get github.com/elastic/opentelemetry-collector-components/receiver/elasticapmintakereceiver * test: fix test after upstream change Logging was changed in open-telemetry/opentelemetry-collector#13606 * test: update gotestsum to latest Not sure why it got downgraded to v1.7.0 * use Beats from branch to verify CI This commit must be reverted before merging this PR. It temporarily replaces Beats dependency with elastic/beats#46464 to see if CI is happy with it, and to fix any remaining failures without waiting for that PR to be merged. * test: fix unit test * revert "use Beats from branch to verify CI" This reverts 4813ce3. * update Beats to 16c4d9a1aa8c This Beats commit has the update to OTel v0.135.0. * fix collector's metric names Without this replacement, some of the collector's internal metric names are broken. This has been broken since: - v9.1.3 in v9.1.x - v8.19.3 in v8.19.x See open-telemetry/opentelemetry-go#7039. See https://cloud-native.slack.com/archives/C01N6P7KR6W/p1757442690145329. * update go-mod-replace allowlist * mage notice --------- Co-authored-by: Christos Markou <chrismarkou92@gmail.com>
* feat: Update OTel Collector components to v0.135.0 * chore: update Elastic OTel components go get github.com/elastic/opentelemetry-collector-components/connector/elasticapmconnector go get github.com/elastic/opentelemetry-collector-components/extension/apikeyauthextension go get github.com/elastic/opentelemetry-collector-components/extension/apmconfigextension go get github.com/elastic/opentelemetry-collector-components/processor/elasticinframetricsprocessor github.com/elastic/opentelemetry-collector-components/processor/elastictraceprocessor go get github.com/elastic/opentelemetry-collector-components/receiver/elasticapmintakereceiver * test: fix test after upstream change Logging was changed in open-telemetry/opentelemetry-collector#13606 * test: update gotestsum to latest Not sure why it got downgraded to v1.7.0 * use Beats from branch to verify CI This commit must be reverted before merging this PR. It temporarily replaces Beats dependency with elastic/beats#46464 to see if CI is happy with it, and to fix any remaining failures without waiting for that PR to be merged. * test: fix unit test * revert "use Beats from branch to verify CI" This reverts 4813ce3. * update Beats to 16c4d9a1aa8c This Beats commit has the update to OTel v0.135.0. * fix collector's metric names Without this replacement, some of the collector's internal metric names are broken. This has been broken since: - v9.1.3 in v9.1.x - v8.19.3 in v8.19.x See open-telemetry/opentelemetry-go#7039. See https://cloud-native.slack.com/archives/C01N6P7KR6W/p1757442690145329. * update go-mod-replace allowlist * mage notice --------- Co-authored-by: Christos Markou <chrismarkou92@gmail.com>
* feat: Update OTel Collector components to v0.135.0 * chore: update Elastic OTel components go get github.com/elastic/opentelemetry-collector-components/connector/elasticapmconnector go get github.com/elastic/opentelemetry-collector-components/extension/apikeyauthextension go get github.com/elastic/opentelemetry-collector-components/extension/apmconfigextension go get github.com/elastic/opentelemetry-collector-components/processor/elasticinframetricsprocessor github.com/elastic/opentelemetry-collector-components/processor/elastictraceprocessor go get github.com/elastic/opentelemetry-collector-components/receiver/elasticapmintakereceiver * test: fix test after upstream change Logging was changed in open-telemetry/opentelemetry-collector#13606 * test: update gotestsum to latest Not sure why it got downgraded to v1.7.0 * use Beats from branch to verify CI This commit must be reverted before merging this PR. It temporarily replaces Beats dependency with elastic/beats#46464 to see if CI is happy with it, and to fix any remaining failures without waiting for that PR to be merged. * test: fix unit test * revert "use Beats from branch to verify CI" This reverts 4813ce3. * update Beats to 16c4d9a1aa8c This Beats commit has the update to OTel v0.135.0. * fix collector's metric names Without this replacement, some of the collector's internal metric names are broken. This has been broken since: - v9.1.3 in v9.1.x - v8.19.3 in v8.19.x See open-telemetry/opentelemetry-go#7039. See https://cloud-native.slack.com/archives/C01N6P7KR6W/p1757442690145329. * update go-mod-replace allowlist * mage notice --------- Co-authored-by: Christos Markou <chrismarkou92@gmail.com> (cherry picked from commit ecb0e06) # Conflicts: # NOTICE-fips.txt # NOTICE.txt # go.mod # go.sum # internal/pkg/otel/README.md
* feat: Update OTel Collector components to v0.135.0 * chore: update Elastic OTel components go get github.com/elastic/opentelemetry-collector-components/connector/elasticapmconnector go get github.com/elastic/opentelemetry-collector-components/extension/apikeyauthextension go get github.com/elastic/opentelemetry-collector-components/extension/apmconfigextension go get github.com/elastic/opentelemetry-collector-components/processor/elasticinframetricsprocessor github.com/elastic/opentelemetry-collector-components/processor/elastictraceprocessor go get github.com/elastic/opentelemetry-collector-components/receiver/elasticapmintakereceiver * test: fix test after upstream change Logging was changed in open-telemetry/opentelemetry-collector#13606 * test: update gotestsum to latest Not sure why it got downgraded to v1.7.0 * use Beats from branch to verify CI This commit must be reverted before merging this PR. It temporarily replaces Beats dependency with elastic/beats#46464 to see if CI is happy with it, and to fix any remaining failures without waiting for that PR to be merged. * test: fix unit test * revert "use Beats from branch to verify CI" This reverts 4813ce3. * update Beats to 16c4d9a1aa8c This Beats commit has the update to OTel v0.135.0. * fix collector's metric names Without this replacement, some of the collector's internal metric names are broken. This has been broken since: - v9.1.3 in v9.1.x - v8.19.3 in v8.19.x See open-telemetry/opentelemetry-go#7039. See https://cloud-native.slack.com/archives/C01N6P7KR6W/p1757442690145329. * update go-mod-replace allowlist * mage notice --------- Co-authored-by: Christos Markou <chrismarkou92@gmail.com> (cherry picked from commit ecb0e06) # Conflicts: # NOTICE-fips.txt # NOTICE.txt # go.mod # go.sum # internal/pkg/otel/README.md # internal/pkg/otel/manager/manager_test.go
* feat: Update OTel Collector components to v0.135.0 * chore: update Elastic OTel components go get github.com/elastic/opentelemetry-collector-components/connector/elasticapmconnector go get github.com/elastic/opentelemetry-collector-components/extension/apikeyauthextension go get github.com/elastic/opentelemetry-collector-components/extension/apmconfigextension go get github.com/elastic/opentelemetry-collector-components/processor/elasticinframetricsprocessor github.com/elastic/opentelemetry-collector-components/processor/elastictraceprocessor go get github.com/elastic/opentelemetry-collector-components/receiver/elasticapmintakereceiver * test: fix test after upstream change Logging was changed in open-telemetry/opentelemetry-collector#13606 * test: update gotestsum to latest Not sure why it got downgraded to v1.7.0 * use Beats from branch to verify CI This commit must be reverted before merging this PR. It temporarily replaces Beats dependency with elastic/beats#46464 to see if CI is happy with it, and to fix any remaining failures without waiting for that PR to be merged. * test: fix unit test * revert "use Beats from branch to verify CI" This reverts 4813ce3. * update Beats to 16c4d9a1aa8c This Beats commit has the update to OTel v0.135.0. * fix collector's metric names Without this replacement, some of the collector's internal metric names are broken. This has been broken since: - v9.1.3 in v9.1.x - v8.19.3 in v8.19.x See open-telemetry/opentelemetry-go#7039. See https://cloud-native.slack.com/archives/C01N6P7KR6W/p1757442690145329. * update go-mod-replace allowlist * mage notice --------- Co-authored-by: Christos Markou <chrismarkou92@gmail.com> (cherry picked from commit ecb0e06) # Conflicts: # NOTICE-fips.txt # NOTICE.txt # go.mod # go.sum # internal/pkg/otel/README.md
* feat: Update OTel Collector components to v0.135.0 * chore: update Elastic OTel components go get github.com/elastic/opentelemetry-collector-components/connector/elasticapmconnector go get github.com/elastic/opentelemetry-collector-components/extension/apikeyauthextension go get github.com/elastic/opentelemetry-collector-components/extension/apmconfigextension go get github.com/elastic/opentelemetry-collector-components/processor/elasticinframetricsprocessor github.com/elastic/opentelemetry-collector-components/processor/elastictraceprocessor go get github.com/elastic/opentelemetry-collector-components/receiver/elasticapmintakereceiver * test: fix test after upstream change Logging was changed in open-telemetry/opentelemetry-collector#13606 * test: update gotestsum to latest Not sure why it got downgraded to v1.7.0 * use Beats from branch to verify CI This commit must be reverted before merging this PR. It temporarily replaces Beats dependency with elastic/beats#46464 to see if CI is happy with it, and to fix any remaining failures without waiting for that PR to be merged. * test: fix unit test * revert "use Beats from branch to verify CI" This reverts 4813ce3. * update Beats to 16c4d9a1aa8c This Beats commit has the update to OTel v0.135.0. * fix collector's metric names Without this replacement, some of the collector's internal metric names are broken. This has been broken since: - v9.1.3 in v9.1.x - v8.19.3 in v8.19.x See open-telemetry/opentelemetry-go#7039. See https://cloud-native.slack.com/archives/C01N6P7KR6W/p1757442690145329. * update go-mod-replace allowlist * mage notice --------- Co-authored-by: Christos Markou <chrismarkou92@gmail.com> (cherry picked from commit ecb0e06) # Conflicts: # NOTICE-fips.txt # NOTICE.txt # go.mod # go.sum # internal/pkg/otel/README.md
…35.0 (#10849) * feat: Update OTel Collector components to v0.135.0 (#9858) * feat: Update OTel Collector components to v0.135.0 * chore: update Elastic OTel components go get github.com/elastic/opentelemetry-collector-components/connector/elasticapmconnector go get github.com/elastic/opentelemetry-collector-components/extension/apikeyauthextension go get github.com/elastic/opentelemetry-collector-components/extension/apmconfigextension go get github.com/elastic/opentelemetry-collector-components/processor/elasticinframetricsprocessor github.com/elastic/opentelemetry-collector-components/processor/elastictraceprocessor go get github.com/elastic/opentelemetry-collector-components/receiver/elasticapmintakereceiver * test: fix test after upstream change Logging was changed in open-telemetry/opentelemetry-collector#13606 * test: update gotestsum to latest Not sure why it got downgraded to v1.7.0 * use Beats from branch to verify CI This commit must be reverted before merging this PR. It temporarily replaces Beats dependency with elastic/beats#46464 to see if CI is happy with it, and to fix any remaining failures without waiting for that PR to be merged. * test: fix unit test * revert "use Beats from branch to verify CI" This reverts 4813ce3. * update Beats to 16c4d9a1aa8c This Beats commit has the update to OTel v0.135.0. * fix collector's metric names Without this replacement, some of the collector's internal metric names are broken. This has been broken since: - v9.1.3 in v9.1.x - v8.19.3 in v8.19.x See open-telemetry/opentelemetry-go#7039. See https://cloud-native.slack.com/archives/C01N6P7KR6W/p1757442690145329. * update go-mod-replace allowlist * mage notice --------- Co-authored-by: Christos Markou <chrismarkou92@gmail.com> (cherry picked from commit ecb0e06) # Conflicts: # NOTICE-fips.txt # NOTICE.txt # go.mod # go.sum # internal/pkg/otel/README.md * Fix conflicts * Fix unit tests * Fix an api change in mockes * Revert "Fix unit tests" This reverts commit 81ea886. * Bump beats dependency and fix tests * mage notice --------- Co-authored-by: Andrzej Stencel <andrzej.stencel@elastic.co> Co-authored-by: Mikołaj Świątek <mail@mikolajswiatek.com>
Description
Encapsulate opentelemetry-go SDK creation in service/telemetry/otelconftelemetry.
To enable this change, the Factory interface now provides
CreateProvidersmethod in place of the oldCreateLogger,CreateMeterProvider, andCreateTracerProvidermethods which have now been removed.CreateProvidersreturns an instance of the newtelemetry.Providersinterface, which provides access to telemetry providers.In a follow-up I will move the
Factoryinterface fromservice/telemetry/otelconftelemetrytoservice/telemetry, and inject the default level-based metric views throughtelemetry.Settings.Link to tracking issue
Part of #4970
Testing
N/A, non-functional change.
Documentation
N/A