Open biswajit-nanda opened 1 year ago
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.
Is there any update on this?
@biswajit-nanda we have not gotten around to work on this one yet. I'm marking it up-for-grabs
in case someone has some cycles to work on it.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.
This took me quite a while to figure out today:
It looks like this is already set correctly as long as the response handler subscribes to the data
event on the IncomingMessage
in the callback. I'm wondering if there's a reason why we set the span status only on the end
and close
events, even though we'd be able to set it on response
already. :thinking:
Very minimal reproduction:
// Will NOT add span status
const req = http.get({
hostname: 'httpstat.us',
port: 80,
path: '/410',
method: 'GET',
}, (response) => { });
req.end();
// Will add span status as handling 'data' will also trigger 'end' later on,
// the 'end' event is also what we register in the instrumentation.
const req = http.get({
hostname: 'httpstat.us',
port: 80,
path: '/410',
method: 'GET',
}, (response) => {
response.on('data', (chunk) => {});
});
req.end();
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.
This issue was closed because it has been stale for 14 days with no activity.
This is still happening (see reproducer). I'm unassigning myself as I won't have time to work on this for now.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.
What happened?
I have a very simple node.js application that receives a HTTP request and then makes a HTTP get call to http://httpstat.us:80/410 which returns a 410 status code.
Please see the attached reproduction.zip/app.js.
The instrumentation is done using attached reproduction.zip/tracing.js.
The application gets instrumented successfully, but the Span Status of the Client Span making the HTTP call to http://httpstat.us:80/410 is returned as UNSET even if the HTTP Status Code is coming as 410.
Please see the below SPAN snippet in my Otel Collector logs attached: reproduction.zip//otelcol.log.
As per OpenTelemetry Specs (https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#status), for HTTP status codes in the 4xx range span status MUST be left unset in case of SpanKind.SERVER and MUST be set to Error in case of SpanKind.CLIENT.
Steps to Reproduce:
a. Make sure that you have node.js installed on your machine. b. Make sure that you have an OpenTelemetry Collector running on your machine receiving traces over HTTP at http://localhost:4318/v1/traces. It is preferable to configure a logging exporter with loglevel set to debug and add that service->pipelines->traces->exporters c. Download the attached reproduction.zip and unzip it. b. Open a commandline from the unzipped directory and run the app as: node -r ./tracing.js app.js
Expected Result:
Span #1 Trace ID : 317adf38045b52a99bcde15d01fa5b3c Parent ID : cca2305261e20ef6 ID : 785733c484f7ddfa Name : HTTP GET Kind : SPAN_KIND_CLIENT Start time : 2023-01-24 19:56:31.086000128 +0000 UTC End time : 2023-01-24 19:56:31.393211392 +0000 UTC Status code : STATUS_CODE_ERROR Status message : Attributes: -> http.url: STRING(http://httpstat.us/410) -> http.method: STRING(GET) -> http.target: STRING(/410) -> net.peer.name: STRING(httpstat.us) -> http.host: STRING(httpstat.us:80) -> net.peer.ip: STRING(20.40.202.3) -> net.peer.port: INT(80) -> http.response_content_length_uncompressed: INT(8) -> http.status_code: INT(410) -> http.status_text: STRING(GONE) -> http.flavor: STRING(1.1) -> net.transport: STRING(ip_tcp)
Actual Result
Span #1 Trace ID : 317adf38045b52a99bcde15d01fa5b3c Parent ID : cca2305261e20ef6 ID : 785733c484f7ddfa Name : HTTP GET Kind : SPAN_KIND_CLIENT Start time : 2023-01-24 19:56:31.086000128 +0000 UTC End time : 2023-01-24 19:56:31.393211392 +0000 UTC Status code : STATUS_CODE_UNSET Status message : Attributes: -> http.url: STRING(http://httpstat.us/410) -> http.method: STRING(GET) -> http.target: STRING(/410) -> net.peer.name: STRING(httpstat.us) -> http.host: STRING(httpstat.us:80) -> net.peer.ip: STRING(20.40.202.3) -> net.peer.port: INT(80) -> http.response_content_length_uncompressed: INT(8) -> http.status_code: INT(410) -> http.status_text: STRING(GONE) -> http.flavor: STRING(1.1) -> net.transport: STRING(ip_tcp)
Additional Details
reproduction.zip
OpenTelemetry Setup Code
package.json
Relevant log output