-
Notifications
You must be signed in to change notification settings - Fork 838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exporter-collector-grpc traceId and spanId values in protobuf are incorrect #1623
Comments
@blumamir Which collector version are using ? If you are using the latest ( |
I tried with collector version v.0.12.0 and still see wrong traceId. and this is the collector config: receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:55680
http:
endpoint: 0.0.0.0:55681
processors:
batch:
exporters:
logging:
logLevel: debug
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [logging] |
tried to run it now agains the basic-trace-node modified to export with grpc like this: const {
CollectorTraceExporter,
} = require("@opentelemetry/exporter-collector-grpc");
const provider = new BasicTracerProvider({ logger: console });
// Configure span processor to send spans to the exporter
const exporter = new CollectorTraceExporter({ serviceName: "basic-service" });
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); What I get in JS is: {
traceId: 'b2685323bfd7fcb29f663d259cc14578',
parentId: '7700ed8e54dea186',
name: 'doWork',
id: 'd1583ba517c280b4',
kind: 0,
timestamp: 1603639516438789,
duration: 862,
attributes: { key: 'value' },
status: { code: 0 },
events: [ { name: 'invoking doWork', attributes: undefined, time: [Array] } ]
}
In collector I get this:
|
I think this is most likely related to #1513 (implemented in #1588, released in https://github.com/open-telemetry/opentelemetry-js/releases/tag/v0.12.0). The collector recently changed how it interprets trace and span ids. Either we incorrectly implemented the fix or you are using an incompatible collector version. Can you clarify exactly which collector version you're using? |
I tested it both with opentelemetry-collector v0.12.0 and with collector v0.13.0 (latest) |
@obecny Seems like there may be a bug in the id conversion using grpc. |
so this is funny, when I added back conversion from hex to base64 grpc and proto works fine. So what is wrong with collector ? Was the spec |
@obecny Tested your fix and it works well now, both with gRPC and HTTP/JSON. Thank you for fixing it. The one issue that I still think is problematic is the types in this file. |
Hi @alolita from our last Sig meeting we should prepare next version this week. |
What version of OpenTelemetry are you using?
v0.12.0
What version of Node are you using?
v12.18.3
Please provide the code you used to setup the OpenTelemetry SDK
What did you do?
Used the exporter-collector-grpc to export traces to the latest version of opentelemetry-collector.
Then I used the loggingExporter to log the traces as they received in the collector, and kinesisexporter to export traces from the collector.
What did you expect to see?
Expected the trace id and span id to match the value I see in JS when they are created.
What did you see instead?
In the logging exporter I see different values then the values in JS.
For example, instead of the following trace id:
0c3a85a5506373fd7448be50881ebf58
(valid length of 32 hex -> 16 bytes), I get the following trace id in the collector:d1cddaf396b9e74eb7ef77ddef8e3c6dee74f3cd5e6dfe7c
(48 hex -> 24 bytes).When I try to export the data to kinesis in Jaeger format, I get the following error:
2020-10-25T14:59:21.808+0200 ERROR [email protected]/exporter.go:54 error translating span batch {"metadata": {"appName":"opentelemetry-collector","appVersion":"latest","env":"","hostname":"Amirs-MacBook-Pro.local"}, "component_kind": "exporter", "component_type": "kinesis", "component_name": "kinesis", "error": "TraceID does not have 16 bytes"}
Additional context
When printing the incoming protobuf message in the otlpreceiver, the value is already incorrect, so the issue is probably in the JS exporter. Also, the rest of the span as logged in the the collector do look ok, it is just the trace and span ids which are incorrect.
I suspect that the issue is that when transforming the traces in js to proto format, the
traceId
andspanId
are used as strings where in the proto file they are defined as bytesI can see that in the metrics definitions they are not defined as string but as UInt8Array which I believe is the right type.
I am not familiar enough with protobut and grpc, but suspect that there is a missing transformation from the string representation of the trace where each hex digit is saved as ascii code, to the bytes array representation of the actual values.
The text was updated successfully, but these errors were encountered: