mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 21:46:22 +01:00
63 lines
2.0 KiB
Plaintext
63 lines
2.0 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * observability/otel/otel-collector/otel-collector-processors.adoc
|
|
|
|
:_mod-docs-content-type: REFERENCE
|
|
[id="otel-processors-span-processor_{context}"]
|
|
= Span Processor
|
|
|
|
[role="_abstract"]
|
|
The Span Processor modifies the span name based on its attributes or extracts the span attributes from the span name. This processor can also change the span status and include or exclude spans. This processor supports traces.
|
|
|
|
Span renaming requires specifying attributes for the new name by using the `from_attributes` configuration.
|
|
|
|
:FeatureName: The Span Processor
|
|
include::snippets/technology-preview.adoc[]
|
|
|
|
.OpenTelemetry Collector using the Span Processor for renaming a span
|
|
[source,yaml]
|
|
----
|
|
# ...
|
|
config:
|
|
processors:
|
|
span:
|
|
name:
|
|
from_attributes: [<key1>, <key2>, ...] # <1>
|
|
separator: <value> # <2>
|
|
# ...
|
|
----
|
|
<1> Defines the keys to form the new span name.
|
|
<2> An optional separator.
|
|
|
|
You can use this processor to extract attributes from the span name.
|
|
|
|
.OpenTelemetry Collector using the Span Processor for extracting attributes from a span name
|
|
[source,yaml]
|
|
----
|
|
# ...
|
|
config:
|
|
processors:
|
|
span/to_attributes:
|
|
name:
|
|
to_attributes:
|
|
rules:
|
|
- ^\/api\/v1\/document\/(?P<documentId>.*)\/update$ # <1>
|
|
# ...
|
|
----
|
|
<1> This rule defines how the extraction is to be executed. You can define more rules: for example, in this case, if the regular expression matches the name, a `documentID` attribute is created. In this example, if the input span name is `/api/v1/document/12345678/update`, this results in the `/api/v1/document/{documentId}/update` output span name, and a new `"documentId"="12345678"` attribute is added to the span.
|
|
|
|
You can have the span status modified.
|
|
|
|
.OpenTelemetry Collector using the Span Processor for status change
|
|
[source,yaml]
|
|
----
|
|
# ...
|
|
config:
|
|
processors:
|
|
span/set_status:
|
|
status:
|
|
code: Error
|
|
description: "<error_description>"
|
|
# ...
|
|
----
|