Documentation
¶
Overview ¶
Package ldotel contains OpenTelemetry specific implementations of hooks.
For instance, to use LaunchDarkly with OpenTelemetry tracing, one would use the TracingHook:
client, _ = ld.MakeCustomClient("sdk-key", ld.Config{
Hooks: []ldhooks.Hook{ldotel.NewTracingHook()},
}, 5*time.Second)
Index ¶
- Constants
- type TracingHook
- func (h TracingHook) AfterEvaluation(ctx context.Context, seriesContext ldhooks.EvaluationSeriesContext, ...) (ldhooks.EvaluationSeriesData, error)
- func (h TracingHook) BeforeEvaluation(ctx context.Context, seriesContext ldhooks.EvaluationSeriesContext, ...) (ldhooks.EvaluationSeriesData, error)
- func (h TracingHook) Metadata() ldhooks.Metadata
- type TracingHookOption
Constants ¶
const Version = "1.3.1" // {{ x-release-please-version }}
Version is the current version string of the ldotel package. This is updated by our release scripts.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TracingHook ¶
type TracingHook struct {
ldhooks.Unimplemented
// contains filtered or unexported fields
}
A TracingHook adds OpenTelemetry support to the LaunchDarkly SDK.
By default, span events will be added for each call to a "Variation" method. Variation methods without "Ctx" will not be able to access a parent span, so no span events can be attached. If WithSpans is used, then root spans will be created from the non-"Ctx" methods.
The span event will include the FullyQualifiedKey of the ldcontext, the provider of the evaluation (LaunchDarkly), and the key of the flag being evaluated.
func NewTracingHook ¶
func NewTracingHook(opts ...TracingHookOption) TracingHook
NewTracingHook creates a new TracingHook instance. The TracingHook can be provided to the LaunchDarkly client in order to add OpenTelemetry support.
func (TracingHook) AfterEvaluation ¶
func (h TracingHook) AfterEvaluation(ctx context.Context, seriesContext ldhooks.EvaluationSeriesContext, data ldhooks.EvaluationSeriesData, detail ldreason.EvaluationDetail) (ldhooks.EvaluationSeriesData, error)
AfterEvaluation implements the AfterEvaluation evaluation stage.
func (TracingHook) BeforeEvaluation ¶
func (h TracingHook) BeforeEvaluation(ctx context.Context, seriesContext ldhooks.EvaluationSeriesContext, data ldhooks.EvaluationSeriesData) (ldhooks.EvaluationSeriesData, error)
BeforeEvaluation implements the BeforeEvaluation evaluation stage.
func (TracingHook) Metadata ¶
func (h TracingHook) Metadata() ldhooks.Metadata
Metadata returns meta-data about the tracing hook.
type TracingHookOption ¶
type TracingHookOption func(hook *TracingHook)
TracingHookOption is used to implement functional options for the TracingHook.
func WithEnvironmentID ¶ added in v1.3.0
func WithEnvironmentID(environmentID string) TracingHookOption
WithEnvironmentID option sets the environemntID to be used as feature_flag.set.id, which will override any environmentID supplied by the hook series context.
func WithSpans ¶
func WithSpans() TracingHookOption
WithSpans is an experimental option that enables creation of child spans for each variation call.
This feature is experimental and the data in the spans, or nesting of spans, could change in future versions.
func WithValue ¶ added in v1.2.0
func WithValue() TracingHookOption
WithValue option enables putting a stringified version of the flag value in the feature_flag span event.
func WithVariant
deprecated
func WithVariant() TracingHookOption
WithVariant option enables putting a stringified version of the flag value in the feature_flag span event.
Deprecated: Use WithValue instead.