Skip to content

Add OTel Hook #6

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

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

Add OTel Hook #6

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

Comments

@toddbaert
Copy link
Member

Now that OTel 2529 is merged, we should implement an 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

@tcarrio tcarrio mentioned this issue Dec 27, 2022
tcarrio added a commit that referenced this issue Dec 27, 2022
- new statically registerable OTel hook for OpenFeature
- move hooks and providers into independent directories

Ref: #6

Signed-off-by: Tom Carrio <[email protected]>
tcarrio added a commit that referenced this issue Dec 27, 2022
- new statically registerable OTel hook for OpenFeature
- move hooks and providers into independent directories
- enable PHP 8.2 runner
- disable integration tests since none exist
- utilize test wrapper script definition in CI

Ref: #6

Signed-off-by: Tom Carrio <[email protected]>

Signed-off-by: Tom Carrio <[email protected]>
tcarrio added a commit that referenced this issue Dec 27, 2022
* feat: added OTel hook for OpenFeature

- new statically registerable OTel hook for OpenFeature
- move hooks and providers into independent directories
- enable PHP 8.2 runner
- disable integration tests since none exist
- utilize test wrapper script definition in CI

Ref: #6

Signed-off-by: Tom Carrio <[email protected]>

Signed-off-by: Tom Carrio <[email protected]>

* chore: revert composer script usage and add integration tests

Signed-off-by: Tom Carrio <[email protected]>

* ci: revert composer script usage for unit/integration tests

Signed-off-by: Tom Carrio <[email protected]>

* ci: fix reference to integration setup

Signed-off-by: Tom Carrio <[email protected]>

Signed-off-by: Tom Carrio <[email protected]>
tcarrio added a commit that referenced this issue Dec 27, 2022
- new statically registerable OTel hook for OpenFeature
- move hooks and providers into independent directories
- enable PHP 8.2 runner
- disable integration tests since none exist
- utilize test wrapper script definition in CI

Ref: #6

Signed-off-by: Tom Carrio <[email protected]>

Signed-off-by: Tom Carrio <[email protected]>
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 a pull request may close this issue.

1 participant