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:
Connor Lindsey 2022-01-04 07:25:14 -07:00 committed by GitHub
parent c4c05a5b71
commit dc92cee874
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -10,7 +10,7 @@ import {
TraceLog,
TraceSpanRow,
} from '@grafana/data';
import { SpanKind, SpanStatus, SpanStatusCode } from '@opentelemetry/api';
import { SpanStatus, SpanStatusCode } from '@opentelemetry/api';
import { collectorTypes } from '@opentelemetry/exporter-collector';
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
import { createGraphFrames } from './graphTransform';
@ -216,13 +216,11 @@ function getSpanTags(
}
}
if (
span.kind !== undefined &&
span.kind !== collectorTypes.opentelemetryProto.trace.v1.Span.SpanKind.SPAN_KIND_INTERNAL
) {
if (span.kind !== undefined) {
const split = span.kind.toString().toLowerCase().split('_');
spanTags.push({
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(),
});
}

View File

@ -2000,7 +2000,7 @@ export const otlpDataFrameFromResponse = new MutableDataFrame({
},
{
key: 'span.kind',
value: 'producer',
value: 'client',
},
],
],