[Playground] OTLP-Mapper - instana to otlp span mapper#2534
[Playground] OTLP-Mapper - instana to otlp span mapper#2534abhilash-sivan wants to merge 37 commits into
Conversation
4490ab0 to
f1c0d6f
Compare
53e1fcc to
d261bc5
Compare
| spans = []; | ||
| batchingBuckets.clear(); | ||
|
|
||
| const processedSpans = |
There was a problem hiding this comment.
This is where the conversion is happening.
This seems to be the optimal place because if we convert early, then in some places we talk Instana format and it could raise unexpected issues. So before transmission seems simple and maintanable
There was a problem hiding this comment.
Should we do this here or just after the current BE transformation,
https://github.com/instana/nodejs/pull/2534/changes?utm_source=chatgpt.com#diff-462ace70d7ac6eb4cd6f82756059c88629bfad1463fde0498d89106d7ccc8104L193
Right now we’re applying the transformation after collecting all spans. IMO it would be cleaner to do it before calling transmitSpans, so the transmit layer only deals with already-transformed spans.
TBD
There was a problem hiding this comment.
Yeah, I agree. This would be a more cleaner way
// Transform internal span data format into external (backend) readable format.
span = applySpanTransformation(span);
Just after this transformation, we can call the Otel transformation.
There was a problem hiding this comment.
One thing we have to consider is that currently all the spans intended for transmission — i.e., the array of spans — are converted together. If we do it in the above-mentioned area, we will have to process the spans individually.
There was a problem hiding this comment.
Note: TBD — Transform each span to OTLP format immediately in addSpan and store them in OTLP format in the buffer if batching is enabled. This would require changes to the batching logic.
There was a problem hiding this comment.
How do you want to organize the agent ports etc?
OTLP mode is on -> port will change.
There is something missing.
There was a problem hiding this comment.
Also:
How can we skip the agent announcement cycle when connecting to an otel collector later?
Did you draw that path as well to confirm the architecture?
There was a problem hiding this comment.
No, I haven’t worked much on the architecture yet. I can work on the dynamic port connections part, and I’ll also think through the agent announcement cycle and how we can skip it when connecting to an OTel collector
This needs to be communicated in the next WG. Traces & Metrics mapping is required. |
08a2757 to
e827e9c
Compare
e827e9c to
d6c01a6
Compare
| * RabbitMQ-specific mappings | ||
| * Extends base messaging with RabbitMQ-specific fields | ||
| */ | ||
| rabbitmq: { |
There was a problem hiding this comment.
Not verified rabbitmq per se. It's just to show how we differentiate children under messaging or any other group.
| mappings: SPAN_ATTRIBUTE_MAPPINGS.kafka, | ||
| prefix: 'messaging.kafka', | ||
| additionalAttributes: { | ||
| 'messaging.system': 'kafka' |
There was a problem hiding this comment.
Why do we need that here? If we have already a custom kafka mapping object?
There was a problem hiding this comment.
messaging.system is an additional attribute that we append to the span. For Kafka, the system name also happens to be kafka, so it may seem redundant at first glance.
However, additionalAttributes is intended for constant or computed attributes that do not directly map from a single field inside span.data.kafka.
messaging.system falls into that category since it is effectively a constant defined per transformer, rather than something extracted from the incoming span payload itself.
I have changed this to: 'messaging.system': this.systemName
which will fetch the appropriate value in this case
| // Apply all metadata transformations in one call | ||
| Object.assign(otelSpan, applyMetadataTransformations(instanaSpan, OTEL_METADATA_MAPPINGS)); | ||
|
|
||
| // Override span name and status using transformer (protocol-specific logic) |
There was a problem hiding this comment.
Override? Where was it set in the first place?
| } | ||
|
|
||
| // Step 2: Process additional data keys | ||
| Object.keys(instanaSpan.data).forEach(dataKey => { |
There was a problem hiding this comment.
Can't we just re-use getTransformer?
Just with a different level?
| * Uses only the base messaging fields | ||
| * @see https://opentelemetry.io/docs/specs/semconv/messaging/ | ||
| */ | ||
| messaging: BASE_MAPPINGS.messaging, |
There was a problem hiding this comment.
This does not belong here or?
UI: https://instana.io/s/B2R0pfHbSpaV5jXmQNDd7w
This is just a playground where we convert Instana spans to Otel spans and send them to the Otel backend.
INSTANA_OTLP_FORMAT=true SERVICE_NAME=test-nodejs-service INSTANA_DEBUG=true node index.jshttps://instana.io/s/Ehe2Zhb7QyKyxrmQg0fK8Q The BE uses path_tpl or url values ot show in the UI, so we mapped the otel span name to the same data from Instana span.
After conversion using the script: