Skip to content

Conversation

abisecops
Copy link

@abisecops abisecops commented Oct 5, 2025

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 #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 abisecops requested review from a team as code owners October 5, 2025 18:49
Copy link

Summary of Changes

Hello @abisecops, I'm Gemini Code Assist1! 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 👍 and 👎 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.

Footnotes

  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.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a good move towards standardization by replacing local constants with OpenTelemetry semantic conventions. The core change in openfeature/telemetry/telemetry.go is well-executed and improves maintainability by aligning with an external standard.

A key area for improvement is in the testing. The corresponding test file, openfeature/telemetry/telemetry_test.go, has not been updated to reflect these changes. For instance, it still uses a hardcoded string "feature_flag.evaluation" instead of the new FlagEvaluationKey constant. While the tests may currently pass, updating them to use the exported constants is crucial for long-term robustness and maintainability. I strongly recommend including the test updates in this PR.

I've also left one minor stylistic comment regarding code formatting.

@abisecops abisecops changed the title Main feat: Main Oct 5, 2025
@abisecops abisecops changed the title feat: Main use OTel semconv constants for feature flag attributes Oct 5, 2025
@abisecops abisecops changed the title use OTel semconv constants for feature flag attributes feat: use OTel semconv constants for feature flag attributes Oct 5, 2025
Copy link
Member

@aepfli aepfli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

Copy link
Contributor

@erka erka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

"strings"

"github.com/open-feature/go-sdk/openfeature"
semconv "go.opentelemetry.io/otel/semconv/v1.25.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this package isn't included in go.mod

go.mod Outdated
github.com/hashicorp/go-memdb v1.3.4 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/spf13/pflag v1.0.7 // indirect
github.com/stretchr/testify v1.11.1 // indirect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not in used, right?

Signed-off-by: Abishek Kafle <pingabisec@gmail.com>
…metry package with references to OpenTelemetry semantic conventions (semconv).

Reduces maintenance and ensures alignment with OTel updates.
Removes redundant constant definitions.

Signed-off-by: Abishek Kafle <pingabisec@gmail.com>
Signed-off-by: Abishek Kafle <pingabisec@gmail.com>
Signed-off-by: Abishek Kafle <pingabisec@gmail.com>
@aepfli
Copy link
Member

aepfli commented Oct 6, 2025

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 open-feature/.github#65 - this was defined

@erka
Copy link
Contributor

erka commented Oct 6, 2025

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

@beeme1mr beeme1mr requested a review from sahidvelji October 6, 2025 14:42
@beeme1mr
Copy link
Member

beeme1mr commented Oct 6, 2025

@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.

#418

Copy link
Contributor

@sahidvelji sahidvelji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for considering contributing to the OpenFeature Go SDK!

As mentioned by @beeme1mr, there is already an existing PR (in draft). We will need to pick up the discussion again on the specifics around the future of the telemetry package and whether it should even be in this repo (or go-sdk-contrib). But until that has been finalized, I don't think we should make any changes to the telemetry package.

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.

Use OTel semconv package instead of consts

5 participants