Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/collector/src/agentConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const pathUtil = require('path');
const circularReferenceRemover = require('./util/removeCircular');
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

/** @typedef {import('@instana/core/src/core').InstanaBaseSpan} InstanaBaseSpan */

/** @type {import('@instana/core/src/core').GenericLogger} */
Expand Down Expand Up @@ -314,7 +314,7 @@ exports.sendMetrics = function sendMetrics(data, cb) {
firstTwoKeys[dataKeys[i]] = data[dataKeys[i]];
}

logger.debug(`sendMetrics called with data (first 2 keys): ${JSON.stringify(firstTwoKeys)}`);
// logger.debug(`sendMetrics called with data (first 2 keys): ${JSON.stringify(firstTwoKeys)}`);

// Transform Instana metrics to OTLP format
const otlpMetrics = otlpTransformer.transformMetrics(data);
Expand Down Expand Up @@ -344,15 +344,15 @@ exports.sendMetrics = function sendMetrics(data, cb) {
}
}

logger.debug(`Transformed to OTLP (first 2 metrics) ${JSON.stringify(otlpPreview)}`);
// logger.debug(`Transformed to OTLP (first 2 metrics) ${JSON.stringify(otlpPreview)}`);

// Send directly without using sendData (which would transform again)
sendOtlpData('/v1/metrics', otlpMetrics, err => {
if (err) {
logger.error('Error sending metrics:', err);
cb(err, null);
} else {
logger.debug('Metrics sent successfully');
// logger.debug('Metrics sent successfully');
// OTLP endpoints don't return requests like the old Instana endpoint
// Always return empty array for compatibility
cb(null, []);
Expand All @@ -370,10 +370,10 @@ exports.sendSpans = function sendSpans(spans, cb) {
if (err && !maxContentErrorHasBeenLogged && err instanceof PayloadTooLargeError) {
logLargeSpans(spans);
} else if (err) {
const spanInfo = getSpanLengthInfo(spans);
const spanInfo = spans;
logger.debug(`Failed to send: ${JSON.stringify(spanInfo)}`);
} else {
const spanInfo = getSpanLengthInfo(spans);
const spanInfo = spans;
logger.debug(`Successfully sent: ${JSON.stringify(spanInfo)}`);
}
cb(err);
Expand Down Expand Up @@ -475,11 +475,11 @@ function sendData(path, data, cb, ignore404 = false) {
cb = util.atMostOnce(`callback for sendData: ${path}`, cb);
console.log(JSON.stringify(data));
// Transform Instana format to OTLP format
const otlpFormat = otlpTransformer(data);
// const otlpFormat = otlpTransformer(data);

console.log(JSON.stringify(otlpFormat));
// console.log(JSON.stringify(otlpFormat));

const payloadAsString = JSON.stringify(otlpFormat, circularReferenceRemover());
const payloadAsString = JSON.stringify(data, circularReferenceRemover());
Comment thread
abhilash-sivan marked this conversation as resolved.
if (typeof logger.trace === 'function') {
logger.trace(`Sending data to ${path}.`);
} else {
Expand Down
Loading