Skip to content

chore: instana-otlp span mapper#2534

Draft
abhilash-sivan wants to merge 9 commits intochore-otlp-playgroundfrom
chore-otel-span-mapper
Draft

chore: instana-otlp span mapper#2534
abhilash-sivan wants to merge 9 commits intochore-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

@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

@abhilash-sivan abhilash-sivan changed the title Chore otel span mapper chore: instana-otlp span mapper May 7, 2026
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.

1 participant