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]
