We provide default attributes for every metric and span, but it’s often necessary to add extra context. To achieve this, we support both static and dynamic values based on headers.
env=prod
. We provide an easy way to achieve this by adding a few lines of configuration.
target_info
metric.
env=prod
to every metric and span export. Additionally, the attribute service=static
is also added. Resource attributes identify the entity producing the traces and metrics. Since Prometheus metrics rely on OpenTelemetry metrics, the resource attributes are also added to the Prometheus target_info
series.
value_from
property. If the headers could not be found, we will fallback to the default value. This functionality is only available to attributes
not resource_attributes
.
service=static
unless the client has provided a request header x-service
, in which case the value of this header will be used instead of the default value. Remember to add the header to the allowlist in the CORS configuration; otherwise, CORS issues will occur on the frontend.
subgraph
in it, will only be evaluated for the “Engine - Fetch” span. Thus “sg_name” can only be found in the “Engine - Fetch” span.
You can find more information about expressions and the fields accessible for expressions here.
telemetry
configuration allows users to specify attributes which will be attached to both spans AND metrics, there may be cases users want to attach values to metrics only. In this case you can use metrics only attributes.
service
will only be attached to metrics. Headers are pre-evaluated before metrics are emitted, while request context fields are determined at different stages. Consequently, request context fields may not be included in all metrics.
Additionally, the unique list of subgraph error codes will be appended to all emitted metric values. This enables correlation between error cases and corresponding metrics.
telemetry
configuration allows users to specify attributes which will be attached to both spans AND metrics, there may be cases users want to attach values to spans only.
In this case you can use trace only attributes.
service
will only be attached to spans.
For a complete list of available options, please refer to the relevant documentation section.