Enable handling of non-string attributes in Zipkin tests
This commit is contained in:
parent
891051c9dd
commit
c88120dc58
|
|
@ -59,7 +59,9 @@ namespace OpenTelemetry.Exporter.Zipkin.Tests.Implementation
|
|||
public void ZipkinSpanConverterTest_GenerateActivity_RemoteEndpointResolutionPriority(RemoteEndpointPriorityTestCase testCase)
|
||||
{
|
||||
// Arrange
|
||||
var activity = ZipkinExporterTests.CreateTestActivity(additionalAttributes: testCase.RemoteEndpointAttributes);
|
||||
var activity = ZipkinExporterTests.CreateTestActivity(
|
||||
additionalAttributes: testCase.RemoteEndpointAttributes,
|
||||
convertAttributeValuesToString: false);
|
||||
|
||||
// Act & Assert
|
||||
var zipkinSpan = ZipkinActivityConversionExtensions.ToZipkinSpan(activity, DefaultZipkinEndpoint);
|
||||
|
|
|
|||
|
|
@ -177,6 +177,7 @@ namespace OpenTelemetry.Exporter.Zipkin.Tests
|
|||
internal static Activity CreateTestActivity(
|
||||
bool setAttributes = true,
|
||||
Dictionary<string, object> additionalAttributes = null,
|
||||
bool convertAttributeValuesToString = true,
|
||||
bool addEvents = true,
|
||||
bool addLinks = true,
|
||||
Resource resource = null,
|
||||
|
|
@ -228,9 +229,14 @@ namespace OpenTelemetry.Exporter.Zipkin.Tests
|
|||
|
||||
var activitySource = new ActivitySource(nameof(CreateTestActivity));
|
||||
|
||||
var tags = setAttributes ?
|
||||
attributes.Select(kvp => new KeyValuePair<string, object>(kvp.Key, kvp.Value.ToString()))
|
||||
: null;
|
||||
IEnumerable<KeyValuePair<string, object>> tags = null;
|
||||
if (setAttributes)
|
||||
{
|
||||
tags = convertAttributeValuesToString
|
||||
? attributes.Select(kvp => new KeyValuePair<string, object>(kvp.Key, kvp.Value.ToString()))
|
||||
: attributes.Select(kvp => new KeyValuePair<string, object>(kvp.Key, kvp.Value));
|
||||
}
|
||||
|
||||
var links = addLinks ?
|
||||
new[]
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue