Skip to content

feat: allow HTTP operations to be configurable via environment variable - #1352

Merged
ezhang6811 merged 8 commits into
aws-observability:mainfrom
ezhang6811:zhaez/http-operation-config
Apr 10, 2026
Merged

ezhang6811 merged 8 commits into
aws-observability:mainfrom
ezhang6811:zhaez/http-operation-config

Conversation

@ezhang6811

@ezhang6811 ezhang6811 commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

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.

@codecov-commenter

codecov-commenter commented Apr 9, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 72.36842% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.39%. Comparing base (09e6487) to head (3597c81).
⚠️ Report is 558 commits behind head on main.

Files with missing lines Patch % Lines
...try/javaagent/providers/AwsSpanProcessingUtil.java 71.62% 15 Missing and 6 partials ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@              Coverage Diff              @@
##               main    #1352       +/-   ##
=============================================
- Coverage     85.71%   69.39%   -16.33%     
- Complexity       19      704      +685     
=============================================
  Files             3       63       +60     
  Lines            49     3437     +3388     
  Branches          5      487      +482     
=============================================
+ Hits             42     2385     +2343     
- Misses            3      861      +858     
- Partials          4      191      +187     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ezhang6811
ezhang6811 force-pushed the zhaez/http-operation-config branch from b48fb3f to d04032d Compare April 9, 2026 23:18
@ezhang6811
ezhang6811 force-pushed the zhaez/http-operation-config branch from d04032d to f1f70bb Compare April 9, 2026 23:20
@ezhang6811
ezhang6811 force-pushed the zhaez/http-operation-config branch from 1a0a171 to 1b546fc Compare April 10, 2026 19:42
@ezhang6811
ezhang6811 marked this pull request as ready for review April 10, 2026 19:46
@ezhang6811
ezhang6811 requested a review from a team as a code owner April 10, 2026 19:46
wangzlei
wangzlei previously approved these changes Apr 10, 2026
@ezhang6811
ezhang6811 merged commit 2013c61 into aws-observability:main Apr 10, 2026
7 checks passed
@ezhang6811
ezhang6811 deleted the zhaez/http-operation-config branch April 10, 2026 22:24
ezhang6811 added a commit to aws-observability/aws-otel-python-instrumentation that referenced this pull request Apr 15, 2026
…le (#718)

*Issue #, if available:*

*Description of changes:*
Same as
aws-observability/aws-otel-java-instrumentation#1352

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 you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: ADOT Patch workflow <adot-patch-workflow@github.com>
ezhang6811 added a commit to aws-observability/aws-otel-js-instrumentation that referenced this pull request Apr 15, 2026
…le (#388)

*Issue #, if available:*

*Description of changes:*
Same as
aws-observability/aws-otel-java-instrumentation#1352

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 tests to verify behavior, and did some E2E testing with an
instrumented HTTP server.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: Lei Wang <66336933+wangzlei@users.noreply.github.com>
ezhang6811 added a commit to aws-observability/aws-otel-dotnet-instrumentation that referenced this pull request Apr 15, 2026
…le (#392)

*Issue #, if available:*

*Description of changes:*

Same as
aws-observability/aws-otel-java-instrumentation#1352

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 tests to verify behavior, and did some E2E testing with an
instrumented HTTP server.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
ezhang6811 added a commit that referenced this pull request Apr 16, 2026
…le (#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.
ezhang6811 added a commit that referenced this pull request Apr 16, 2026
… variab… (#1359)

Backpatch #1352 to release 2.26.x branch.

*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.

*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
@github-actions github-actions Bot mentioned this pull request Jun 19, 2026
ezhang6811 added a commit to aws-observability/aws-otel-dotnet-instrumentation that referenced this pull request Aug 5, 2026
…SP.NET Core spans (#441)

## Description

For ASP.NET Core server spans, `GetIngressOperation` always took the
`HttpContextWeakRef` branch and derived the operation from the framework
route template, overwriting the `DisplayName` that
`ApplyOperationPathSpanName` set from `OTEL_AWS_HTTP_OPERATION_PATHS`.
As a result the configuration had **no effect** on `aws.local.operation`
in .NET, unlike Java
([#1352](aws-observability/aws-otel-java-instrumentation#1352))
and Python
([#718](aws-observability/aws-otel-python-instrumentation#718)).

This resolves the configured operation path in `GetIngressOperation`
**before** the route-template branch, so a configured path takes
precedence, matching the other languages. `ApplyOperationPathSpanName`
now shares the same matching logic via `GetOperationPathOverride`.

## Testing

Added a unit test verifying the configured path wins over the ASP.NET
Core route template when `HttpContextWeakRef` is present. Full suite
passes on net8.0 and net10.0.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants