open-telemetry / opentelemetry-cpp-contrib

https://opentelemetry.io/
Apache License 2.0
123 stars 137 forks source link

Add more Resource Attributes to the Otel-Webserver-Module Nginx instrumentation. #404

Open aryanishan1001 opened 6 months ago

aryanishan1001 commented 6 months ago

Some more resource attributes could be exported with the spans. Like request and response headers.

kyungeunni commented 5 months ago

+1 on this issue.

otel-webserver-module Nginx instrumentation doesn't add required attributes according to HTTP semantic conventions, at least for HTTP Client span.

To give you a concrete example, I instrumented nginx app using the steps mentioned in this [blog]. I noticed a Span named ngx_http_otel_mirror_handler_ which seems to proxy a request. The only attribute it contain is interactionType: Str(EXIT_CALL). This Span is an HTTP Client span and I expect to see it contains required attributes.

Here's the example from the collector:

2024-04-03 13:42:15 Span #10
2024-04-03 13:42:15     Trace ID       : 5d63285f0ac981b795de11849eb46803
2024-04-03 13:42:15     Parent ID      : 454268c37f58c99e
2024-04-03 13:42:15     ID             : cf87334511ce3de3
2024-04-03 13:42:15     Name           : ngx_http_otel_mirror_handler_
2024-04-03 13:42:15     Kind           : Client
2024-04-03 13:42:15     Start time     : 2024-04-03 04:42:10.916024295 +0000 UTC
2024-04-03 13:42:15     End time       : 2024-04-03 04:42:10.916064337 +0000 UTC
2024-04-03 13:42:15     Status code    : Ok
2024-04-03 13:42:15     Status message : 
2024-04-03 13:42:15 Attributes:
2024-04-03 13:42:15      -> interactionType: Str(EXIT_CALL)