Skip to content
Merged
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 @@ -30,6 +30,12 @@ public void RecordTracerSettings(
Interlocked.Exchange(ref _gitMetadata, gitMetadata);
}

string? processTags = null;
if (tracerSettings.PropagateProcessTags && !string.IsNullOrEmpty(ProcessTags.SerializedTags))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get your filthy static global state out of my lovely testable code 😂 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will, later :p

{
processTags = ProcessTags.SerializedTags;
}

var frameworkDescription = FrameworkDescription.Instance;
var application = new ApplicationTelemetryData(
serviceName: defaultServiceName,
Expand All @@ -41,7 +47,8 @@ public void RecordTracerSettings(
runtimeName: frameworkDescription.Name,
runtimeVersion: frameworkDescription.ProductVersion,
commitSha: gitMetadata?.CommitSha,
repositoryUrl: gitMetadata?.RepositoryUrl);
repositoryUrl: gitMetadata?.RepositoryUrl,
processTags: processTags);

Interlocked.Exchange(ref _applicationData, application);

Expand Down Expand Up @@ -95,7 +102,8 @@ public void RecordGitMetadata(GitMetadata gitMetadata)
runtimeName: original.RuntimeName,
runtimeVersion: original.RuntimeVersion,
commitSha: gitMetadata.CommitSha,
repositoryUrl: gitMetadata.RepositoryUrl);
repositoryUrl: gitMetadata.RepositoryUrl,
processTags: original.ProcessTags);

var updated = Interlocked.Exchange(ref _applicationData, application);
if (updated == original)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Datadog.Trace.Telemetry;

