-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Transform Processor function set_semconv_span_name()
#43145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Transform Processor function set_semconv_span_name()
#43145
Conversation
get_sem_conv_span_nameget_sem_conv_span_name()
|
@iblancasa would that UX meet your expectations? |
get_sem_conv_span_name()GetSemconvSpanName()
|
@iblancasa @Frapschen the PR of he OTTL based solution to deal with high cardinality span names is ready for review |
processor/transformprocessor/internal/traces/func_set_semconv_span_name.go
Show resolved
Hide resolved
|
@evan-bradley @edmocosta @TylerHelmuth please review updated PR for
|
processor/transformprocessor/internal/traces/func_set_semconv_span_name.go
Show resolved
Hide resolved
# Conflicts: # processor/transformprocessor/go.mod
# Conflicts: # processor/transformprocessor/go.mod
|
I'm sorry for the long delay, but let's please wait for a code-owner & approver review before adding the |
# Conflicts: # processor/transformprocessor/go.mod
Description
set_semconv_span_name(semconvVersion, Optional[originalSpanNameAttribute])Transform Processor function based solution for #43124
The
set_semconv_span_name()function overwrites a span name using the OpenTelemetry semantic conventions for HTTP, RPC, messaging, and database spans. In other cases, the originalspan.nameremains unchanged.The primary use case of the
set_semconv_span_name()function is to address high-cardinality issues in span metrics whenspan.namedoesn't comply with the OpenTelemetry requirement that span names be low cardinality.Parameters:
semconvVersionis the version of the Semantic Conventions used to generate thespan.name.originalSpanNameAttributeis the optional name of the attribute used to copy the originalspan.nameif different from the new name derived from semantic conventions. When not provided, the original span name is not copied.Examples
set_semconv_span_name("1.37.0")GET /api/v1/users/{id}GET /api/v1/users/{id}GET /api/v1/users/123gets sanitized without loss of information when recommended semantic convention span attributes are provided (e.g.http.request.methodandhttp.route).GET /api/v1/users/123is sanitized with some loss of information when recommended semantic convention span attributes are missing (e.g.,http.route).Backward compatibility:
GetSemconvSpanName()supports the version 1.37 of the semantic conventions and backward compatibilityfor the following attributes:
http.request.methodhttp.methodrpc.methodrpc.grpc.methodrpc.servicerpc.grpc.servicedb.system.namedb.systemdb.operation.namedb.operationdb.collection.namedb.nameTransform processor syntax examples:
set_semconv_span_name("1.37.0")set_semconv_span_name("1.37.0", "original_span_name")Ingestion pipeline preventing high cardinality on the
span.nameattribute of the metrics produced by the span metrics connector:Exceptions
Exception when the passed
semconvVersionis not supported by theset_semconv_span_name()function:Example with the OTel Demo
The OTel Demo handles the Next.js OTel span name high cardinality problem vercel/next.js#54694 with a fragile rewrite rule here .
set_semconv_span_name()offer a solid a flexible solution combiningset_semconv_span_name("1.37.0", "original_span_name")set(span.attributes["http.route"], "/api/products/{productId}") where ...Link to tracking issue
Fixes #43124
Testing
Tested successfully with the OpenTelemetry Demo
Documentation
Done, README.md updated.