Skip to main content

Static Configurations

If you are using APISIX, by default, configurations of the service name, tenant ID, collector, and batch span processor are pre-configured in default configuration.

To customize these values, add the corresponding configurations to config.yaml. For example:

plugin_attr:
opentelemetry:
trace_id_source: x-request-id # Specify the source of the trace ID, `x-request-id` or `random`. When set to `x-request-id`,
# the value of the `x-request-id` header will be used as the trace ID.
resource: # Additional resource to append to the trace.
service.name: APISIX # Set the service name for OpenTelemetry traces.
collector:
address: 127.0.0.1:4318 # Set the address of the OpenTelemetry collector to send traces to.
request_timeout: 3 # Set the timeout for requests to the OpenTelemetry collector in seconds.
request_headers: # Set the headers to include in requests to the OpenTelemetry collector.
Authorization: token # Set the authorization header to include an access token.
batch_span_processor: # Trace span processor.
drop_on_queue_full: false # Drop spans when the export queue is full.
max_queue_size: 1024 # Set the maximum size of the span export queue.
batch_timeout: 2 # Set the timeout for span batches to wait in the export queue before
# being sent.
inactive_timeout: 1 # Set the timeout for spans to wait in the export queue before being sent,
# if the queue is not full.
max_export_batch_size: 16 # Set the maximum number of spans to include in each batch sent to the OpenTelemetry collector.
set_ngx_var: false # Export opentelemetry variables to nginx variables.

Reload APISIX for changes to take effect.

If you are using API7 Enterprise, you should configure these parameters in the dashboard Plugin Settings > Plugin Metadata:

{
"trace_id_source": "x-request-id",
"batch_span_processor": {
"batch_timeout": 2,
"drop_on_queue_full": false,
"inactive_timeout": 1,
"max_export_batch_size": 16,
"max_queue_size": 1024
},
"collector": {
"address": "127.0.0.1:4318",
"request_headers": {
"Authorization": "token"
},
"request_timeout": 3
},
"resource": {
"service.name": "API7"
},
"set_ngx_var": false
}

Parameters

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

  • sampler

    object


    Sampling configuration.

    • name

      string


      default: always_off


      vaild vaule:

      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.

    • options

      object


      Parameters for sampling strategy.

      • fraction

        number


        default: 0


        vaild vaule:

        between 0 and 1 inclusive


        Sampling ratio when the sampling strategy is trace_id_ratio.

      • root

        object


        Root sampler when the sampling strategy is parent_base strategy.

        • name

          string


          vaild vaule:

          always_on, always_off, or trace_id_ratio


          Root sampling strategy.

        • options

          object


          Root sampling strategy parameters.

          • fraction

            number


            default: 0


            vaild vaule:

            between 0 and 1 inclusive


            Root sampling ratio when the sampling strategy is trace_id_ratio.

  • additional_attributes

    array[string]


    Additional attributes appended to the trace span. Support built-in variables in values.

  • additional_header_prefix_attributes

    array[string]


    Headers or header prefixes appended to the trace span's attributes. For example, use x-my-header" or x-my-headers-* to include all headers with the prefix x-my-headers-.


API7.ai Logo

API Management for Modern Architectures with Edge, API Gateway, Kubernetes, and Service Mesh.

Product

API7 Cloud

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

Copyright © APISEVEN Ltd. 2019 – 2024. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the

Apache Software Foundation