Skip to content

[Playground] OTLP-Mapper - instana to otlp span mapper#2534

Draft
abhilash-sivan wants to merge 12 commits into
chore-otlp-playgroundfrom
chore-otel-span-mapper
Draft

[Playground] OTLP-Mapper - instana to otlp span mapper#2534
abhilash-sivan wants to merge 12 commits into
chore-otlp-playgroundfrom
chore-otel-span-mapper

Conversation

@abhilash-sivan
Copy link
Copy Markdown
Contributor

@abhilash-sivan abhilash-sivan commented May 4, 2026

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.js

  • finalize architecture
  • test: send traces via otlp port and metrics via standard port - Idenfies 2 diff apps 1. Otel and 2. Node.js. We have to add metrics mapping. Discussed/Agreed with community.
  • figure out: node.http.server - what is the official otel name/value so that the backend is labeling everything correctly in the UI? (prio 1)

https://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.

@abhilash-sivan abhilash-sivan force-pushed the chore-otel-span-mapper branch from 4490ab0 to f1c0d6f Compare May 4, 2026 18:07
@abhilash-sivan abhilash-sivan changed the base branch from main to chore-otlp-playground May 7, 2026 06:42
@abhilash-sivan abhilash-sivan force-pushed the chore-otel-span-mapper branch from 53e1fcc to d261bc5 Compare May 7, 2026 12:45
// console.log(JSON.stringify(otlpFormat));

const payloadAsString = JSON.stringify(otlpFormat, circularReferenceRemover());
const payloadAsString = JSON.stringify(data, circularReferenceRemover());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing the conversion from spanBuffer

* @param {import('../../core').InstanaBaseSpan} span
* @returns {import('../../core').InstanaBaseSpan} The transformed span.
*/
module.exports.transform = span => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same transform logic, like we already do for instana internal format to backend compatible conversion

'use strict';

// Gespeicherte Resource-Informationen für Metrics (wenn kein "from" Feld vorhanden)
const { getOtlpAttributeMappings } = require('./backend_mappers/otlpMapper');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved the file to core


const otlpKey = sectionMappings[field] || `${dataKey}.${field}`;

// Determine value type and format
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This attribute addition is optional

if (normalized.length > 32) {
return normalized.slice(-32);
}
return normalized.padStart(32, '0');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepending with 0s due to the length mismatch for traceId.
We currently use 16, but otel uses 32

spans = [];
batchingBuckets.clear();

const processedSpans =
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you want to organize the agent ports etc?

OTLP mode is on -> port will change.
There is something missing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@abhilash-sivan abhilash-sivan changed the title Chore otel span mapper chore: instana-otlp span mapper May 7, 2026
@abhilash-sivan abhilash-sivan changed the title chore: instana-otlp span mapper [Playground] OTLP-Mapper - instana to otlp span mapper May 8, 2026
const agentOpts = require('./agent/opts');
const cmdline = require('./cmdline');
const otlpTransformer = require('./otlpTransformer');
const otlpTransformer = require('@instana/core/src/tracing/otlpTransformer');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please reset the file? I think no changes needed as part of this playground, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, no major changes here. Only the relevant change is removing the Otel span transforming logic from this file

};
return createSafeTransform(mapper.transform);
},
get otlpTransform() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a backend mapper.
Could you please move this unit to an otlp mapper folder?
The folder will have multiple files later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah got it

},

// resource but added for ui view, without this .. ?
service: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is right? Service is part of resource attrs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it is a resource; I will remove this. I wonder how the UI mappings will change because this is shown in the UI under the calls section:

Screenshot 2026-05-13 at 3 46 33 PM

Maybe this will be inherited from env var, I will check and update accordingly

@kirrg001
Copy link
Copy Markdown
Contributor

test: send traces via otlp port and metrics via standard port - Idenfies 2 diff apps 1. Otel and 2. Node.js

This needs to be communicated in the next WG. Traces & Metrics mapping is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants