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 #171

Closed
toddbaert opened this issue Dec 2, 2022 · 0 comments · Fixed by #179
Closed

Add OTel hook #171

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

Comments

@toddbaert
Copy link
Member

toddbaert commented Dec 2, 2022

Now that OTel 2529 is merged, we should update the (or create a new) Open Telemetry hook.

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

Note: For the this repo, we may want to deprecate the old hook.

@toddbaert toddbaert added enhancement New feature or request hacktoberfest-pending Pending hacktoberfest approval good first issue Good for newcomers help wanted Extra attention is needed and removed hacktoberfest-pending Pending hacktoberfest approval labels Dec 2, 2022
@beeme1mr beeme1mr self-assigned this Dec 9, 2022
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