Skip to content

Commit

Permalink
[Tracer] Fix git metadata retrieval (#6444)
Browse files Browse the repository at this point in the history
  • Loading branch information
gleocadie authored Dec 16, 2024
1 parent 7544783 commit 4288ae4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tracer/src/Datadog.Trace/Configuration/TracerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ _ when x.ToBoolean() is { } boolean => boolean,
.AsString();

// DD_GIT_REPOSITORY_URL has precedence over DD_TAGS
GitRepositoryUrl = GetExplicitSettingOrTag(GitRepositoryUrl, globalTags, Ci.Tags.CommonTags.GitCommit, ConfigurationKeys.GitRepositoryUrl);
GitRepositoryUrl = GetExplicitSettingOrTag(GitRepositoryUrl, globalTags, Ci.Tags.CommonTags.GitRepository, ConfigurationKeys.GitRepositoryUrl);

GitMetadataEnabled = config
.WithKeys(ConfigurationKeys.GitMetadataEnabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1275,14 +1275,16 @@ public void DDTagsSetsServiceInformation()
{
var source = new NameValueConfigurationSource(new()
{
{ "DD_TAGS", "env:datadog_env,service:datadog_service,version:datadog_version" },
{ "DD_TAGS", "env:datadog_env,service:datadog_service,version:datadog_version,git.repository_url:https://Myrepository,git.commit.sha:42" },
});

var tracerSettings = new TracerSettings(source);

tracerSettings.Environment.Should().Be("datadog_env");
tracerSettings.ServiceVersion.Should().Be("datadog_version");
tracerSettings.ServiceName.Should().Be("datadog_service");
tracerSettings.GitRepositoryUrl.Should().Be("https://Myrepository");
tracerSettings.GitCommitSha.Should().Be("42");
}

[Fact]
Expand Down

0 comments on commit 4288ae4

Please sign in to comment.