API7 Docs
ObservabilityOpenTelemetry

OpenTelemetry Configuration

Parameters

See plugin common configurations for configuration options available to all plugins.

  • samplerobject · optional

    Sampling configuration.

    • namestring · optional · default: always_off

      Valid values: always_on, always_off, trace_id_ratio, or parent_base

      Sampling strategy.

      To always sample, use always_on.

      To never sample, use always_off.

      To randomly sample based on a given ratio, use trace_id_ratio.

      To use to sampling decision of the span’s parent, use parent_base. If there is no parent, use the root sampler.

    • optionsobject · optional

      Parameters for sampling strategy.

      • fractionnumber · optional · default: 0

        Valid values: between 0 and 1 inclusive

        Sampling ratio when the sampling strategy is trace_id_ratio.

      • rootobject · optional

        Root sampler when the sampling strategy is parent_base strategy.

        • namestring · optional · default: always_off

          Valid values: always_on, always_off, or trace_id_ratio

          Root sampling strategy.

        • optionsobject · optional

          Root sampling strategy parameters.

          • fractionnumber · optional · default: 0

            Valid values: between 0 and 1 inclusive

            Root sampling ratio when the sampling strategy is trace_id_ratio.

  • additional_attributesarray[string] · optional

    Names of built-in variables to append to the trace span as string attributes. Values are resolved in the log phase, so variables populated late in request processing are available. Numeric and boolean values are converted to strings; boolean false is retained.

  • additional_header_prefix_attributesarray[string] · optional

    Headers or header prefixes appended to the trace span as string attributes in the log phase. For example, use x-my-header or x-my-headers-* to include all headers with the prefix x-my-headers-. Multiple values for one header are joined with , .

Plugin Metadata

  • tracingboolean · optional · default: true

    Global flag to enable or disable tracing. When set to false, no spans will be emitted regardless of per-route sampler configuration.

  • trace_id_sourcestring · optional · default: random

    Valid values: x-request-id or random

    Source of the trace ID. When set to x-request-id, the value of the x-request-id header will be used as the trace ID.

  • resourceobject · optional

    Additional resource to append to the trace, for example, {"service_name": "APISIX"}.

  • collectorobject · optional

    Collector configurations.

    • addressstring · optional · default: 127.0.0.1:4318

      Address of the OpenTelemetry collector to send traces to.

    • request_timeoutinteger · optional · default: 3

      Request timeout to OpenTelemetry collector in seconds.

    • request_headersobject · optional

      Request header to include in requests to OpenTelemetry collector, such as {"Authorization": "token"}.

  • batch_span_processorobject · optional

    Batch span processor configurations.

    • drop_on_queue_fullboolean · optional

      If true, drop span when the queue is full, otherwise force process batches.

    • max_queue_sizeinteger · optional

      Maximum queue size to buffer spans for delayed processing.

    • batch_timeoutnumber · optional

      Timeout for span batches to wait in the export queue before being sent, in seconds.

    • inactive_timeoutnumber · optional

      Timeout for spans to wait in the export queue before being sent, if the queue is not full, in seconds.

    • max_export_batch_sizeinteger · optional

      Maximum number of spans to include in a single batch sent to the OpenTelemetry collector.

  • set_ngx_varboolean · optional · default: false

    Export opentelemetry variables to built-in variables.