Skip to main content

Appendix D: Observability

This document describes conventions for extracting data from the OpenFeature SDK for use in telemetry signals. It primarily focuses on providing recommendations for mapping well-known fields in OpenFeature to OpenTelemetry feature-flag log records and other semantic conventions.

Evaluations

Flag evaluation telemetry comprises data resolved from the provider resolution (evaluation details and flag metadata) as well as metadata about the provider itself. This is particularly relevant to telemetry-related hooks.

Evaluation Details

The following describes how fields on the evaluation details are mapped to feature flag log records:

Log Record AttributeSource Field or Derived Value from Evaluation DetailsRequirement levelTypeNotes
feature_flag.keyflag keyRequiredstringSee: flag key
feature_flag.result.variantvariantConditionally Required 1stringSee: variant
feature_flag.result.valuevalueConditionally Required 2undefinedSee: value
feature_flag.result.reasonreasonRecommendedstringSee: reason
error.typeerror codeConditionally Required 3stringSee: error code,
error.messageerror messageConditionally Required 3stringA human-readable error message associated with a failed evaluation. For programmatic purposes, refer to error code.

Note

The error.type and feature_flag.result.reason enumerations use a lowercase "snake_case" convention (see OpenTelemetry feature-flag log records). OpenFeature error codes and resolution reasons should be transformed accordingly by integrations which include this data.

Flag Metadata

The following describes how keys in flag metadata are mapped to feature flag log records:

Log Record AttributeFlag Metadata KeyRequirement levelTypeNotes
feature_flag.context.idcontextIdRecommendedstringThe context identifier returned in the flag metadata uniquely identifies the subject of the flag evaluation. If not available, the targeting key should be used.
feature_flag.set.idflagSetIdRecommendedstringA logical identifier for the flag set.
feature_flag.versionversionRecommendedstringA version string (format unspecified) for the flag or flag set.

Note

Keys in flag metadata use the "camelCase" casing convention, while the OpenTelemetry standard uses a namespaced "snake_case" convention.

Provider Metadata

Log Record AttributeProvider Metadata FieldRequirement levelTypeNotes
feature_flag.provider.namenameRecommendedstringThe name of the provider as defined in the provider metadata, available in the hook context.

History

Feature flags in the OpenTelemetry semantic conventions are currently in development and are marked as experimental. The following table describes the history of changes to the OpenTelemetry feature flag log records as it progresses towards a stable release.

Original Field NameNew Field NameSemantic Convention Release
feature_flag.variantfeature_flag.result.variantv1.32.0
feature_flag.evaluation.reasonfeature_flag.result.reasonv1.32.0
feature_flag.evaluation.error.messageerror.messagev1.33.0
feature_flag.provider_namefeature_flag.provider.namev1.33.0
valuefeature_flag.result.valueUnreleased

Footnotes

Footnotes

  1. The variant field should be included whenever possible as it represents the symbolic name of the flag's returned value (e.g., "on"/"off", "control"/"treatment"). Only omit if the provider doesn't supply this information.

  2. The value field should be included whenever a variant is unavailable. Large or sensitive values should be redacted or omitted prior to being captured in telemetry signals.

  3. Include error.type and error.message, if and only if an error occurred during a flag evaluation. 2