Skip to content

Commit 799d8a4

Browse files
Prepare 2.24.1 hotfix release (#3836)
* Stop extracting SourceLink after 100 tries (cherry picked from commit 2c86360) * on the hotfix branch, change the master commit --------- Co-authored-by: Pierre Bonet <[email protected]>
1 parent a38263c commit 799d8a4

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

.azure-pipelines/ultimate-pipeline.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ stages:
179179
- checkout: none
180180
- bash: |
181181
rm -rf ./s
182-
git clone --quiet --no-checkout --depth 1 --branch master $BUILD_REPOSITORY_URI ./s
182+
git clone --quiet --no-checkout --depth 1 --branch hotfix/2.24.0 $BUILD_REPOSITORY_URI ./s
183183
cd s
184-
MASTER_SHA=$(git rev-parse origin/master)
184+
MASTER_SHA=$(git rev-parse origin/hotfix/2.24.0)
185185
rm -rf ./s
186186
echo "Using master commit ID $MASTER_SHA"
187187
echo "##vso[task.setvariable variable=master;isOutput=true]$MASTER_SHA"
@@ -4673,4 +4673,4 @@ stages:
46734673
-H "Content-Type: application/json" \
46744674
-d '{"commit": "'$sha'"}' \
46754675
$(slackWebhookUrl)
4676-
displayName: "notify"
4676+
displayName: "notify"

tracer/src/Datadog.Trace/Configuration/GitMetadataTagsProvider.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
using System;
77
using System.Diagnostics.CodeAnalysis;
8+
using System.Threading;
89
using Datadog.Trace.Logging;
910
using Datadog.Trace.Pdb;
1011

@@ -16,6 +17,7 @@ internal class GitMetadataTagsProvider : IGitMetadataTagsProvider
1617
{
1718
private readonly ImmutableTracerSettings _immutableTracerSettings;
1819
private GitMetadata? _cachedGitTags = null;
20+
private int _tryCount = 0;
1921

2022
public GitMetadataTagsProvider(ImmutableTracerSettings immutableTracerSettings)
2123
{
@@ -91,9 +93,20 @@ private bool TryGetGitTagsFromSourceLink([NotNullWhen(true)] out GitMetadata? re
9193
{
9294
// Cannot determine the entry assembly. This may mean this method was called too early.
9395
// Return false to indicate that we should try again later.
94-
Log.Debug("Cannot extract SourceLink information as the entry assembly could not be determined.");
95-
result = default;
96-
return false;
96+
97+
var nbTries = Interlocked.Increment(ref _tryCount);
98+
if (nbTries > 100)
99+
{
100+
Log.Debug("Tried 100 times to get the SourceLink information. Giving up.");
101+
result = GitMetadata.Empty;
102+
return true;
103+
}
104+
else
105+
{
106+
Log.Debug("Cannot extract SourceLink information as the entry assembly could not be determined.");
107+
result = default;
108+
return false;
109+
}
97110
}
98111

99112
if (SourceLinkInformationExtractor.TryGetSourceLinkInfo(assembly, out var commitSha, out var repositoryUrl))

0 commit comments

Comments
 (0)