Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -576,21 +576,17 @@ private int WriteTags(ref byte[] bytes, int offset, in SpanModel model, ITagProc
offset += MessagePackBinary.WriteStringBytes(ref bytes, offset, _languageNameBytes);
offset += MessagePackBinary.WriteStringBytes(ref bytes, offset, _languageValueBytes);

// add "version" tags to all spans whose service name is the default service name
var serviceNameEqualsDefault = string.Equals(span.Context.ServiceName, model.TraceChunk.DefaultServiceName, StringComparison.OrdinalIgnoreCase);
if (serviceNameEqualsDefault)
// add "version" tags to all spans
var versionRawBytes = MessagePackStringCache.GetVersionBytes(model.TraceChunk.ServiceVersion);
if (versionRawBytes is not null)
{
var versionRawBytes = MessagePackStringCache.GetVersionBytes(model.TraceChunk.ServiceVersion);

if (versionRawBytes is not null)
{
count++;
offset += MessagePackBinary.WriteStringBytes(ref bytes, offset, _versionNameBytes);
offset += MessagePackBinary.WriteRaw(ref bytes, offset, versionRawBytes);
}
count++;
offset += MessagePackBinary.WriteStringBytes(ref bytes, offset, _versionNameBytes);
offset += MessagePackBinary.WriteRaw(ref bytes, offset, versionRawBytes);
}

// add _dd.base_service tag to spans where the service name has been overrideen
// add _dd.base_service tag to spans where the service name has been overriden
var serviceNameEqualsDefault = string.Equals(span.Context.ServiceName, model.TraceChunk.DefaultServiceName, StringComparison.OrdinalIgnoreCase);
if (!serviceNameEqualsDefault && !string.IsNullOrEmpty(model.TraceChunk.DefaultServiceName))
{
var serviceNameRawBytes = MessagePackStringCache.GetServiceBytes(model.TraceChunk.DefaultServiceName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,26 +262,18 @@ private int WriteTags(ref byte[] bytes, int offset, Span span, ITags tags, ITagP
offset += MessagePackBinary.WriteString(ref bytes, offset, env);
}

// add "language=dotnet" tag to all spans, except those that
// represents a downstream service or external dependency
if (span.Tags is not InstrumentationTags { SpanKind: SpanKinds.Client or SpanKinds.Producer })
{
count++;
offset += MessagePackBinary.WriteStringBytes(ref bytes, offset, _languageNameBytes);
offset += MessagePackBinary.WriteStringBytes(ref bytes, offset, _languageValueBytes);
}
// add "language=dotnet" tag to all spans
count++;
offset += MessagePackBinary.WriteStringBytes(ref bytes, offset, _languageNameBytes);
offset += MessagePackBinary.WriteStringBytes(ref bytes, offset, _languageValueBytes);

// add "version" tags to all spans whose service name is the default service name
if (string.Equals(span.Context.ServiceName, traceContext?.Tracer.DefaultServiceName, StringComparison.OrdinalIgnoreCase))
// add "version" tags to all spans
var version = traceContext?.ServiceVersion;
if (!string.IsNullOrWhiteSpace(version))
{
var version = traceContext?.ServiceVersion;

if (!string.IsNullOrWhiteSpace(version))
{
count++;
offset += MessagePackBinary.WriteStringBytes(ref bytes, offset, _versionNameBytes);
offset += MessagePackBinary.WriteString(ref bytes, offset, version);
}
count++;
offset += MessagePackBinary.WriteStringBytes(ref bytes, offset, _versionNameBytes);
offset += MessagePackBinary.WriteString(ref bytes, offset, version);
}

if (count > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public async Task RenamesService()
Assert.Equal(expectedServiceName, span.Service);
Assert.Equal(SpanTypes.Http, span.Type);
Assert.Matches("WebRequest|HttpMessageHandler", span.Tags[Tags.InstrumentationName]);
Assert.False(span.Tags?.ContainsKey(Tags.Version), "External service span should not have service version tag.");
}

VerifyInstrumentation(processResult.Process);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ public void ValidateIntegrationSpans(IEnumerable<MockSpan> spans, string metadat
Assert.True(result.Success, result.ToString());

Assert.Equal(expectedServiceName, span.Service);
if (isExternalSpan == true)
{
Assert.False(span.Tags?.ContainsKey(Tags.Version), "External service span should not have service version tag.");
}
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions tracer/test/snapshots/AerospikeTests.SchemaV0.verified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -38,6 +39,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -62,6 +64,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -86,6 +89,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -112,6 +116,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -138,6 +143,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -164,6 +170,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -190,6 +197,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -215,6 +223,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -241,6 +250,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -267,6 +277,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -293,6 +304,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -319,6 +331,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -345,6 +358,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -371,6 +385,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -397,6 +412,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -423,6 +439,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -449,6 +466,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand All @@ -475,6 +493,7 @@
language: dotnet,
runtime-id: Guid_1,
span.kind: client,
version: 1.0.0,
_dd.base_service: Samples.Aerospike
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: Samples.AspNetCoreMvc31
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ at Samples.AspNetCoreMvc.Controllers.HomeController.ThrowException(),
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: Samples.AspNetCoreMvc31
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ System.Exception: Exception of type 'System.Exception' was thrown.
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: Samples.AspNetCoreMvc31
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: Samples.AspNetCoreMvc31
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: Samples.AspNetCoreMvc31
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ at Samples.AspNetMvc5.Controllers.HomeController.BadRequestWithStatusCode(Int32
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ at Samples.AspNetMvc5.Controllers.HomeController.BadRequestWithStatusCode(Int32
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ at System.Web.Mvc.ActionDescriptor.ExtractParameterFromDictionary(ParameterInfo
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ at Samples.AspNetMvc5.Controllers.HomeController.BadRequest(),
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ at Samples.AspNetMvc5.Controllers.HomeController.BadRequest(),
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
runtime-id: Guid_1,
span.kind: internal,
stage: prod,
version: 1.0.0,
_dd.base_service: sample
},
Metrics: {
Expand Down
Loading
Loading