opentelemetry-js
opentelemetry-js copied to clipboard
Received http2 header with status: 404
What version of OpenTelemetry are you using? 0.17.0
What version of Node are you using? v14.15.5
Please provide the code you used to setup the OpenTelemetry SDK
const traceCollectorOptions = {
serviceName: 'basic-metric-service',
url: 'https://domain.com:443'
}
const traceExporter = new CollectorTraceExporter(traceCollectorOptions)
const traceprovider = new BasicTracerProvider({
exporter: traceExporter,
interval: 5000
});
traceprovider.addSpanProcessor(new SimpleSpanProcessor(traceExporter));
traceprovider.register();
What did you do?
I had a ton of problems getting grpc to work though traefik, for for some reason it would only work when using a dedicated port, until I tried adding port's to the url. If using http://domain.com:80 instead of http://domain.com then things worked. I just don't see why there is a need to add port ? But grpc will only work if port is included for me. So I try using https://domain.com or https://domain.com:443 but I still get "Received http2 header with status: 404".
I assumed https was not supported, so I turned to my C# code, and here everything is reverse?!?
If I set Endpoint on the otlpOptions to http://domain.com or http://domain.com:80 I get "Received http2 header with status: 404" but if I use https://domain.com or https://domain.com:443 it works.
So clearly https, is working, it's just not working for the nodejs library. (no idea why http is not working from C# even with
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); set )
Since I would prefer to use https, I'm creating the issue for the nodejs client about how to make it work for https, if that is possible ?
What did you expect to see?
No errors when using https
What did you see instead?
Received http2 header with status: 404
which version of collector? are you using, can you please add full code including package.json, docker container configuration if you are using docker etc. etc. You might also create a repo with all the code and post a link to it - that would simplify things even more, thx.
I have copy and pasted a bit in the two open telemetry samples. In this oteltest repo I added a simple nodejs example that sends a few spans, and a C# console app that does the same. in Program.cs you can swap between using http or https and in tracing.js you can also swap between http and https I added a few valid certificates in acme.json that the default docker-compose / traefik is using, if you want to create your own, I left the dns01 config for setting up traefik to request lets encrypt certificates using DNS hosted at google.
As you can see, the C# example has no issue sending spans using https toward https://otel.localhost.openiap.io but the nodejs version only works using http://otel.localhost.openiap.io:80 but not https://otel.localhost.openiap.io ( nor http://otel.localhost.openiap.io witch I still think is weird )
Any progress on this ? Do you need me to update the certificates in the sample ? I just tested with @opentelemetry/[email protected] and the error has changed to
{"stack":"Error: 13 INTERNAL: Received RST_STREAM with code 0
at Object.callErrorFromStatus (C:\\code\\openflow\\node_modules\\@grpc\\grpc-js\\build\\src\\call.js:31:26)
at Object.onReceiveStatus (C:\\code\\openflow\\node_modules\\@grpc\\grpc-js\\build\\src\\client.js:179:52)
at Object.onReceiveStatus (C:\\code\\openflow\\node_modules\\@grpc\\grpc-js\\build\\src\\client-interceptors.js:336:141)
at Object.onReceiveStatus (C:\\code\\openflow\\node_modules\\@grpc\\grpc-js\\build\\src\\client-interceptors.js:299:181)
at C:\\code\\openflow\\node_modules\\@grpc\\grpc-js\\build\\src\\call-stream.js:145:78
at processTicksAndRejections (internal/process/task_queues.js:75:11)","message":"13 INTERNAL: Received RST_STREAM with code 0","code":"13","details":"Received RST_STREAM with code 0","metadata":"[object Object]","name":"Error"}
Not sure if anyone is reading this, but tried updating all packages from 0.19.0 to 0.21.0 Now, it does not even work with http anymore ... Same error as above ... Am I using the product wrong? Are we not supposed to connct the client library to and instance of opentelemetry-collector ? If not, then what are suppose to be use to collect the metrics and spans ?
I'll look into your sample code today
I have update the repo with a fresh certificate, since the old one had expired.
Not sure if related, but I just saw the same error when I didn't configure the otlp-grpc exporter with secure credentials:
const grpc = require("@grpc/grpc-js");
provider.addSpanProcessor(
new SimpleSpanProcessor(
new CollectorTraceExporter({
url: '<secure-endpoint>',
credentials: grpc.credentials.createSsl(), // I was missing this line, which defaults to grpc.credentials.createInsecure() if unspecified
metadata
})
)
);
Port handling was updated in an exporter rewrite a while ago and we just didn't close this issue at the time. This should be fixed.