forked from open-telemetry/opentelemetry-collector
/
config.yaml
95 lines (89 loc) · 3.46 KB
/
config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
receivers:
examplereceiver:
processors:
# The following specifies the values of attribute `db.svc`, `operation`,
# and `id` will form the new name of the span, in that order, separated by the
# value `::`. All attribute keys needs to be specified in the span for
# the processor to rename it.
# Note: There is no default configuration for the span processor. For 'name',
# the field `from_attributes` is required.
#
# Example 1 - All keys are in the span:
# Span name before processor:
# "Span.Name": "serviceA"
# Attributes Key/Value pair for a span
# { "db.svc": "location", "operation": "get", "id": "1234"}
# Separator: "::"
# Results in the following new span name:
# "Span.Name": "location::get::1234"
#
# Example 2 - Some keys are missing from the span.
# Span name(before processor):
# "Span.Name": "serviceA"
# Attributes Key/Value pair for a span
# { "db.svc": "location", "id": "1234"}
# Separator: "::"
# Results in no new name because the attribute key `operation` isn't set.
# Span name after processor:
# "Span.Name": "serviceA"
span/custom:
name:
separator: "::"
from_attributes: [db.svc, operation, id]
# The following specifies generating a span name with no separator.
# Example:
# Attributes Key/Value pair
# { "db.svc": "location:, "operation": "get", "id": "1234"}
# Separator: ""
# Results in the following new span name:
# "locationget1234"
span/no-separator:
name:
from_attributes: [db.svc, operation, id]
# The following extracts attributes from span name and replaces extracted
# parts with attribute names.
# to_attributes is a list of rules that extract attribute values from span name and
# replace them by attributes names in the span name. Each rule in the list is
# regex pattern string. Span name is checked against the regex and if the regex matches
# all named subexpressions from the regex then the matches are extracted as attributes
# and added to the span. Subexpression name becomes the attribute name and
# subexpression matched portion becomes the attribute value. The matched portion
# in the span name is replaced by extracted attribute name. If the attributes exist
# they will be overwritten. Checks are performed for elements in this array in the
# order they are specified.
#
# Example:
# Let's assume input span name is /api/v1/document/12345678/update
# Applying the following results in output span name /api/v1/document/{documentId}/update
# and will add a new attribute "documentId"="12345678" to the span.
span/to_attributes:
name:
to_attributes:
rules:
- ^\/api\/v1\/document\/(?P<documentId>.*)\/update$
# The following demonstrates renaming the span name to `{operation_website}`
# and adding the attribute {Key: operation_website, Value: <old span name> }
# when the span has the following properties
# - Services names that contain the word `banks`.
# - The span name contains '/' anywhere in the string.
# - The span name is not 'donot/change'.
span/includeexclude:
include:
match_type: regexp
services: ["banks"]
span_names: ["^(.*?)/(.*?)$"]
exclude:
match_type: strict
span_names: ["donot/change"]
name:
to_attributes:
rules:
- "(?P<operation_website>.*?)$"
exporters:
exampleexporter:
service:
pipelines:
traces:
receivers: [examplereceiver]
processors: [span/custom]
exporters: [exampleexporter]