diff --git a/deploy/docker-swarm/clickhouse-setup/otel-collector-config.yaml b/deploy/docker-swarm/clickhouse-setup/otel-collector-config.yaml index 74df932c0f..bc4fa3d3a8 100644 --- a/deploy/docker-swarm/clickhouse-setup/otel-collector-config.yaml +++ b/deploy/docker-swarm/clickhouse-setup/otel-collector-config.yaml @@ -63,38 +63,33 @@ receivers: processors: logstransform/internal: operators: + - type: regex_parser + id: traceid + # https://regex101.com/r/MMfNjk/1 + regex: '(?i)(trace(-|_||)id("|=| |-|:)*)(?P[A-Fa-f0-9]+)' + parse_from: body + parse_to: attributes.temp_trace + if: 'body matches "(?i)(trace(-|_||)id(\"|=| |-|:)*)(?P[A-Fa-f0-9]+)"' + output: spanid + - type: regex_parser + id: spanid + # https://regex101.com/r/uXSwLc/1 + regex: '(?i)(span(-|_||)id("|=| |-|:)*)(?P[A-Fa-f0-9]+)' + parse_from: body + parse_to: attributes.temp_trace + if: 'body matches "(?i)(span(-|_||)id(\"|=| |-|:)*)(?P[A-Fa-f0-9]+)"' + output: trace_parser - type: trace_parser - if: '"trace_id" in attributes or "span_id" in attributes' + id: trace_parser trace_id: - parse_from: attributes.trace_id + parse_from: attributes.temp_trace.trace_id span_id: - parse_from: attributes.span_id - output: remove_trace_id - - type: trace_parser - if: '"traceId" in attributes or "spanId" in attributes' - trace_id: - parse_from: attributes.traceId - span_id: - parse_from: attributes.spanId - output: remove_traceId - - id: remove_traceId - type: remove - if: '"traceId" in attributes' - field: attributes.traceId - output: remove_spanId - - id: remove_spanId - type: remove - if: '"spanId" in attributes' - field: attributes.spanId - - id: remove_trace_id - type: remove - if: '"trace_id" in attributes' - field: attributes.trace_id - output: remove_span_id - - id: remove_span_id - type: remove - if: '"span_id" in attributes' - field: attributes.span_id + parse_from: attributes.temp_trace.span_id + output: remove_temp + - type: remove + id: remove_temp + field: attributes.temp_trace + if: '"temp_trace" in attributes' batch: send_batch_size: 10000 send_batch_max_size: 11000 diff --git a/deploy/docker/clickhouse-setup/otel-collector-config.yaml b/deploy/docker/clickhouse-setup/otel-collector-config.yaml index 1604ae38a1..fe6da5f126 100644 --- a/deploy/docker/clickhouse-setup/otel-collector-config.yaml +++ b/deploy/docker/clickhouse-setup/otel-collector-config.yaml @@ -64,38 +64,33 @@ receivers: processors: logstransform/internal: operators: + - type: regex_parser + id: traceid + # https://regex101.com/r/MMfNjk/1 + regex: '(?i)(trace(-|_||)id("|=| |-|:)*)(?P[A-Fa-f0-9]+)' + parse_from: body + parse_to: attributes.temp_trace + if: 'body matches "(?i)(trace(-|_||)id(\"|=| |-|:)*)(?P[A-Fa-f0-9]+)"' + output: spanid + - type: regex_parser + id: spanid + # https://regex101.com/r/uXSwLc/1 + regex: '(?i)(span(-|_||)id("|=| |-|:)*)(?P[A-Fa-f0-9]+)' + parse_from: body + parse_to: attributes.temp_trace + if: 'body matches "(?i)(span(-|_||)id(\"|=| |-|:)*)(?P[A-Fa-f0-9]+)"' + output: trace_parser - type: trace_parser - if: '"trace_id" in attributes or "span_id" in attributes' + id: trace_parser trace_id: - parse_from: attributes.trace_id + parse_from: attributes.temp_trace.trace_id span_id: - parse_from: attributes.span_id - output: remove_trace_id - - type: trace_parser - if: '"traceId" in attributes or "spanId" in attributes' - trace_id: - parse_from: attributes.traceId - span_id: - parse_from: attributes.spanId - output: remove_traceId - - id: remove_traceId - type: remove - if: '"traceId" in attributes' - field: attributes.traceId - output: remove_spanId - - id: remove_spanId - type: remove - if: '"spanId" in attributes' - field: attributes.spanId - - id: remove_trace_id - type: remove - if: '"trace_id" in attributes' - field: attributes.trace_id - output: remove_span_id - - id: remove_span_id - type: remove - if: '"span_id" in attributes' - field: attributes.span_id + parse_from: attributes.temp_trace.span_id + output: remove_temp + - type: remove + id: remove_temp + field: attributes.temp_trace + if: '"temp_trace" in attributes' batch: send_batch_size: 10000 send_batch_max_size: 11000