go-sdk icon indicating copy to clipboard operation
go-sdk copied to clipboard

feat: use OTel semconv constants for feature flag attributes

Open abisecops opened this issue 2 months ago • 4 comments

This PR

  • Replaces locally defined feature flag attribute constants in the telemetry package with references to OpenTelemetry semantic conventions (semconv).
  • Reduces maintenance and ensures alignment with OTel updates.
  • Removes redundant constant definitions.

Related Issues

Fixes open-feature/go-sdk#393

Notes

This change ensures the telemetry package uses standardized OTel feature flag attributes, making future updates easier and improving interoperability.

Follow-up Tasks

  • Review other usages of feature flag attributes for possible refactoring.
  • Monitor for updates in OTel semconv that may affect attribute usage.

How to test

  • Run unit and integration tests to verify telemetry events are emitted with correct attribute keys.
  • Check that no custom constants for feature flag attributes remain in the telemetry package.

abisecops avatar Oct 05 '25 18:10 abisecops

Summary of Changes

Hello @abisecops, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the telemetry package to align with OpenTelemetry semantic conventions for feature flag attributes. By replacing locally defined constants with semconv references, the change aims to enhance standardization, reduce maintenance overhead, and improve interoperability with the broader OpenTelemetry ecosystem. This ensures that telemetry events are consistently structured and easily consumable by OTel-compliant systems.

Highlights

  • Standardized Telemetry Attributes: Replaced custom feature flag attribute constants in the telemetry package with references to OpenTelemetry semantic conventions (semconv).
  • Improved Maintainability: This change reduces the need for local maintenance of these constants and ensures automatic alignment with future OTel updates, removing redundant definitions.
  • Dependency Updates: Updated go.mod and go.sum to include github.com/stretchr/testify v1.11.1 and other dependency adjustments.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist[bot] avatar Oct 05 '25 18:10 gemini-code-assist[bot]

Since all the attributes are already well-defined in the semantic conventions (semconv), the telemetry package doesn’t provide much value to go-sdk. I believe any remaining useful parts should be moved to go-sdk-contrib/hooks/open-telemetry, and the telemetry package should be removed from go-sdk.

I am not sure, if that should be the case, because it seems like we do this in all the SDK's for easy access to telemetric information. I think we should revisit this approach in general, because we add a dependency on the otel semconv to the base sdk, which might not be ideal anyways. - here https://github.com/open-feature/.github/issues/65 - this was defined

aepfli avatar Oct 06 '25 13:10 aepfli

@abisecops Could you please double-check your work? It looks like the tests aren’t passing.

erka avatar Oct 06 '25 14:10 erka

@sahidvelji also has a draft PR open. We should align on this as soon as possible. I'd like to get the OTel support in a good place before KubeCon.

https://github.com/open-feature/go-sdk/pull/418

beeme1mr avatar Oct 06 '25 14:10 beeme1mr