Skip to content

Commit 864c0b3

Browse files
committed
Stop sending default service info
1 parent 293fd6b commit 864c0b3

File tree

3 files changed

+11
-35
lines changed

3 files changed

+11
-35
lines changed

src/Datadog.Tracer.IntegrationTests/SendTracesToAgent.cs

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,13 @@ public async void MinimalSpan()
5050
span.Finish();
5151

5252
// Check that the HTTP calls went as expected
53-
await _httpRecorder.WaitForCompletion(2);
54-
Assert.Equal(2, _httpRecorder.Requests.Count);
55-
Assert.Equal(2, _httpRecorder.Responses.Count);
53+
await _httpRecorder.WaitForCompletion(1);
54+
Assert.Equal(1, _httpRecorder.Requests.Count);
55+
Assert.Equal(1, _httpRecorder.Responses.Count);
5656
Assert.All(_httpRecorder.Responses, (x) => Assert.Equal(HttpStatusCode.OK, x.StatusCode));
5757

5858
var trace = _httpRecorder.Traces.Single();
5959
AssertSpanEqual(span, trace.Single());
60-
61-
var serviceInfo = _httpRecorder.Services.Single().ServiceInfos().Single();
62-
Assert.Equal("Datadog.Tracer", serviceInfo.ServiceName);
63-
Assert.Equal(Constants.UnkownApp, serviceInfo.App);
64-
Assert.Equal(Constants.WebAppType, serviceInfo.AppType);
6560
}
6661

6762
[Fact]
@@ -81,17 +76,15 @@ public async void CustomServiceName()
8176
span.Finish();
8277

8378
// Check that the HTTP calls went as expected
84-
await _httpRecorder.WaitForCompletion(3);
85-
Assert.Equal(3, _httpRecorder.Requests.Count);
86-
Assert.Equal(3, _httpRecorder.Responses.Count);
79+
await _httpRecorder.WaitForCompletion(2);
80+
Assert.Equal(2, _httpRecorder.Requests.Count);
81+
Assert.Equal(2, _httpRecorder.Responses.Count);
8782
Assert.All(_httpRecorder.Responses, (x) => Assert.Equal(HttpStatusCode.OK, x.StatusCode));
8883

8984
var trace = _httpRecorder.Traces.Single();
9085
AssertSpanEqual(span, trace.Single());
9186

92-
var serviceInfos = _httpRecorder.Services.Select(x => x.ServiceInfos().Single()).ToList();
93-
Assert.Equal(2, serviceInfos.Count);
94-
var serviceInfo = serviceInfos.Single(x => x.ServiceName == ServiceName);
87+
var serviceInfo = _httpRecorder.Services.Select(x => x.ServiceInfos().Single()).Single();
9588
Assert.Equal(ServiceName, serviceInfo.ServiceName);
9689
Assert.Equal(App, serviceInfo.App);
9790
Assert.Equal(AppType, serviceInfo.AppType);
@@ -108,9 +101,9 @@ public async void Utf8Everywhere()
108101
span.Finish();
109102

110103
// Check that the HTTP calls went as expected
111-
await _httpRecorder.WaitForCompletion(2);
112-
Assert.Equal(2, _httpRecorder.Requests.Count);
113-
Assert.Equal(2, _httpRecorder.Responses.Count);
104+
await _httpRecorder.WaitForCompletion(1);
105+
Assert.Equal(1, _httpRecorder.Requests.Count);
106+
Assert.Equal(1, _httpRecorder.Responses.Count);
114107
Assert.All(_httpRecorder.Responses, (x) => Assert.Equal(HttpStatusCode.OK, x.StatusCode));
115108

116109
var trace = _httpRecorder.Traces.Single();

src/Datadog.Tracer.Tests/TracerTests.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ public class TracerTests
1111
{
1212
private Mock<IAgentWriter> _agentWriter = new Mock<IAgentWriter>();
1313

14-
[Fact]
15-
public void Ctor_DefaultValues_ShouldSendDefaultServiceInfo()
16-
{
17-
var tracer = new Tracer(_agentWriter.Object);
18-
_agentWriter.Verify(x => x.WriteServiceInfo(It.Is<ServiceInfo>(y => y.ServiceName == "Datadog.Tracer" && y.AppType == Constants.WebAppType && y.App == Constants.UnkownApp)), Times.Once);
19-
}
20-
2114
[Fact]
2215
public void BuildSpan_NoParameter_DefaultParameters()
2316
{

src/Datadog.Tracer/Tracer.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,7 @@ internal class Tracer : ITracer, IDatadogTracer
1919
public Tracer(IAgentWriter agentWriter, List<ServiceInfo> serviceInfo = null, string defaultServiceName = null)
2020
{
2121
_agentWriter = agentWriter;
22-
_defaultServiceName = defaultServiceName;
23-
if (_defaultServiceName == null)
24-
{
25-
_defaultServiceName = GetExecutingAssemblyName() ?? Constants.UnkownService;
26-
_services[_defaultServiceName] = new ServiceInfo
27-
{
28-
ServiceName = _defaultServiceName,
29-
App = Constants.UnkownApp,
30-
AppType = Constants.WebAppType,
31-
};
32-
}
22+
_defaultServiceName = GetExecutingAssemblyName() ?? Constants.UnkownService;
3323
if (serviceInfo != null)
3424
{
3525
foreach(var service in serviceInfo)

0 commit comments

Comments
 (0)