receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317

processors:
  memory_limiter:
    check_interval: 1s
    limit_percentage: 80
    spike_limit_percentage: 25
  # Moves pre-1.21 HTTP attribute names to the current semantic conventions,
  # on spans and log records, without touching records that already use them.
  # http.target held path and query together; they become url.path and
  # url.query.
  transform/rename:
    error_mode: ignore
    trace_statements:
      - context: span
        statements:
          - set(attributes["http.request.method"], attributes["http.method"]) where attributes["http.method"] != nil
          - set(attributes["http.response.status_code"], attributes["http.status_code"]) where attributes["http.status_code"] != nil
          - set(attributes["url.path"], attributes["http.target"]) where attributes["http.target"] != nil
          - set(attributes["url.query"], attributes["http.target"]) where attributes["http.target"] != nil and IsMatch(attributes["http.target"], "\\?")
          - replace_pattern(attributes["url.path"], "\\?.*$", "") where attributes["http.target"] != nil
          - replace_pattern(attributes["url.query"], "^[^?]*\\?", "") where attributes["http.target"] != nil
          - delete_matching_keys(attributes, "^http\\.(method|status_code|target)$")
    log_statements:
      - context: log
        statements:
          - set(attributes["http.request.method"], attributes["http.method"]) where attributes["http.method"] != nil
          - set(attributes["http.response.status_code"], attributes["http.status_code"]) where attributes["http.status_code"] != nil
          - set(attributes["url.path"], attributes["http.target"]) where attributes["http.target"] != nil
          - set(attributes["url.query"], attributes["http.target"]) where attributes["http.target"] != nil and IsMatch(attributes["http.target"], "\\?")
          - replace_pattern(attributes["url.path"], "\\?.*$", "") where attributes["http.target"] != nil
          - replace_pattern(attributes["url.query"], "^[^?]*\\?", "") where attributes["http.target"] != nil
          - delete_matching_keys(attributes, "^http\\.(method|status_code|target)$")
  batch:
    timeout: 5s

exporters:
  otlphttp:
    endpoint: https://your-backend:4318

service:
  pipelines:
    logs:
      receivers: [otlp]
      processors: [memory_limiter, transform/rename, batch]
      exporters: [otlphttp]
    traces:
      receivers: [otlp]
      processors: [memory_limiter, transform/rename, batch]
      exporters: [otlphttp]
