-
Notifications
You must be signed in to change notification settings - Fork 846
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
Incorrect SpanKind sent by oltp-transformer #3631
Comments
numeric enum values in OTel-JS API are of by one compared to OTLP protocol, see here. So OTEL export is correct. |
@Flarna Thanks, Is JS-API being off by one a permanent design decision or it can change in future ? Nowhere in the chain we're using enum strings. Using enum strings as span.kind, or span.kind.enum is this something can be merged upstream ? Looks like for now I'll have to write my own exporter |
The OTLP protocol and the OTel JS API enum values are two mostly independent types. Therefore noone should expect that numeric representation of enum values matches. API users/instrumentations should use the enum type from API and don't care about the numeric value.
Not sure if I understand you correct as usually the enum type is used not the numeric value, see e.g. here. Using the calculated value in OTLP exporter is a shortcut/optimization to avoid a longer switch/case statement. If your backend requires the SpanKind values from OTel JS I would recommend to fix this there and follow OTLP protocol instead JS API. FWIW python seems to be also one of in their API see here. |
@Flarna Yes, I agree we should use enum types from OLTP protocol not the numeric value. But OLTP-exporter is not sending enum types back to the collector, instead it sends numeric values ex: span.kind=2 , which in case of Otel-JS refers to Server span. In my receiver backend also, instead of receiving enum types, I am getting span.kind = 2. I expect it to either match with Otel API, or send an enum type. Thanks again. |
@Flarna To be clear I want to propose this change in this sdkSpantoOltpSpan Current Proposed |
Don't what you wan't to archive by this. OTLP is using protobuf and enums in protobuf are transferred as ints over the wire. So everything else then a The conversion from the |
Oh! okay, I wasn't aware of this. Thanks, closing the issue then. |
What happened?
SpanKinds: https://github.com/open-telemetry/opentelemetry-js/blob/main/api/src/trace/span_kind.ts
1 -> server
2 -> client
ConsoleSpanProcessor logs span.kind=1 for server span.
But OLTP transformer increments it to 1 in function
sdkSpanToOtlpSpan
.Steps to Reproduce
Span emitted by console processor.
Expected Result
Actual Result
Additional Details
Bug cause: https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/otlp-transformer/src/trace/internal.ts#L38
First added in PR: #2746
@dyladan I'de be happy to make a PR to fix this. Or is there some rationale behind the + 1 ?
OpenTelemetry Setup Code
No response
package.json
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: