parent
407ff7bff2
commit
a4a4d7ffa8
|
|
@ -87,6 +87,16 @@ namespace OpenTelemetry.Exporter.Zipkin.Implementation
|
|||
new KeyValuePair<string, object>(
|
||||
SpanAttributeConstants.StatusCodeKey,
|
||||
StatusHelper.GetTagValueForStatusCode(tagState.StatusCode.Value)));
|
||||
|
||||
// Error flag rule from https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/zipkin.md#status
|
||||
if (tagState.StatusCode == StatusCode.Error)
|
||||
{
|
||||
PooledList<KeyValuePair<string, object>>.Add(
|
||||
ref tagState.Tags,
|
||||
new KeyValuePair<string, object>(
|
||||
ZipkinErrorFlagTagName,
|
||||
tagState.StatusDescription ?? string.Empty));
|
||||
}
|
||||
}
|
||||
|
||||
var activitySource = activity.Source;
|
||||
|
|
@ -114,16 +124,6 @@ namespace OpenTelemetry.Exporter.Zipkin.Implementation
|
|||
}
|
||||
}
|
||||
|
||||
if (activity.Status == ActivityStatusCode.Unset && tagState.StatusCode.HasValue && tagState.StatusCode == StatusCode.Error)
|
||||
{
|
||||
// Error flag rule from https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/
|
||||
PooledList<KeyValuePair<string, object>>.Add(
|
||||
ref tagState.Tags,
|
||||
new KeyValuePair<string, object>(
|
||||
ZipkinErrorFlagTagName,
|
||||
tagState.StatusDescription ?? string.Empty));
|
||||
}
|
||||
|
||||
EventEnumerationState eventState = default;
|
||||
activity.EnumerateEvents(ref eventState);
|
||||
|
||||
|
|
|
|||
|
|
@ -351,14 +351,14 @@ namespace OpenTelemetry.Exporter.Zipkin.Tests
|
|||
break;
|
||||
case StatusCode.Error:
|
||||
statusTag = $@"""{SpanAttributeConstants.StatusCodeKey}"":""ERROR"",";
|
||||
errorTag = $@",""{ZipkinActivityConversionExtensions.ZipkinErrorFlagTagName}"":""{statusDescription}""";
|
||||
errorTag = $@"""{ZipkinActivityConversionExtensions.ZipkinErrorFlagTagName}"":""{statusDescription}"",";
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
Assert.Equal(
|
||||
$@"[{{""traceId"":""{traceId}"",""name"":""Name"",{parentId}""id"":""{ZipkinActivityConversionExtensions.EncodeSpanId(context.SpanId)}"",""kind"":""CLIENT"",""timestamp"":{timestamp},""duration"":60000000,""localEndpoint"":{{""serviceName"":""{serviceName}""{ipInformation}}},""remoteEndpoint"":{{""serviceName"":""http://localhost:44312/""}},""annotations"":[{{""timestamp"":{eventTimestamp},""value"":""Event1""}},{{""timestamp"":{eventTimestamp},""value"":""Event2""}}],""tags"":{{{resourceTags}""stringKey"":""value"",""longKey"":""1"",""longKey2"":""1"",""doubleKey"":""1"",""doubleKey2"":""1"",""longArrayKey"":""1,2"",""boolKey"":""true"",""boolArrayKey"":""true,false"",""http.host"":""http://localhost:44312/"",{statusTag}""otel.library.name"":""CreateTestActivity"",""peer.service"":""http://localhost:44312/""{errorTag}}}}}]",
|
||||
$@"[{{""traceId"":""{traceId}"",""name"":""Name"",{parentId}""id"":""{ZipkinActivityConversionExtensions.EncodeSpanId(context.SpanId)}"",""kind"":""CLIENT"",""timestamp"":{timestamp},""duration"":60000000,""localEndpoint"":{{""serviceName"":""{serviceName}""{ipInformation}}},""remoteEndpoint"":{{""serviceName"":""http://localhost:44312/""}},""annotations"":[{{""timestamp"":{eventTimestamp},""value"":""Event1""}},{{""timestamp"":{eventTimestamp},""value"":""Event2""}}],""tags"":{{{resourceTags}""stringKey"":""value"",""longKey"":""1"",""longKey2"":""1"",""doubleKey"":""1"",""doubleKey2"":""1"",""longArrayKey"":""1,2"",""boolKey"":""true"",""boolArrayKey"":""true,false"",""http.host"":""http://localhost:44312/"",{statusTag}{errorTag}""otel.library.name"":""CreateTestActivity"",""peer.service"":""http://localhost:44312/""}}}}]",
|
||||
Responses[requestId]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue