Skip to content

Commit 313bd46

Browse files
committed
Decorate methods that shouldn't be invoked with [InternalForTesting]
1 parent 672f51a commit 313bd46

File tree

10 files changed

+17
-11
lines changed

10 files changed

+17
-11
lines changed

tracer/src/Datadog.Trace/Configuration/ConfigurationSources/NameValueConfigurationSource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal class NameValueConfigurationSource : StringConfigurationSource
2121
{
2222
private readonly NameValueCollection _nameValueCollection;
2323

24-
// Internal for testing only
24+
[InternalForTesting]
2525
public NameValueConfigurationSource(NameValueCollection nameValueCollection)
2626
: this(nameValueCollection, ConfigurationOrigins.Code)
2727
{

tracer/src/Datadog.Trace/Configuration/ConfigurationSources/Telemetry/ConfigurationTelemetry.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public void Record(string key, int? value, ConfigurationOrigins origin, Telemetr
7171

7272
public class ConfigurationTelemetryEntry
7373
{
74-
// internal for testing
7574
private ConfigurationTelemetryEntry(string key, ConfigurationOrigins origin, ConfigurationTelemetryEntryType type, TelemetryErrorCode? error, string? stringValue = null, bool? boolValue = null, int? intValue = null, double? doubleValue = null)
7675
{
7776
Key = key;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ public partial class ExporterSettings
4848
internal const string DefaultMetricsUnixDomainSocket = "/var/run/datadog/dsd.socket";
4949
internal const string UdpPrefix = "udp://";
5050

51-
// Internal for testing only
51+
[InternalForTesting]
5252
internal ExporterSettings()
5353
: this(source: null, new ConfigurationTelemetry())
5454
{
5555
}
5656

57-
// Internal for testing only
57+
[InternalForTesting]
5858
internal ExporterSettings(IConfigurationSource? source)
5959
: this(source, File.Exists, new ConfigurationTelemetry())
6060
{
@@ -205,7 +205,7 @@ internal ExporterSettings(Raw rawSettings, Func<string, bool> fileExists, IConfi
205205

206206
internal Raw RawSettings { get; }
207207

208-
// internal for testing
208+
[InternalForTesting]
209209
internal static ExporterSettings Create(Dictionary<string, object?> settings)
210210
=> new(new DictionaryConfigurationSource(settings.ToDictionary(x => x.Key, x => x.Value?.ToString()!)), new ConfigurationTelemetry());
211211

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ public record TracerSettings
3838
private readonly IConfigurationTelemetry _telemetry;
3939
private readonly Lazy<string> _fallbackApplicationName;
4040

41-
// Internal for testing
41+
[InternalForTesting]
4242
internal TracerSettings()
4343
: this(null, new ConfigurationTelemetry(), new OverrideErrorLog())
4444
{
4545
}
4646

47-
// Internal for testing
47+
[InternalForTesting]
4848
internal TracerSettings(IConfigurationSource? source)
4949
: this(source, new ConfigurationTelemetry(), new OverrideErrorLog())
5050
{

tracer/src/Datadog.Trace/ContinuousProfiler/ProfilerAvailabilityHelper.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#nullable enable
77

88
using System;
9+
using Datadog.Trace.SourceGenerators;
910
using Datadog.Trace.Util;
1011

1112
namespace Datadog.Trace.ContinuousProfiler;
@@ -25,7 +26,7 @@ internal static class ProfilerAvailabilityHelper
2526
/// </summary>
2627
public static bool IsContinuousProfilerAvailable => ProfilerIsAvailable.Value;
2728

28-
// Internal for testing
29+
[InternalForTesting]
2930
internal static bool IsContinuousProfilerAvailable_TestingOnly(Func<bool> isClrProfilerAttached)
3031
=> GetIsContinuousProfilerAvailable(isClrProfilerAttached);
3132

tracer/src/Datadog.Trace/ContinuousProfiler/ProfilerSettings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Datadog.Trace.Configuration;
99
using Datadog.Trace.Configuration.ConfigurationSources.Telemetry;
1010
using Datadog.Trace.Configuration.Telemetry;
11+
using Datadog.Trace.SourceGenerators;
1112

1213
namespace Datadog.Trace.ContinuousProfiler;
1314

@@ -68,7 +69,7 @@ _ when x.ToBoolean() is { } boolean => boolean ? "true" : "false",
6869
};
6970
}
7071

71-
// Internal for testing only
72+
[InternalForTesting]
7273
internal ProfilerSettings(ProfilerState state)
7374
{
7475
ProfilerState = state;

tracer/src/Datadog.Trace/SpanContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ public partial class SpanContext : ISpanContext, IReadOnlyDictionary<string, str
6363
/// Initializes a new instance of the <see cref="SpanContext"/> class
6464
/// from a propagated context. <see cref="Parent"/> will be null
6565
/// since this is a root context locally.
66-
/// Internal for testing
6766
/// </summary>
6867
/// <param name="traceId">The propagated trace id.</param>
6968
/// <param name="spanId">The propagated span id.</param>
7069
/// <param name="samplingPriority">The propagated sampling priority.</param>
7170
/// <param name="serviceName">The service name to propagate to child spans.</param>
71+
[InternalForTesting]
7272
public SpanContext(ulong? traceId, ulong spanId, SamplingPriority? samplingPriority = null, string serviceName = null)
7373
: this((TraceId)(traceId ?? 0), serviceName)
7474
{

tracer/src/Datadog.Trace/TracerManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
using Datadog.Trace.RemoteConfigurationManagement;
2929
using Datadog.Trace.RuntimeMetrics;
3030
using Datadog.Trace.Sampling;
31+
using Datadog.Trace.SourceGenerators;
3132
using Datadog.Trace.Telemetry;
3233
using Datadog.Trace.Util.Http;
3334
using Datadog.Trace.Vendors.Newtonsoft.Json;
@@ -225,6 +226,7 @@ internal void Start()
225226
/// Run all the shutdown tasks for a standalone <see cref="TracerManager"/> instance,
226227
/// stopping the background processes.
227228
/// </summary>
229+
[InternalForTesting]
228230
internal Task ShutdownAsync() => RunShutdownTasksAsync(this, null);
229231

230232
private static async Task CleanUpOldTracerManager(TracerManager oldManager, TracerManager newManager)

tracer/src/Datadog.Trace/Util/BoundedConcurrentQueue.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using System.Collections.Concurrent;
2323
using System.Diagnostics.CodeAnalysis;
2424
using System.Threading;
25+
using Datadog.Trace.SourceGenerators;
2526

2627
namespace Datadog.Trace.Util
2728
{
@@ -42,7 +43,7 @@ public BoundedConcurrentQueue(int queueLimit)
4243
_queueLimit = queueLimit;
4344
}
4445

45-
// Internal for testing
46+
[InternalForTesting]
4647
internal ConcurrentQueue<T> InnerQueue => _queue;
4748

4849
public int Count => _counter;

tracer/src/Datadog.Trace/Util/ProcessHelpers.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using System.Threading;
1515
using System.Threading.Tasks;
1616
using Datadog.Trace.Logging;
17+
using Datadog.Trace.SourceGenerators;
1718

1819
namespace Datadog.Trace.Util
1920
{
@@ -196,6 +197,7 @@ internal static IEnumerable<string> ParseWhereisOutput(string output)
196197
/// <summary>
197198
/// Internal for testing to make it easier to call using reflection from a sample app
198199
/// </summary>
200+
[InternalForTesting]
199201
internal static void TestingOnly_RunCommand(string cmd, string? args)
200202
{
201203
RunCommand(new Command(cmd, args));

0 commit comments

Comments
 (0)