Tempo: Fix Otel span kind mapping in trace upload resultTransformer (#43168)
* Fix otel span kind mapping * Parse span kind from enum string
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
|||||||
TraceLog,
|
TraceLog,
|
||||||
TraceSpanRow,
|
TraceSpanRow,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { SpanKind, SpanStatus, SpanStatusCode } from '@opentelemetry/api';
|
import { SpanStatus, SpanStatusCode } from '@opentelemetry/api';
|
||||||
import { collectorTypes } from '@opentelemetry/exporter-collector';
|
import { collectorTypes } from '@opentelemetry/exporter-collector';
|
||||||
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
|
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
|
||||||
import { createGraphFrames } from './graphTransform';
|
import { createGraphFrames } from './graphTransform';
|
||||||
@@ -216,13 +216,11 @@ function getSpanTags(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (span.kind !== undefined) {
|
||||||
span.kind !== undefined &&
|
const split = span.kind.toString().toLowerCase().split('_');
|
||||||
span.kind !== collectorTypes.opentelemetryProto.trace.v1.Span.SpanKind.SPAN_KIND_INTERNAL
|
|
||||||
) {
|
|
||||||
spanTags.push({
|
spanTags.push({
|
||||||
key: 'span.kind',
|
key: 'span.kind',
|
||||||
value: SpanKind[collectorTypes.opentelemetryProto.trace.v1.Span.SpanKind[span.kind] as any].toLowerCase(),
|
value: split.length ? split[split.length - 1] : span.kind.toString(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2000,7 +2000,7 @@ export const otlpDataFrameFromResponse = new MutableDataFrame({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'span.kind',
|
key: 'span.kind',
|
||||||
value: 'producer',
|
value: 'client',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user