Added fix to set the aws.local.operation to include the proper route template for both Server and Client spans. Previously, only the parent will have the route template like /outgoing-http-call/test/{id} while the child would have /outgoing-http-call. This fixes that for ASP.Net (Net Framework net462 and above). This is a follow-up PR to the ASP.Net Core (net6/net8) fix https://github.com/aws-observability/aws-otel-dotnet-instrumentation/pull/130.
Testing
With Fix:
Ran the sample app included in this PR and got the following (keep an eye on aws.local.operation):
Previously, without this change, this is what the spans look like. You can see that the CLIENT aws.local.operation is GET /outgoing-http-call while the SERVER is GET outgoing-http-call/test/{id}:
PS C:\Program Files\IIS Express> .\iisexpress.exe /path:"C:\Users\AsakerMohd\Downloads\aws-otel-dotnet-instrumentation\sample-applications\NetFrameworkSampleApp\HttpServer"
Starting IIS Express ...
Successfully registered URL "http://localhost:8080/" for site "Development Web Site" application "/"
Registration completed
IIS Express is running.
Enter 'Q' to stop IIS Express
info: AWS.Distro.OpenTelemetry.AutoInstrumentation.Plugin[0]
AWS Application Signals enabled
Request started: "GET" http://localhost:8080/outgoing-http-call/test/2
Activity.TraceId: ffb57aabc2cc916d8face2b58cf45bf1
Activity.SpanId: ff31d7b215cf5e58
Activity.TraceFlags: Recorded
Activity.ParentSpanId: 0f617f6f82e21487
Activity.ActivitySourceName: OpenTelemetry.Instrumentation.Http.HttpWebRequest
Activity.ActivitySourceVersion: 1.9.0.41
Activity.DisplayName: GET
Activity.Kind: Client
Activity.StartTime: 2024-10-30T19:24:19.9648106Z
Activity.Duration: 00:00:00.2092667
Activity.Tags:
aws.local.operation: GET /outgoing-http-call
http.request.method: GET
server.address: aws.amazon.com
server.port: 443
url.full: https://aws.amazon.com/
network.protocol.version: 1.1
http.response.status_code: 200
aws.local.service: aws-otel-integ-test
aws.remote.service: aws.amazon.com:443
aws.remote.operation: GET /
aws.span.kind: CLIENT
Resource associated with Activity:
telemetry.distro.name: aws-otel-dotnet-instrumentation
telemetry.distro.version: 1.3.2.dev0-aws
host.name: DESKTOP-URG1SNG
host.id: dc223e93-cd25-47f6-867e-f0f75a033201
process.owner: AsakerMohd
process.pid: 29848
process.runtime.description: .NET Framework 4.8.9261.0
process.runtime.name: .NET Framework
process.runtime.version: 4.8.1
telemetry.sdk.name: opentelemetry
telemetry.sdk.language: dotnet
telemetry.sdk.version: 1.9.0
service.name: aws-otel-integ-test
Activity.TraceId: ffb57aabc2cc916d8face2b58cf45bf1
Activity.SpanId: 0f617f6f82e21487
Activity.TraceFlags: Recorded
Activity.ActivitySourceName: OpenTelemetry.Instrumentation.AspNet.Telemetry
Activity.ActivitySourceVersion: 1.9.0-beta.1
Activity.DisplayName: GET outgoing-http-call/test/{id}
Activity.Kind: Server
Activity.StartTime: 2024-10-30T19:24:19.4963137Z
Activity.Duration: 00:00:00.8944263
Activity.Tags:
server.address: localhost
server.port: 8080
url.scheme: http
http.request.method: GET
network.protocol.version: 1.1
url.path: /outgoing-http-call/test/2
user_agent.original: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
http.response.status_code: 200
http.route: outgoing-http-call/test/{id}
aws.local.service: aws-otel-integ-test
aws.local.operation: GET outgoing-http-call/test/{id}
aws.span.kind: LOCAL_ROOT
Resource associated with Activity:
telemetry.distro.name: aws-otel-dotnet-instrumentation
telemetry.distro.version: 1.3.2.dev0-aws
host.name: DESKTOP-URG1SNG
host.id: dc223e93-cd25-47f6-867e-f0f75a033201
process.owner: AsakerMohd
process.pid: 29848
process.runtime.description: .NET Framework 4.8.9261.0
process.runtime.name: .NET Framework
process.runtime.version: 4.8.1
telemetry.sdk.name: opentelemetry
telemetry.sdk.language: dotnet
telemetry.sdk.version: 1.9.0
service.name: aws-otel-integ-test
Response sent: http://localhost:8080/outgoing-http-call/test/2 with HTTP status 200.0
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Description of changes:
Added fix to set the aws.local.operation to include the proper route template for both Server and Client spans. Previously, only the parent will have the route template like
/outgoing-http-call/test/{id}
while the child would have/outgoing-http-call
. This fixes that for ASP.Net (Net Framework net462 and above). This is a follow-up PR to the ASP.Net Core (net6/net8) fix https://github.com/aws-observability/aws-otel-dotnet-instrumentation/pull/130.Testing
With Fix:
Ran the sample app included in this PR and got the following (keep an eye on aws.local.operation):
Without Fix:
Previously, without this change, this is what the spans look like. You can see that the CLIENT aws.local.operation is
GET /outgoing-http-call
while the SERVER isGET outgoing-http-call/test/{id}
:By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.