opentelemetry-sdk-workers
opentelemetry-sdk-workers copied to clipboard
Define SpanKind
Hi,
I have a question regarding SpanKind
which is set to INTERNAL
now.
As per docs:
- https://opentelemetry.io/docs/concepts/signals/traces/#internal
- https://opentelemetry.io/docs/reference/specification/trace/api/#spankind
INTERNAL
span kind should be used to instrument some internal functions/operations within application process.
Workers are technically a remote service, so I believe they should produce SERVER
spans.
Overall, such inconsistency results in Elastic APM incorrectly "drawing" such spans on a timeline, because the timestamps of worker traces differ from client/backend traces, since they are sent in different times.
The current workaround for me looks like this:
const oTelSdk = new WorkersSDK(request, ctx, env, {
service: "myWorker",
...
});
oTelSdk.span.kind = SpanKind.SERVER; // ugly hack :)
Is there possibility to change this default span kind or give possibility to override it on API level?