Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OTel Hook #28

Closed
Tracked by #16
toddbaert opened this issue Dec 2, 2022 · 2 comments · Fixed by #44
Closed
Tracked by #16

Add OTel Hook #28

toddbaert opened this issue Dec 2, 2022 · 2 comments · Fixed by #44
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@toddbaert
Copy link
Member

Now that OTel 2529 is merged, we should implement the Open Telemetry hook (currently exists as a stub).

Basically, this would entail creating a hook which:

  • in the after stage: gets the current span and adds an appropriately named event (feature_flag), with the attributes (feature_flag.key, feature_flag.provider_name, and feature_flag.variant)
  • in the error stage, records the exception

In pseudocode, this looks something like:

class OTelHook implements Hook {
  after(context, details) {
    var currentTrace = trace.getActiveSpan();
    currentTrace.addEvent("feature_flag", { "feature_flag.key": details.key, /*  other props */ } );
  }

  error(err) {
    var currentTrace = trace.getActiveSpan();
    currentTrace.recordException(err);
  }
}

See: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/feature-flags.md

@toddbaert toddbaert added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Dec 2, 2022
@bacherfl
Copy link
Contributor

@toddbaert I would like to tackle this issue :)

@toddbaert
Copy link
Member Author

@bacherfl thanks! assigned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants