feat: Add OTEL default variables#1812
Conversation
✅ Deploy Preview for polite-licorice-3db33c canceled.
|
|
@askpt I would suggest using https://pkg.go.dev/go.opentelemetry.io/contrib/exporters/autoexport and not re-implement the entire otel sdk. |
Thank you so much for the suggestion @erka! I was not aware of this library, and I will take a look. I am concerned that it may not be easily switched, as we need to maintain backwards compatibility with the previous settings. |
|
You can likely configure the OTEL environment variables within the code - using the flagd configuration - prior to initializing autoexport to maintain backwards compatibility. |
…erride Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
…ation Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
…sistency Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
…uration. Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
|
@askpt I've resolved the FOSSA issues. |
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a significant improvement, refactoring the OpenTelemetry integration to use the autoexport package. This change greatly simplifies the codebase by removing custom logic for OTLP exporter setup and transport credentials, instead relying on standard environment variable-based configuration. The addition of backward compatibility for existing flag-based configurations by setting the corresponding environment variables is a well-thought-out approach. The overall result is a cleaner, more maintainable, and more standard-compliant telemetry setup. The dependency updates and test adjustments are also appropriate and align with the refactoring. Great work!
|
It seems right to me, but I'm far from being an OTel expert, especially WRT to the |
…meters Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
|
🤖 I have created a release *beep* *boop* --- <details><summary>flagd: 0.13.0</summary> ## [0.13.0](flagd/v0.12.9...flagd/v0.13.0) (2025-12-23) ### 🐛 Bug Fixes * fixing sync return format missing flag layer, adding full e2e suite ([#1827](#1827)) ([570693d](570693d)) * **security:** update module github.com/go-viper/mapstructure/v2 to v2.4.0 [security] ([#1784](#1784)) ([037e30b](037e30b)) * **security:** update module golang.org/x/crypto to v0.45.0 [security] ([#1826](#1826)) ([7e0762b](7e0762b)) ### ✨ New Features * add support for http-based ofrep metrics ([#1803](#1803)) ([fcd19b3](fcd19b3)) * cleanup evaluator interface ([#1793](#1793)) ([aa504f7](aa504f7)) * enable parsing of array flag configurations for flagd ([#1797](#1797)) ([97c6ffa](97c6ffa)) * multi-project support via selectors and flagSetId namespacing ([#1702](#1702)) ([f9ce46f](f9ce46f)) * normalize selector in sync (use header as in OFREP and RPC) ([#1815](#1815)) ([c1f06cb](c1f06cb)) ### 🧹 Chore * **refactor:** use memdb for flag storage ([#1697](#1697)) ([5c5c1cf](5c5c1cf)) ### 🔄 Refactoring * store cleanup ([#1705](#1705)) ([bcff8d7](bcff8d7)) </details> <details><summary>flagd-proxy: 0.8.1</summary> ## [0.8.1](flagd-proxy/v0.8.0...flagd-proxy/v0.8.1) (2025-12-23) ### 🐛 Bug Fixes * **security:** update module github.com/go-viper/mapstructure/v2 to v2.4.0 [security] ([#1784](#1784)) ([037e30b](037e30b)) * **security:** update module golang.org/x/crypto to v0.45.0 [security] ([#1826](#1826)) ([7e0762b](7e0762b)) </details> <details><summary>core: 0.13.0</summary> ## [0.13.0](core/v0.12.1...core/v0.13.0) (2025-12-23) ### ⚠ BREAKING CHANGES * enable parsing of array flag configurations for flagd ([#1797](#1797)) * cleanup evaluator interface ([#1793](#1793)) * removes the `fractionalEvaluation` operator since it has been replaced with `fractional`. ([#1704](#1704)) ### 🐛 Bug Fixes * **security:** update module github.com/go-viper/mapstructure/v2 to v2.4.0 [security] ([#1784](#1784)) ([037e30b](037e30b)) * **security:** update module golang.org/x/crypto to v0.45.0 [security] ([#1825](#1825)) ([44edcc9](44edcc9)) * **security:** update module golang.org/x/crypto to v0.45.0 [security] ([#1826](#1826)) ([7e0762b](7e0762b)) ### ✨ New Features * Add OAuth support for HTTP Sync ([#1791](#1791)) ([268fd75](268fd75)) * Add OTEL default variables ([#1812](#1812)) ([c2e3fc6](c2e3fc6)) * allow null flagSetId Selector, restrict Selector to single key-value-pairs ([#1708](#1708)) ([#1811](#1811)) ([c12a0ae](c12a0ae)) * change jsonschema parser ([#1794](#1794)) ([bf3f722](bf3f722)) * cleanup evaluator interface ([#1793](#1793)) ([aa504f7](aa504f7)) * enable parsing of array flag configurations for flagd ([#1797](#1797)) ([97c6ffa](97c6ffa)) * multi-project support via selectors and flagSetId namespacing ([#1702](#1702)) ([f9ce46f](f9ce46f)) ### 🧹 Chore * **refactor:** use memdb for flag storage ([#1697](#1697)) ([5c5c1cf](5c5c1cf)) * removes the `fractionalEvaluation` operator since it has been replaced with `fractional`. ([#1704](#1704)) ([3228ad8](3228ad8)) ### 🔄 Refactoring * remove deprecated bearerToken option ([#1816](#1816)) ([efda06a](efda06a)) * removed unused Selector from Flag and Store. ([#1747](#1747)) ([1083005](1083005)) * store cleanup ([#1705](#1705)) ([bcff8d7](bcff8d7)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com> Signed-off-by: Todd Baert <todd.baert@dynatrace.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Todd Baert <todd.baert@dynatrace.com>



Signed-off-by: André Silva 2493377+askpt@users.noreply.github.com
This PR
This pull request updates the OpenTelemetry integration in the
coremodule to use the newautoexportpackage, simplifying configuration and improving compatibility with environment variables. It removes custom gRPC transport credential handling and centralizes exporter setup, making telemetry easier to configure and maintain. Several dependencies are updated to their latest versions, and tests are adjusted to reflect the new configuration logic.OpenTelemetry Integration Refactor:
autoexportpackage, removing custom TLS handling and simplifying trace and metric exporter initialization incore/pkg/telemetry/builder.go. Now, environment variables are used for configuration, and Prometheus is used as a fallback for metrics. [1] [2] [3] [4]core/pkg/telemetry/builder_test.goto reflect the new autoexport logic, removing tests for unsupported configurations and ensuring the interceptor is always added. [1] [2]Dependency Updates:
core/go.mod, includingprometheus/client_golang,stretchr/testify,go.opentelemetry.io/otel, and related packages to their latest versions. Added new dependencies forautoexportand related exporters.github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp,github.com/cenkalti/backoff/v5,github.com/go-jose/go-jose/v4, and others. [1] [2] [3] [4] [5]These changes make telemetry setup more robust and future-proof, reducing custom code and leveraging upstream improvements.
Related Issues
Fixes #1141
Notes