internal class ApplicationTelemetryData
{
public ApplicationTelemetryData(string serviceName, string env, string serviceVersion, string tracerVersion, string languageName, string languageVersion, string runtimeName, string runtimeVersion, string? commitSha, string? repositoryUrl)
public ApplicationTelemetryData(string serviceName, string env, string serviceVersion, string tracerVersion, string languageName, string languageVersion, string runtimeName, string runtimeVersion, string? commitSha, string? repositoryUrl, string? processTags)
{
ServiceName = serviceName;
Env = env;
Expand All @@ -21,6 +21,7 @@ public ApplicationTelemetryData(string serviceName, string env, string serviceVe
RuntimeVersion = runtimeVersion;
CommitSha = commitSha;
RepositoryUrl = repositoryUrl;
ProcessTags = processTags;
}

public string ServiceName { get; set; }
Expand All @@ -44,4 +45,6 @@ public ApplicationTelemetryData(string serviceName, string env, string serviceVe
public string? CommitSha { get; set; }

public string? RepositoryUrl { get; set; }

public string? ProcessTags { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public TelemetryHelperTests(ITestOutputHelper output)
runtimeName: "dotnet",
runtimeVersion: "7.0.1",
commitSha: "testCommitSha",
repositoryUrl: "testRepositoryUrl");
repositoryUrl: "testRepositoryUrl",
processTags: "entrypoint.basedir:Users,entrypoint.workdir:Downloads");
_host = new HostTelemetryData("MY_HOST", "Windows", "x64");
_output = output;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ private static TelemetryData GetSampleData() =>
runtimeName: "dotnet",
runtimeVersion: "7.0.3",
commitSha: "aaaaaaaaaaaaaaaaaa",
repositoryUrl: "https://github.com/myOrg/myRepo"),
repositoryUrl: "https://github.com/myOrg/myRepo",
processTags: "entrypoint.basedir:Users,entrypoint.workdir:Downloads"),
host: new HostTelemetryData("SOME_HOST", "Windows", "x64"),
payload: null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public TelemetryDataBuilderTests()
runtimeName: FrameworkDescription.Instance.Name,
runtimeVersion: FrameworkDescription.Instance.ProductVersion,
commitSha: "testCommitSha",
repositoryUrl: "testRepositoryUrl");
repositoryUrl: "testRepositoryUrl",
processTags: "entrypoint.basedir:Users,entrypoint.workdir:Downloads");
_host = new HostTelemetryData("MY_MACHINE", "Windows", "arm64");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public void SerializedAppStartedShouldProduceJsonWithExpectedFormat()
runtimeName: "dotnet",
runtimeVersion: "7.0.3",
commitSha: "testCommitSha",
repositoryUrl: "testRepositoryUrl"),
repositoryUrl: "testRepositoryUrl",
processTags: "entrypoint.basedir:Users,entrypoint.workdir:Downloads"),
host: new HostTelemetryData(
hostname: "i-09ecf74c319c49be8",
os: "GNU/Linux",
Expand Down Expand Up @@ -100,7 +101,8 @@ public void SerializedMetricsTelemetryShouldProduceJsonWithExpectedFormat()
runtimeName: "dotnet",
runtimeVersion: "7.0.3",
commitSha: "testCommitSha",
repositoryUrl: "testRepositoryUrl"),
repositoryUrl: "testRepositoryUrl",
processTags: "entrypoint.basedir:Users,entrypoint.workdir:Downloads"),
host: new HostTelemetryData(
hostname: "i-09ecf74c319c49be8",
os: "GNU/Linux",
Expand Down Expand Up @@ -171,7 +173,8 @@ public void SerializedDistributionMetricsTelemetryShouldProduceJsonWithExpectedF
runtimeName: "dotnet",
runtimeVersion: "7.0.3",
commitSha: "testCommitSha",
repositoryUrl: "testRepositoryUrl"),
repositoryUrl: "testRepositoryUrl",
processTags: "entrypoint.basedir:Users,entrypoint.workdir:Downloads"),
host: new HostTelemetryData(
hostname: "i-09ecf74c319c49be8",
os: "GNU/Linux",
Expand Down Expand Up @@ -237,7 +240,8 @@ public void SerializedMessageBatchShouldProduceJsonWithExpectedFormat()
runtimeName: "dotnet",
runtimeVersion: "7.0.3",
commitSha: "testCommitSha",
repositoryUrl: "testRepositoryUrl"),
repositoryUrl: "testRepositoryUrl",
processTags: "entrypoint.basedir:Users,entrypoint.workdir:Downloads"),
host: new HostTelemetryData(
hostname: "i-09ecf74c319c49be8",
os: "GNU/Linux",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"runtime_name": "dotnet",
"runtime_version": "7.0.3",
"commit_sha": "testCommitSha",
"repository_url": "testRepositoryUrl"
"repository_url": "testRepositoryUrl",
"process_tags": "entrypoint.basedir:Users,entrypoint.workdir:Downloads"
},
"host": {
"hostname": "i-09ecf74c319c49be8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"runtime_name": "dotnet",
"runtime_version": "7.0.3",
"commit_sha": "testCommitSha",
"repository_url": "testRepositoryUrl"
"repository_url": "testRepositoryUrl",
"process_tags": "entrypoint.basedir:Users,entrypoint.workdir:Downloads"
},
"host": {
"hostname": "i-09ecf74c319c49be8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"runtime_name": "dotnet",
"runtime_version": "7.0.3",
"commit_sha": "testCommitSha",
"repository_url": "testRepositoryUrl"
"repository_url": "testRepositoryUrl",
"process_tags": "entrypoint.basedir:Users,entrypoint.workdir:Downloads"
},
"host": {
"hostname": "i-09ecf74c319c49be8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"runtime_name": "dotnet",
"runtime_version": "7.0.3",
"commit_sha": "testCommitSha",
"repository_url": "testRepositoryUrl"
"repository_url": "testRepositoryUrl",
"process_tags": "entrypoint.basedir:Users,entrypoint.workdir:Downloads"
},
"host": {
"hostname": "i-09ecf74c319c49be8",
Expand Down
Loading