You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: allow HTTP operations to be configurable via environment variable (#1352)
*Issue #, if available:*
*Description of changes:*
When HTTP span names don't contain a URL path, we generate the HTTP
operation by truncating the URL path to only the first trailing value to
preserve low cardinality (i.e. /api/v1/users -> /api). This can result
in overly broad operation groupings for services with endpoint paths of
various depths.
This PR introduces an environment variable configuration,
`OTEL_AWS_HTTP_OPERATION_PATHS`, which allows users to configure their
own HTTP endpoint paths. If this variable is provided, the span name's
URL path will resolve to the longest matching path. Wildcards are
supported with the following syntaxes: `{version}`, `:version`, or
simply `*`. This way, users can decide how their service endpoint are
grouped into operation names shown in CloudWatch.
Added unit and integration tests to verify behavior, and did some E2E
testing with an instrumented HTTP server.
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
Copy file name to clipboardExpand all lines: awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributesSpanExporter.java
Copy file name to clipboardExpand all lines: awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanMetricsProcessor.java
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -132,6 +132,10 @@ public boolean isStartRequired() {
132
132
publicvoidonEnd(ReadableSpanspan) {
133
133
SpanDataspanData = span.toSpanData();
134
134
135
+
// If OTEL_AWS_HTTP_OPERATION_PATHS is configured, wrap the span with the overridden name
136
+
// so that metrics use the configured operation path instead of the original span name.
Copy file name to clipboardExpand all lines: awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanProcessingUtil.java
Copy file name to clipboardExpand all lines: awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanMetricsProcessorTest.java
0 commit comments