Core API

ldotel.tracing module

class ldotel.tracing.Hook(options: HookOptions = HookOptions(add_spans=False, include_variant=False, include_value=False))[source]
after_evaluation(series_context: EvaluationSeriesContext, data: dict, detail: EvaluationDetail) dict[source]

The after method is called during the execution of the variation method after the flag value has been determined. The method is executed synchronously.

Parameters:
  • series_context – Contains read-only information about the evaluation being performed.

  • data – A record associated with each stage of hook invocations. Each stage is called with the data of the previous stage for a series.

  • detail – The result of the evaluation. This value should not be modified.

Returns:

Data to use when executing the next state of the hook in the evaluation series.

before_evaluation(series_context: EvaluationSeriesContext, data: dict) dict[source]

The before method is called during the execution of a variation method before the flag value has been determined. The method is executed synchronously.

Parameters:
  • series_context – Contains information about the evaluation being performed. This is not mutable.

  • data – A record associated with each stage of hook invocations. Each stage is called with the data of the previous stage for a series. The input record should not be modified.

Returns:

Data to use when executing the next state of the hook in the evaluation series.

property metadata: Metadata

Get metadata about the hook implementation.

class ldotel.tracing.HookOptions(add_spans: bool = False, include_variant: bool = False, include_value: bool = False)[source]
add_spans: bool = False

Experimental: If set to true, then the tracing hook will add spans for each variation method call. Span events are always added and are unaffected by this setting.

This feature is experimental and the data in the spans, or nesting of spans, could change in future versions.

include_value: bool = False

If set to true, then the tracing hook will add the evaluated flag value to span events.

include_variant: bool = False

If set to true, then the tracing hook will add the evaluated flag value to span events.

Deprecated since version 1.0.0: This option is deprecated and will be removed in a future version. Use include_value instead.