Hi everyone. I am trying to reduce the cardinality...
# general
a
Hi everyone. I am trying to reduce the cardinality of exceptions by replacing UUIDs with the text '{UUID}' using the transform processor but I'm having hard time matching the "exception.message" using https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/ottlfuncs/README.md#replace_pattern with the following:
Copy code
transform:
        trace_statements:
        - context: span
          statements:
          - replace_pattern(events.attributes["exception.message"], "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", "{UUID}")
An example span in clickhouse events column contains:
Copy code
┬─events─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬
['{
  "name": "exception",
  "timeUnixNano": 1712015182708514000,
  "attributeMap": {
    "exception.message": "Error occured: key NotFound for object f777277a-694f-4444-a3f0-5e60386c01c7",
    "exception.stacktrace": "System.Exception: Error occured key notfound NotFound for object f777277a-694f-4444-a3f0-5e60386c01c7",
    "exception.type": "System.Exception"
  },
  "isError": true
}']
I'm unsure if the complexity of the regex is not supported, or the way I'm attempting to locate the exception message
events.attributes["exception.message"]
is wrong. Thanks for any help.
In the span context,
events.attributes
type is `ptrace.SpanEventSlice`and the replace functions of transform expect
pcommon.Map
In order to transform
events.attributes
, you must use
trace_statements.context: spanevent
and replace on
attributes
.