Skip to content

Commit 2893a40

Browse files
committed
Remove ContainerTagsHash Log.Error on .NET Framework
Instead of guarding the caller with #if !NETFRAMEWORK, make the setter a silent no-op. This avoids conflict with #8061 which replaces the caller entirely.
1 parent 64b2ad9 commit 2893a40

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

tracer/src/Datadog.Trace/Agent/DiscoveryService/DiscoveryService.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,12 @@ internal bool RequireRefresh(string? currentHash, DateTimeOffset utcNow)
306306

307307
private async Task ProcessDiscoveryResponse(IApiResponse response)
308308
{
309-
#if !NETFRAMEWORK
310309
// Extract and store container tags hash from response headers
311310
var containerTagsHash = response.GetHeader(AgentHttpHeaderNames.ContainerTagsHash);
312311
if (containerTagsHash != null)
313312
{
314313
_containerMetadata.ContainerTagsHash = containerTagsHash;
315314
}
316-
#endif
317315

318316
// Grab the original stream
319317
var stream = await response.GetStreamAsync().ConfigureAwait(false);

tracer/src/Datadog.Trace/PlatformHelpers/ContainerMetadata.NetFramework.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55

66
#nullable enable
77

8-
using System.Threading;
9-
using Datadog.Trace.Logging;
10-
118
#if NETFRAMEWORK
129

1310
namespace Datadog.Trace.PlatformHelpers;
@@ -17,9 +14,6 @@ namespace Datadog.Trace.PlatformHelpers;
1714
/// </summary>
1815
internal sealed class ContainerMetadata
1916
{
20-
private static readonly IDatadogLogger Log = DatadogLogging.GetLoggerFor(typeof(ContainerMetadata));
21-
private static bool _warnedOnSet; // to log only once
22-
2317
public static readonly ContainerMetadata Instance = new();
2418

2519
private ContainerMetadata()
@@ -36,14 +30,7 @@ public ContainerMetadata(string containerId, string entityId)
3630
public string? ContainerTagsHash
3731
{
3832
get => null;
39-
set
40-
{
41-
if (!_warnedOnSet)
42-
{
43-
_warnedOnSet = true;
44-
Log.Error("The code is trying to set the value '{Value}' to {Prop}, but this has no effect in .NET Framework.", value, nameof(ContainerTagsHash));
45-
}
46-
}
33+
set { }
4734
}
4835

4936
/// <summary>

0 commit comments

Comments
 (0)