/
githubmirror
/
opentelemetry-collector-contrib
Обзор
Документация
Войти
/
githubmirror
/
opentelemetry-collector-contrib
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
processor/spanprocessor/testdata/config.yaml
108 строк
4 KB
Andrzej Stencel
[processor/span] Add 'keep_original_name' (#36397)
16 ноя 2024, 03:14
Не верифицирован
16 ноя 2024, 03:14
09a7033
Код
Авторство
О чём код?
# 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$ # This example will add the same new "documentId"="12345678" attribute, # but now resulting in an unchanged span name (/api/v1/document/12345678/update). span/to_attributes_keep_original_name: name: to_attributes: keep_original_name: true 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>.*?)$" # This example changes status of a span to error and sets description. # Possible values for code are: "Ok", "Error" or "Unset". # Description is an optional field used for documenting Error statuses. span/set_status_err: status: code: "Error" description: "some additional error description" # However you may want to set status conditionally. Example below sets # status to success only when attribute http.status_code is equal to 400 span/set_status_ok: include: attributes: - key: http.status_code value: 400 status: code: "Ok"