Skip to content

Review learning: rule changes from 2026-10-24 to 2026-11-22 - #9780

Closed
dd-apm-ecosystems[bot] wants to merge 4 commits into
masterfrom
review-learning/run-dd-trace-dotnet-2026-10-24-ce98aba5
Closed

dd-apm-ecosystems[bot] wants to merge 4 commits into
masterfrom
review-learning/run-dd-trace-dotnet-2026-10-24-ce98aba5

Conversation

@dd-apm-ecosystems

Copy link
Copy Markdown

Note

Monthly review learning. 8 changes to the code review rules, learned from the 186 PRs merged from 2026-10-24 to 2026-11-22.
Review them in Files changed, and answer on each rule: ok, discard, a suggestion, or a comment. Once a day, a workflow applies the answers and replies.

Merged PRs With human review Fixes linked to their cause Verified lessons Proposals Changes in this PR
186 169 35 102 66 8

🆕 New rules (6)

Rules that the review does not have yet. Open the last cell of a row for what it does, why, a bad and a good example, and the evidence.

RuleLensChangeEvidenceWhy, and examples
CONV-3.9 Codebase-Conventions new rule: Inject test seams through one interface, not delegates or several time parameters #9568 · #9697
Two PRs added delegate or multi-parameter time seams for tests.

What it does: delegate properties, extra Stopwatch instances, or several separate time-related parameters that exist only as test seams. If a class needs a seam, pass one generic struct parameter that implements an interface.

Why is this bad? Two PRs added delegate or multi-parameter time seams for tests. Reviewers asked for one abstraction, and the repo prefers a generic struct that implements an interface.

Example

            /// </summary>
            public Func<Task<bool>> CheckHealthAsync { get; set; }

            /// <summary>
            /// Gets or sets how the keep-alive waits, in milliseconds. It is <see cref="Task.Delay(int)"/>, and tests replace it
            /// to record the waits instead of sleeping.
            /// </summary>
            public Func<int, Task> DelayAsync { get; set; } = milliseconds => Task.Delay(milliseconds);

Evidence:

  • #9568 correction: "Using delegates for this add a few additional heap allocations and a bit of overhead for the delegate invocation"
  • #9697 correction: "Do you really need a stopwatch and an elapsedProvider, and a waitForRetry?"
CONV-4.9 Codebase-Conventions new rule: Put tests that change process-wide state in a non-parallel collection #9479 · #9529
In two PRs, tests changed process-wide statics without a non-parallel xUnit collection, so they could race.

What it does: a test that replaces Tracer.Instance, sets Baggage.Current, or changes other static state. Flag it when its class is not in a non-parallel collection such as TracerInstanceTestCollection. A restorer attribute alone is not enough.

Why is this bad? In two PRs, tests changed process-wide statics without a non-parallel xUnit collection, so they could race. COR-6.1 does not cover the collection requirement.

Example

        [InlineData("my-container-app", "aca.")]
        public async Task OnIsolatedFunctionBegin_TagPrefixFollowsContainerAppsDetection(string? containerAppName, string prefix)
        {
            var collection = new NameValueCollection { { PlatformKeys.AzureAppService.ContainerAppName, containerAppName } };
            var settings = new TracerSettings(new NameValueConfigurationSource(collection));

            await using var tracer = TracerHelper.CreateWithFakeAgent(settings);
            Tracer.UnsafeSetTracerInstance(tracer);

Evidence:

  • #9479 correction: "this test publishes its tracer process-wide, but the class is not in a nonparallel collection"
  • #9529 correction: "Adding this attribute alone isn't sufficient - you'll have to put it (and any tests that use it) in a collection to disable parallel execution too."
COR-2.6 Correctness new rule: Claim a file or port atomically instead of checking that it is free first #9636 · #9652
Two PRs show the same check-then-use race on files and ports.

What it does: File.Exists followed by a create or open of the same path. Also flag TcpPortProvider.GetOpenPort() followed by a later Start(). A concurrent process can claim the resource between the two calls.

Why is this bad? Two PRs show the same check-then-use race on files and ports. No rule names it.

Example

            CustomEnvironmentVariables[EnvironmentVariables.ProfilingPprofDir] = Path.Combine(baseOutputDir, "pprofs");
        }

        private string GetLoaderConfigFilePath()

Use instead

new FileStream(path, FileMode.CreateNew), then retry with a new path on IOException.

Evidence:

  • #9636 correction: "The new File.Exists()-then-open sequence allows concurrent launches to select the same loader.conf path."
  • #9652 correction: "I assume this isn't the only place that uses HttpListener like this - can we update everywhere that uses it in the same way?"
COR-5.5 Correctness new rule: Check what a URL or path already contains before adding a separator or segment #8861 · #9505 · #9642
Three PRs built URLs or paths without checking the existing value, which doubled separators or segments or altered queries.

What it does: code that always adds /, ? or a suffix such as v1/<signal> to a configured URL or path. Also flag a trim, such as TrimStart('?'), that removes characters the user value needs. These produce //api/foo, /v1/logs/v1/logs or a changed query.

Why is this bad? Three PRs built URLs or paths without checking the existing value, which doubled separators or segments or altered queries. No rule names this.

Example

    private const string OperationName = AzureFunctionsConstants.AzureFrontDoorName;
    private static readonly IDatadogLogger Log = DatadogLogging.GetLoggerFor<AzureFrontDoorSpanFactory>();

    public Scope? CreateSpan(Tracer tracer, InferredProxyData data, ISpanContext? parent = null)
    {
        try
        {
            var resourceUrl = data.Path is null ? string.Empty : UriHelpers.GetCleanUriPath($"/{data.Path}").ToLowerInvariant();

Use instead

var path = proxyPath.StartsWith("/") ? proxyPath : "/" + proxyPath;

Evidence:

  • #8861 correction: "it may be best to conditionally add the / if we see it missing we add it"
  • #9505 correction: "this appends it again and we send to"
  • #9642 correction: "The second ? is valid query data, but TrimStart('?') removes it."
XSDK-2.2 Cross-SDK-Consistency new rule: Record a shared telemetry metric with the tags and scope that the spec and other SDKs use #9511 · #9711
Two PRs show shared metrics that drifted from the spec or other SDKs.

What it does: A shared telemetry metric that the diff records with a tag value that other SDKs do not use. Also flag a metric recorded for runs that the spec excludes, such as waf.input_truncated for RASP runs.

Why is this bad? Two PRs show shared metrics that drifted from the spec or other SDKs. One used a different reason tag, and one was recorded for runs the spec excludes. XSDK-2.1 only covers the intake allow list.

Example

        internal void VisitMap(IImmutableDictionary<string, Value> map, string prefix, int depth)
        {
            // Root identity is captured separately and does not consume the attribute budget.
            var attributeCount = map.Count - (depth == 0 && map.ContainsKey("targetingKey") ? 1 : 0);
            if (attributeCount > MaxContainerItems)
            {
                Reasons |= ContextOmissionReason.MaxStructureProperties;

Use instead

Report a root-level overflow as MaxContextFields, as the other SDKs do.

Evidence:

  • #9511 correction: "Report a root-level overflow as MaxContextFields, so this metric uses the same reason tag as the other SDKs."
  • #9711 correction: "RASP calls go through this branch too, so truncating a long SQL statement increments waf.input_truncated."
DES-3.8 Design new rule: Inject one test-seam interface instead of delegates or several time parameters #9568 · #9697
Two PRs added several delegate or time seams for tests.

What it does: a type gains delegate properties, Stopwatch instances, or several separate time parameters only so that tests can control it. Inject one interface instead. On hot paths, pass it as a generic struct parameter.

Why is this bad? Two PRs added several delegate or time seams for tests. In both, reviewers asked for one injectable abstraction, a generic struct implementing an interface, to avoid allocations and parameter sprawl. No rule covers this.

Example

            /// </summary>
            public Func<Task<bool>> CheckHealthAsync { get; set; }

            /// <summary>
            /// Gets or sets how the keep-alive waits, in milliseconds. It is <see cref="Task.Delay(int)"/>, and tests replace it
            /// to record the waits instead of sleeping.
            /// </summary>
            public Func<int, Task> DelayAsync { get; set; } = milliseconds => Task.Delay(milliseconds);

Evidence:

  • #9568 correction: "Using delegates for this add a few additional heap allocations and a bit of overhead for the delegate invocation"
  • #9697 correction: "Do you really need a stopwatch and an elapsedProvider, and a waitForRetry?"

🔧 Existing rules, tuned (2)

Rules that exist, with a new case, a new exception, or better words. The Change column says which. Open the last cell of a row for the details.

RuleLensChangeEvidenceWhy, and examples
COR-6.1 Correctness sharpen Flag #9479 · #9529
COR-6.1 discourages global state but misses tests that must change it and still run in parallel collections.

What it does: unit tests using a SomeType.Instance singleton, [TracerRestorer]/SetTracer, or Tracer.Instance where a locally constructed instance would do, or a Reset()/Clear() added to production state only so tests can reuse it. Also flag a test that changes process-wide state, such as Tracer.Instance or Baggage.Current, outside a non-parallel test collection. A restorer attribute alone does not stop parallel tests from racing.

Why is this bad? COR-6.1 discourages global state but misses tests that must change it and still run in parallel collections. Two PRs had this defect.

Example

        [InlineData("my-container-app", "aca.")]
        public async Task OnIsolatedFunctionBegin_TagPrefixFollowsContainerAppsDetection(string? containerAppName, string prefix)
        {
            var collection = new NameValueCollection { { PlatformKeys.AzureAppService.ContainerAppName, containerAppName } };
            var settings = new TracerSettings(new NameValueConfigurationSource(collection));

            await using var tracer = TracerHelper.CreateWithFakeAgent(settings);
            Tracer.UnsafeSetTracerInstance(tracer);

Evidence:

  • #9479 correction: "this test publishes its tracer process-wide, but the class is not in a nonparallel collection"
  • #9529 correction: "Adding this attribute alone isn't sufficient - you'll have to put it (and any tests that use it) in a collection to disable parallel execution too."
DES-1.1 Design sharpen Flag #9721 · #9505
DES-1.1 only names new classes re-reading a key.

What it does: a new settings class or component calls config.WithKeys(ConfigurationKeys.Environment|Site|ApiKey) (or another key the tracer already extracts) itself, or native code re-reads an env var (e.g. DD_PROFILING_ENABLED) that the managed side already resolves. If the key isn't on the shared settings yet (today DD_SITE and DD_API_KEY), the fix is to extract it there once and pass it in, not to add another independent read. Also flag a settings class that parses a key another settings class owns, such as DD_APPSEC_ENABLED in TracerSettings. If the change adds an OTLP signal, the signal must resolve its endpoint and protocol through ExporterSettings.GetOtlpTransport.

Why is this bad? DES-1.1 only names new classes re-reading a key. The evidence shows existing classes that parse a key twice: TracerSettings next to SecuritySettings, and OTLP logs in TracerSettings next to ExporterSettings. The copies drifted apart.

Example

                explicitSpanMetrics ?? (string.Equals(otelTracesExporter, "otlp", StringComparison.OrdinalIgnoreCase) && OpenTelemetryMetricsEnabled),
                ConfigurationKeys.OpenTelemetry.TracesSpanMetricsEnabled);

            // AppSec read must match SecuritySettings.AppsecEnabled; serverless is excluded because the out-of-process reader can't run there.

Use instead

The fix moved every signal to the single ExporterSettings.GetOtlpTransport path, which also records telemetry.

Evidence:

  • #9721 correction: "the only thing keeping this in line with SecuritySettings.AppsecEnabled is the comment"
  • #9505 absence (culprit #7680)
32 more changes with evidence from one PR only. They stay out of the diff. Comment add <ID> to apply one.
Rule Lens Change Why Evidence
CONV-1.1 Codebase-Conventions sharpen Flag A new Lambda setting read an environment variable directly, and the reviewer asked for the tracer configuration system. #9445
CONV-2.4 Codebase-Conventions new rule: Pass the caught exception to the log call No rule requires the caught exception to be passed to the log call. #9583
CONV-4.10 Codebase-Conventions new rule: Use NullMetricsTelemetryCollector.Instance when a test discards telemetry Tests created undisposed MetricsTelemetryCollector instances. #9699
CONV-4.11 Codebase-Conventions new rule: Mock third-party SDK behaviour in unit tests instead of adding the SDK package The reviewer rejected a heavy SDK dependency in the unit tests in favour of a mock, and the author applied the change. #9535
CONV-5.3 Codebase-Conventions new rule: Add CI test images to docker-compose instead of pulling them in pipeline steps The reviewer asked to move an explicit pipeline docker pull into docker-compose to avoid rate limiting, and the author applied the change. #9066
CONV-6.3 Codebase-Conventions new rule: Duck type public members, not private fields of third-party types DynamoDB instrumentation broke when the AWS SDK removed private fields that it duck typed. #9555
COR-1.3 Correctness new rule: Use is { } x, not is var x, as a null check No rule names the is var pattern used as a null check. #9627
COR-2.5 Correctness new rule: Treat AbandonedMutexException from a mutex wait as acquired, and release the mutex An abandoned mutex that escapes or is never released poisons the shared cross-process channel. #9335
COR-2.7 Correctness new rule: Take the lock inside a method that is only safe under that lock The reviewer asked to move the lock into the method because callers could not be trusted to hold it. #9699
COR-2.8 Correctness new rule: Restore ambient state that an integration sets for one unit of work Kafka consumer baggage leaked to unrelated messages because ambient state was never restored. #9529
COR-3.3 Correctness new rule: Apply an OTEL_* setting only when the matching DD_* key is absent OTEL_SDK_DISABLED overrode DD_TRACE_ENABLED unconditionally, unlike the other OTEL-to-DD mappings. #9514
COR-5.1 Correctness sharpen Flag COR-5.1 covers empty strings that must fall back, but its Flag only names ??. #9497
COR-5.6 Correctness new rule: Convert time values to one unit before you combine them Subtracting seconds from milliseconds produced a time-in-queue of about 57 years. #9455
COR-5.8 Correctness new rule: Release per-call resources in a finally block Two review comments show that downstream WAF subcontexts stayed open when an exception was thrown or no response arrived. #9650
COR-5.9 Correctness new rule: Convert numbers with the invariant culture, with no current-culture step between Debugger probe expressions mis-parsed numbers under comma-decimal cultures. #9651
COR-5.10 Correctness new rule: Duck-type public members of third-party types, not private fields DynamoDB instrumentation broke when the AWS SDK removed private fields. #9555
COR-5.11 Correctness new rule: If a start path fails, stop every producer it started After a partial teardown in the profiler delayed-start path, producers kept feeding a queue that nothing drained. #9403
XSDK-1.2 Cross-SDK-Consistency new rule: Treat empty or whitespace OTEL_* values as unset in every configuration source The OpenTelemetry spec says an empty env var equals unset. #9497
XSDK-1.3 Cross-SDK-Consistency new rule: Apply an OTEL_* mapping only when its DD_* key is absent The shared OTEL-to-DD mapping lets the DD key take precedence. #9514
XSDK-3.2 Cross-SDK-Consistency new rule: Report the sampling mechanism that made the decision A faked user sample rate gave untouched services mechanism -3 and priority 2. #9531
XSDK-3.3 Cross-SDK-Consistency new rule: Keep service names in the UTF-8 form that the tracer, agent and backend accept The tracer, agents and backend accept UTF-8 service names. #9687
DES-3.6 Design sharpen Flag The reviewer moved Azure Container Apps detection out of TracerSettings into the Serverless info classes. #9479
DES-3.9 Design new rule: Take the lock inside a method that is only safe under that lock The reviewer asked to move the lock into ReportWafRequests because it was only safe when the caller held the lock. #9699
MAINT-1.1 Maintainability sharpen Flag Feature Flags added its own service-name normalizer instead of reusing NormalizerTraceProcessor.NormalizeService. #9687
MAINT-1.2 Maintainability sharpen Flag Absence: OTLP logs resolved endpoint and protocol with their own rules in TracerSettings, apart from the shared ExporterSettings path. #9505
MAINT-5.2 Maintainability new rule: Mock third-party SDK behaviour instead of adding a heavy package to unit tests A reviewer asked to drop Microsoft.Azure.Cosmos from the unit tests because a simple mock covers the behaviour, and the author did. #9535
PERF-3.6 Performance new rule: Set typed tag properties directly instead of calling SetTag() with a key A reviewer asked to set typed properties directly on root span tags and to keep the key-based SetTag path only as a fallback. #9479
PERF-3.7 Performance new rule: Do not write a shared counter on every request A shared counter was written on every deferred exposure and every commit, which caused cross-thread cache-line contention. #9644
PERF-2.6 Performance new rule: Use a generic struct parameter instead of delegate test seams A reviewer said delegates used as test seams add heap allocations and invocation overhead. #9568
PERF-3.2 Performance sharpen Flag PERF-3.2 already prescribes the Log.IsEnabled guard, but its Flag names only arguments that call methods. #9568
PERF-2.2 Performance sharpen Flag Same problem as PERF-2.2: a whole structure is materialized to read a few fields. #9481
SEC-2.4 Security-And-Safety new rule: Check out the pipeline commit SHA in CI jobs, not a branch name No CI rule covers fetching code by a mutable branch ref. #9629

CONV-1.1 · sharpen Flag · Codebase-Conventions

A new Lambda setting read an environment variable directly, and the reviewer asked for the tracer configuration system. The current Flag names only IConfigurationSource reads.

Current:

source.GetString(...)/GetInt32(...) on an IConfigurationSource, a ConfigurationBuilder created with NullConfigurationTelemetry, or a test asserting a key is not recorded in telemetry.

Proposed:

source.GetString(...)/GetInt32(...) on an IConfigurationSource, a ConfigurationBuilder created with NullConfigurationTelemetry, or a test asserting a key is not recorded in telemetry. Also flag a new tracer setting that reads an environment variable directly instead of using ConfigurationKeys and config.WithKeys(...).

Evidence:

  • #9445 correction: "You'll want to use the tracer's configuration system instead of reading environment variables directly."

CONV-2.4 · new rule: Pass the caught exception to the log call · Codebase-Conventions

No rule requires the caught exception to be passed to the log call. The reviewer asked for it, and the author applied the change.

Proposed:

CONV-2.4: Pass the caught exception to the log call

  • Flag: a Log.Error or Log.Warning call in a catch block that omits the caught exception. The failure details are then lost.
  • ❌ catch (Exception ex) { Log.Error("Failed to store tracer metadata"); }
  • ✅ catch (Exception ex) { Log.Error(ex, "Failed to store tracer metadata"); }

Evidence:

  • #9583 correction: "You should pass the exception to the error message"

CONV-4.10 · new rule: Use NullMetricsTelemetryCollector.Instance when a test discards telemetry · Codebase-Conventions

Tests created undisposed MetricsTelemetryCollector instances. The reviewer asked for the null collector, and the author applied the change.

Proposed:

CONV-4.10: Use NullMetricsTelemetryCollector.Instance when a test discards telemetry

  • Flag: a test that creates a MetricsTelemetryCollector and never reads or disposes it. Each instance starts a background aggregation task.

Evidence:

  • #9699 correction: "Each Record call creates a MetricsTelemetryCollector whose output is discarded and which is never disposed."

CONV-4.11 · new rule: Mock third-party SDK behaviour in unit tests instead of adding the SDK package · Codebase-Conventions

The reviewer rejected a heavy SDK dependency in the unit tests in favour of a mock, and the author applied the change. No rule covers test project dependencies.

Proposed:

CONV-4.11: Mock third-party SDK behaviour in unit tests instead of adding the SDK package

  • Flag: a heavy third-party package reference added to Datadog.Trace.Tests, such as Microsoft.Azure.Cosmos. Flag it when a simple mock can simulate the same behaviour.

Evidence:

  • #9535 correction: "it's a very heavy dependency, and ultimately we can simulate the same behaviour with a simple mock"

CONV-5.3 · new rule: Add CI test images to docker-compose instead of pulling them in pipeline steps · Codebase-Conventions

The reviewer asked to move an explicit pipeline docker pull into docker-compose to avoid rate limiting, and the author applied the change.

Proposed:

CONV-5.3: Add CI test images to docker-compose instead of pulling them in pipeline steps

  • Flag: an explicit docker pull of a test image, such as the Testcontainers Ryuk image, in the Azure pipeline. Add the image to docker-compose so the VMs pre-pull it and avoid registry rate limits.

Evidence:

  • #9066 correction: "this could cause us ratelimiting issues, I think it's better if we add it to docker-compose"

CONV-6.3 · new rule: Duck type public members, not private fields of third-party types · Codebase-Conventions

DynamoDB instrumentation broke when the AWS SDK removed private fields that it duck typed. The public members already existed, and no duck typing rule names this.

Proposed:

CONV-6.3: Duck type public members, not private fields of third-party types

  • Flag: a [DuckField(Name = "_x")] binding to a private field of a library type when a public member exposes the same value. A library can remove private fields in any release.
  • ❌ [DuckField(Name = "_tableName")]
  • ✅ bind the proxy to the public TableName property.

Evidence:

COR-1.3 · new rule: Use is { } x, not is var x, as a null check · Correctness

No rule names the is var pattern used as a null check. It always matches and leads to a NullReferenceException in customer code.

Proposed:

COR-1.3: Use is { } x, not is var x, as a null check

  • Flag: is var x used as a guard before code dereferences x. The pattern always matches. It also matches null.
  • ❌ if (Tracer.Instance.InternalActiveScope is var scope) { var ctx = scope.Span.Context; }
  • ✅ if (Tracer.Instance.InternalActiveScope is { } scope) { var ctx = scope.Span.Context; }

Evidence:

COR-2.5 · new rule: Treat AbandonedMutexException from a mutex wait as acquired, and release the mutex · Correctness

An abandoned mutex that escapes or is never released poisons the shared cross-process channel. No rule covers this.

Proposed:

COR-2.5: Treat AbandonedMutexException from a mutex wait as acquired, and release the mutex

  • Flag: WaitOne on a shared or named mutex outside a try. Also flag a catch of AbandonedMutexException that does not treat the mutex as held. The abandoned wait still transfers ownership, so the mutex must be released.
  • ❌ _mutex.WaitOne(); Write(message); _mutex.ReleaseMutex();
  • ✅ try { acquired = _mutex.WaitOne(timeout); } catch (AbandonedMutexException) { acquired = true; }

Evidence:

COR-2.7 · new rule: Take the lock inside a method that is only safe under that lock · Correctness

The reviewer asked to move the lock into the method because callers could not be trusted to hold it. No concurrency rule covers this.

Proposed:

COR-2.7: Take the lock inside a method that is only safe under that lock

  • Flag: a method that reads or writes shared state and relies on every caller to hold a lock. Nothing enforces that the callers hold it.

Evidence:

  • #9699 correction: "In terms of the lock... just move the lock into ReportWafRequests if that's the only safe way to call it"

COR-2.8 · new rule: Restore ambient state that an integration sets for one unit of work · Correctness

Kafka consumer baggage leaked to unrelated messages because ambient state was never restored. No rule covers this.

Proposed:

COR-2.8: Restore ambient state that an integration sets for one unit of work

  • Flag: an integration that assigns ambient state such as Baggage.Current for one message or request. If the scope ends and the previous value is not restored, flag it. Consumer loops reuse one execution context, so the value leaks into later messages.
  • ✅ Assign the message baggage for the consume scope, and restore the previous Baggage.Current when the scope closes.

Evidence:

COR-3.3 · new rule: Apply an OTEL_* setting only when the matching DD_* key is absent · Correctness

OTEL_SDK_DISABLED overrode DD_TRACE_ENABLED unconditionally, unlike the other OTEL-to-DD mappings. No rule states this precedence.

Proposed:

COR-3.3: Apply an OTEL_* setting only when the matching DD_* key is absent

  • Flag: an OTEL_* key that overrides its Datadog equivalent when the user set the DD_* key. An example is OTEL_SDK_DISABLED overriding DD_TRACE_ENABLED.
  • ❌ if (otelSdkDisabled) { TraceEnabled = false; }
  • ✅ if (otelSdkDisabled && !ddTraceEnabledIsSet) { TraceEnabled = false; }

Evidence:

  • #9514 correction: "I think we may want to update this check to only override if the DD configuration is not present."

COR-5.1 · sharpen Flag · Correctness

COR-5.1 covers empty strings that must fall back, but its Flag only names ??. It misses config sources that treat empty or whitespace OTEL_* values as set and break fallback chains.

Current:

value ?? fallback on a string where "" is not a meaningful value (paths, URLs, names).

Proposed:

value ?? fallback on a string where "" is not a meaningful value (paths, URLs, names). Also flag a configuration read that treats an empty or whitespace-only value as set. Then a fallback key, such as OTEL_EXPORTER_OTLP_PROTOCOL, never applies.

Evidence:

  • #9497 correction: "What about a string with only spaces?"
  • #9497 miss (culprit #5661)

COR-5.6 · new rule: Convert time values to one unit before you combine them · Correctness

Subtracting seconds from milliseconds produced a time-in-queue of about 57 years. No rule covers unit mismatches.

Proposed:

COR-5.6: Convert time values to one unit before you combine them

  • Flag: arithmetic or comparison between time values in different units, such as an AMQP timestamp in seconds and ToUnixTimeMilliseconds().
  • ❌ var ms = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() - properties.Timestamp.UnixTime;
  • ✅ var ms = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() - (properties.Timestamp.UnixTime * 1000);

Evidence:

COR-5.8 · new rule: Release per-call resources in a finally block · Correctness

Two review comments show that downstream WAF subcontexts stayed open when an exception was thrown or no response arrived. COR-5.2 only covers stream ownership.

Proposed:

COR-5.8: Release per-call resources in a finally block

  • Flag: cleanup of a per-call resource that runs only on the success path. An example is a WAF subcontext kept in a dictionary. Also flag cleanup that runs only when a response exists. If the call throws, the resource stays open.
  • ✅ try { RunWaf(request); } finally { CloseSubcontext(spanId); }

Evidence:

  • #9650 correction: "Are we guaranteed to always call CloseSubcontext? Even in case of exceptions etc?"
  • #9650 correction: "Shouldn't it be always? Should this be in the finally?"

COR-5.9 · new rule: Convert numbers with the invariant culture, with no current-culture step between · Correctness

Debugger probe expressions mis-parsed numbers under comma-decimal cultures. No rule covers culture round-trips.

Proposed:

COR-5.9: Convert numbers with the invariant culture, with no current-culture step between

  • Flag: a numeric value converted with a culture-sensitive ToString() and then parsed or converted with the invariant culture. Comma-decimal cultures mis-parse the result.
  • ❌ Convert.ChangeType(reader.Value.ToString(), type, CultureInfo.InvariantCulture)
  • ✅ Convert.ChangeType(reader.Value, type, CultureInfo.InvariantCulture)

Evidence:

  • #9651 correction: "Please pass reader.Value directly to Convert.ChangeType in the Integer and Float branches."

COR-5.10 · new rule: Duck-type public members of third-party types, not private fields · Correctness

DynamoDB instrumentation broke when the AWS SDK removed private fields. The CONV-6 duck-typing rules cover proxy kind, not member stability.

Proposed:

COR-5.10: Duck-type public members of third-party types, not private fields

  • Flag: [DuckField(Name = "_name")] on a private field of a third-party library when a public member has the value. Any library release can remove a private field.
  • ❌ [DuckField(Name = "_tableName")]
  • ✅ string TableName { get; } as a duck property on the public member.

Evidence:

COR-5.11 · new rule: If a start path fails, stop every producer it started · Correctness

After a partial teardown in the profiler delayed-start path, producers kept feeding a queue that nothing drained. No rule covers teardown on failure.

Proposed:

COR-5.11: If a start path fails, stop every producer it started

  • Flag: a start or delayed-start failure path that stops some services but leaves producers running. Examples are EventPipe sessions and event-based providers. If the consumer of their queue stopped, memory grows without bound.

Evidence:

XSDK-1.2 · new rule: Treat empty or whitespace OTEL_* values as unset in every configuration source · Cross-SDK-Consistency

The OpenTelemetry spec says an empty env var equals unset. No rule covers this. Reading it as set broke the OTLP protocol fallbacks, and datadog.json and app.config behaved differently from env vars.

Proposed:

XSDK-1.2: Treat empty or whitespace OTEL_* values as unset in every configuration source

  • Flag: Code that reads an OTEL_* key and treats an empty or whitespace value as set. Also flag an unset check that only one configuration source applies, such as EnvironmentConfigurationSource.
  • ❌ Treat an empty OTEL_EXPORTER_OTLP_LOGS_PROTOCOL as set, which skips the fallback to OTEL_EXPORTER_OTLP_PROTOCOL.
  • ✅ Return NotFound for empty or whitespace OTEL_* values in the shared string and JSON configuration sources.

Evidence:

  • #9497 correction: "What about a string with only spaces?"
  • #9497 correction: "Today the same OTEL setting behaves differently depending on where it's set."
  • #9497 miss (culprit #5661)

XSDK-1.3 · new rule: Apply an OTEL_* mapping only when its DD_* key is absent · Cross-SDK-Consistency

The shared OTEL-to-DD mapping lets the DD key take precedence. OTEL_SDK_DISABLED broke this precedence, unlike the other mappings. No rule names this.

Proposed:

XSDK-1.3: Apply an OTEL_* mapping only when its DD_* key is absent

  • Flag: An OTEL_* key that overrides its mapped DD_* key even when the DD_* key is set.
  • ❌ OTEL_SDK_DISABLED=true disables tracing even when DD_TRACE_ENABLED is set.
  • ✅ Apply OTEL_SDK_DISABLED only when DD_TRACE_ENABLED is not present.

Evidence:

  • #9514 correction: "I think we may want to update this check to only override if the DD configuration is not present."

XSDK-3.2 · new rule: Report the sampling mechanism that made the decision · Cross-SDK-Consistency

A faked user sample rate gave untouched services mechanism -3 and priority 2. The backend then misattributes them, and the traces/s limiter applies to them. This breaks the cross-SDK sampling contract.

Proposed:

XSDK-3.2: Report the sampling mechanism that made the decision

  • Flag: A keep-all fallback that sets a default global sample rate. Untouched traces then report a local-rule mechanism and priority.
  • ❌ Default the global sample rate to 1.0 in OTLP mode.
  • ✅ Register OtlpDefaultSamplingRule with rate 1 and the Default mechanism.

Evidence:

XSDK-3.3 · new rule: Keep service names in the UTF-8 form that the tracer, agent and backend accept · Cross-SDK-Consistency

The tracer, agents and backend accept UTF-8 service names. Dropping non-ASCII names broke the match with the APM service name.

Proposed:

XSDK-3.3: Keep service names in the UTF-8 form that the tracer, agent and backend accept

  • Flag: Code that drops or rewrites non-ASCII characters of a service name sent to Datadog, such as the DD-Service header.

Evidence:

  • #9687 correction: "The tracer, the trace agents, and the backend all accept UTF-8 for service names."

DES-3.6 · sharpen Flag · Design

The reviewer moved Azure Container Apps detection out of TracerSettings into the Serverless info classes. TracerSettings is the wrong home for logic that is not a setting, and the current examples do not cover this case.

Current:

discovery, parsing, matching, or integration-specific lookup logic added to a class whose name doesn't cover it (for example, CODEOWNERS parsing in CIEnvironmentValues, or a WCF OperationContext lookup in ProbeProcessor).

Proposed:

discovery, parsing, matching, or integration-specific lookup logic added to a class whose name doesn't cover it (for example, CODEOWNERS parsing in CIEnvironmentValues, or a WCF OperationContext lookup in ProbeProcessor). Also flag environment detection that is not a setting when the change adds it to TracerSettings. Put it in the cached serverless info type, such as Datadog.Trace.Serverless.AzureInfo.

Evidence:

  • #9479 correction: "This should probably live in Datadog.Trace.Serverless.AzureInfo since it's not actually a tracer setting."

DES-3.9 · new rule: Take the lock inside a method that is only safe under that lock · Design

The reviewer asked to move the lock into ReportWafRequests because it was only safe when the caller held the lock. This is an API-shape issue, and no rule names it.

Proposed:

DES-3.9: Take the lock inside a method that is only safe under that lock

  • Flag: a new method that needs its caller to hold a lock, with nothing that enforces it. Move the lock into the method.

Evidence:

  • #9699 correction: "In terms of the lock... just move the lock into ReportWafRequests if that's the only safe way to call it"

MAINT-1.1 · sharpen Flag · Maintainability

Feature Flags added its own service-name normalizer instead of reusing NormalizerTraceProcessor.NormalizeService. The copy drifted from the APM service name. The Flag list names only encoders, hex, random names and settings checks, so it misses normalizers.

Current:

a new method or loop that encodes varints, parses/formats hex, builds random names, or re-derives an existing settings check by hand.

Proposed:

a new method or loop that encodes varints, parses/formats hex, builds random names, or re-derives an existing settings check by hand. It also applies to a new normalizer that copies an existing one, such as NormalizerTraceProcessor.NormalizeService.

Evidence:

  • #9687 correction: "Normalization code is not specific to FeatureFlags, and can change, as you've seen."

MAINT-1.2 · sharpen Flag · Maintainability

Absence: OTLP logs resolved endpoint and protocol with their own rules in TracerSettings, apart from the shared ExporterSettings path. The two paths diverged on base path, fallbacks and telemetry. The root cause is the new signal not reusing the shared resolution.

Current:

after the change, the same constant, field-name map, serialization rule, helper body (new TryPeekScope beside the old one, WaitForSend beside WaitForCount) or multi-line lookup appears in two or more places.

Proposed:

after the change, the same constant, field-name map, serialization rule, helper body (new TryPeekScope beside the old one, WaitForSend beside WaitForCount) or multi-line lookup appears in two or more places. If a new signal resolves the same settings, it must reuse the shared path, such as ExporterSettings.GetOtlpTransport.

Evidence:

MAINT-5.2 · new rule: Mock third-party SDK behaviour instead of adding a heavy package to unit tests · Maintainability

A reviewer asked to drop Microsoft.Azure.Cosmos from the unit tests because a simple mock covers the behaviour, and the author did. MAINT-5.1 covers only references that are redundant or transitive, not heavy new dependencies.

Proposed:

MAINT-5.2: Mock third-party SDK behaviour instead of adding a heavy package to unit tests

  • Flag: a unit test project adds a heavy third-party PackageReference to reproduce SDK behaviour. A simple mock can simulate it.
  • ❌ <PackageReference Include="Microsoft.Azure.Cosmos" Version="..." /> in Datadog.Trace.Tests
  • ✅ // a small mock that simulates the SDK behaviour under test

Evidence:

  • #9535 correction: "it's a very heavy dependency, and ultimately we can simulate the same behaviour with a simple mock"

PERF-3.6 · new rule: Set typed tag properties directly instead of calling SetTag() with a key · Performance

A reviewer asked to set typed properties directly on root span tags and to keep the key-based SetTag path only as a fallback. No rule covers key-based tag writes on a known tags type.

Proposed:

PERF-3.6: Set typed tag properties directly instead of calling SetTag() with a key

  • Flag: hot-path tagging code (for example, SetRootSpanTags) that calls SetTag(key, value) on a tags object of a known type. If that type has a property for the tag, set the property.
  • Not when: the tags object has no typed property for the tag, so SetTag() is the fallback.

Evidence:

  • #9479 correction: "try to set properties directly when possible, and only use SetTag() as a fallback"

PERF-3.7 · new rule: Do not write a shared counter on every request · Performance

A shared counter was written on every deferred exposure and every commit, which caused cross-thread cache-line contention. PERF-5.1 covers only debugger locks, and the Don't flag entry covers only replacing a lock with Interlocked.

Proposed:

PERF-3.7: Do not write a shared counter on every request

  • Flag: a field shared across request threads that hot-path code increments or writes on every call, even in healthy apps. This causes cache-line contention.
  • ❌ Interlocked.Increment(ref _exposuresDeferredSinceCommit); // on every deferred exposure

Evidence:

  • #9644 correction: "every deferred exposure increments _exposuresDeferredSinceCommit and every commit writes it again"

PERF-2.6 · new rule: Use a generic struct parameter instead of delegate test seams · Performance

A reviewer said delegates used as test seams add heap allocations and invocation overhead. The repository prefers a generic struct parameter that implements an interface. No rule names this.

Proposed:

PERF-2.6: Use a generic struct parameter instead of delegate test seams

  • Flag: delegate properties or extra Stopwatch instances added only as test seams. Each one adds heap allocations and delegate call overhead.
  • ✅ a generic type parameter constrained to an interface, with a struct implementation in production.

Evidence:

  • #9568 correction: "Using delegates for this add a few additional heap allocations and a bit of overhead for the delegate invocation"

PERF-3.2 · sharpen Flag · Performance

PERF-3.2 already prescribes the Log.IsEnabled guard, but its Flag names only arguments that call methods. It misses the params object[] allocation that the reviewer flagged.

Current:

Log.Debug(...) in an integration callback whose arguments call methods (e.g. GetType()), evaluated even when debug logging is off.

Proposed:

Log.Debug(...) in an integration callback whose arguments call methods (e.g. GetType()), evaluated even when debug logging is off. Also flag an unguarded log call with many arguments. It allocates an object[] even when the level is off.

Evidence:

  • #9568 correction: "The new object[] below is guarded with if (Log.IsEnabled(LogEventLevel.Debug)), but this one isn't"

PERF-2.2 · sharpen Flag · Performance

Same problem as PERF-2.2: a whole structure is materialized to read a few fields. Here it cost about 10 KB per call, but the Flag names only JSON response bodies.

Current:

reading a response body into a string, or parsing into JToken/JObject, before extracting the part you need.

Proposed:

reading a response body into a string, or parsing into JToken/JObject, before extracting the part you need. Also flag decoding a whole native result, such as WAF diagnostics with DecodeMap(), to read only a few fields.

Evidence:

  • #9481 correction: "DecodeMap() materializes the whole diagnostic object, including every loaded rule ID and the warnings, just to read the error/errors fields."

SEC-2.4 · new rule: Check out the pipeline commit SHA in CI jobs, not a branch name · Security-And-Safety

No CI rule covers fetching code by a mutable branch ref. SEC-2.1 covers action refs and SEC-2.3 covers image tags, but neither covers repository checkouts. The root cause is the mutable ref in the clone command.

Proposed:

SEC-2.4: Check out the pipeline commit SHA in CI jobs, not a branch name

  • Flag: a CI job that clones or fetches repository code by branch name (git clone -b $CI_COMMIT_REF_NAME) instead of the pipeline commit (CI_COMMIT_SHA). A branch can move or disappear, so a re-run can use different code or fail.
  • ❌ git clone -b $CI_COMMIT_REF_NAME --depth 1 <repo>
  • ✅ git fetch --depth 1 origin $CI_COMMIT_SHA && git checkout FETCH_HEAD

Evidence:

8 defects that a rule already describes
  • CONV-2.1 · Codebase-Conventions: A catch-all that logs unexpected exceptions at Warning/Debug matches the CONV-2.1 Flag. #9397
  • CONV-3.6 · Codebase-Conventions: A constructor kept only for reflective test construction is a member used only by tests, so CONV-3.6 already flags it. #9479
  • COR-6.1 · Correctness: COR-6.1 already flags [TracerRestorer] and the global Tracer in unit tests. #9455
  • COR-6.4 · Correctness: The defended test asserts that Dispose stops waiting after its timeout. #9695
  • MAINT-1.2 · Maintainability: DD_APPSEC_ENABLED was parsed in both TracerSettings and SecuritySettings, and only a comment kept the two in sync. #9721
  • MAINT-1.3 · Maintainability: Each of these fixes or guards landed at one site while sibling sites needed it too: HttpListener port setup, AddTruncation instead of CheckWAFError, the empt... #9652 · #9711 · #9497 · #9578
  • MAINT-4.5 · Maintainability: A VersionCondition excluded only net9.0, which broke net8.0. #9742
  • PERF-3.4 · Performance: PERF-3.4 already flags a try/catch around calls that will not throw. #9642
How to answer, and run details

How to answer each change

  • Nothing, ok, LGTM or a thumbs up: keep the change.
  • discard or discard: <reason>: put the rule back as it is on main. Outside a review thread, name the rule: discard LIFE-005.
  • A suggestion block: replace those lines.
  • add <ID>: apply a folded change, for example one with evidence from one PR only.
  • Any other comment on a rule: an agent edits that rule as you ask.
  • A change goes into the diff when its evidence comes from 2 or more distinct PRs. Each change must also pass the evidence thresholds and lint.
  • If the reason of a discard holds for the future, write it in the rule, for example as Not when:. The next runs read the rules.

This PR only edits docs/development/for-ai/Coding-Requirements/. It never merges by itself: a maintainer of this repository approves it. The next monthly run publishes nothing while it is open.

Not applied

Rule Action Status Reason
COR-5.7 new_rule not_enough_evidence needs a fix, an applied maintainer correction, or two PRs

Human-only review and outside context: never rule material.

  • #9449 human_only: Marking profiler integration tests as Flaky treats a symptom; the profiler may be producing bad values that should be understood first.
  • #9599 human_only: Benchmarks project: a one-off benchmark added to the repo; reviewer asked whether it is needed. It was removed and kept in the PR description.
  • #9599 human_only: Unit tests: a differential/equivalence test kept a reimplementation of the old matcher and was mostly setup. Reviewer asked for direct invariant tests instead, and the suite was removed.
  • #9605 context: New telemetry metrics must also be added to the dd-go telemetry intake allowlist, which is outside this repository
  • #9669 human_only: AgentWriter normalization unit test has heavy setup and a large parameter matrix, so it is hard to read and its purpose is unclear
  • #9677 context: CI SDK version bump depends on updating the Azure managed Linux VM pool image outside the repository

Coverage: Correctness 21 · Security-And-Safety 3 · Design 7 · Performance 7 · Maintainability 7 · Codebase-Conventions 14 · Cross-SDK-Consistency 7. 46 candidates went to another lens. 0 candidates had a quote that does not match.

Run: the workflow run in Datadog.

@pr-commenter

pr-commenter Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-11-23 16:59:14

Comparing candidate commit acd95e4 in PR branch review-learning/run-dd-trace-dotnet-2026-10-24-ce98aba5 with baseline commit 92a4fe1 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 18 metrics, 0 unstable metrics, 4 known flaky benchmarks, 139 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • unstable execution_time [+0.000ns; +0.007ns] or [+3.594%; +56.028%]
  • unstable throughput [-246176329270.687op/s; +145071147893.803op/s] or [-120.863%; +71.224%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [-149.268µs; +18.554µs] or [-8.963%; +1.114%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1

  • unstable execution_time [-160.922µs; +132.409µs] or [-6.008%; +4.944%]
  • unstable throughput [-28.134op/s; +32.903op/s] or [-7.338%; +8.583%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • unstable execution_time [-0.002ns; +0.008ns] or [-9.111%; +50.022%]
  • unstable throughput [-190985490410.347op/s; +34640701408.805op/s] or [-122.472%; +22.214%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartActiveSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartActiveSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartActiveSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartRootSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartRootSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartRootSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan_GetCurrentSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan_GetCurrentSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan_GetCurrentSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan_SetActive net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan_SetActive net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan_SetActive netcoreapp3.1
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1
  • scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472
  • scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0
  • scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472
  • scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net472
  • scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1
  • scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0
  • scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1
  • scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0
  • scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472
  • scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0
  • scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1
  • scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472
  • scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0
  • scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1
  • scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472
  • scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0
  • scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net6.0
  • scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.NLogBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.NLogBenchmark.EnrichedLog net6.0
  • scenario:Benchmarks.Trace.NLogBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0
  • scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net6.0
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

- ❌ `WarnFailure(result, attempts: 1);`
- ✅ `WarnFailure(in result, attempts: 1);`

### CONV-3.9: Inject test seams through one interface, not delegates or several time parameters

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

discard

Too specific

- ❌ `context.Should().BeNull("the context is gone after the request");`
- ✅ `context.Should().BeNull();`

### CONV-4.9: Put tests that change process-wide state in a non-parallel collection

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmmm, but this should really be "don't have process-wide state" as the primary flag. And only in a worst case fall back to this 😅 And the "don't have global state" should be table stakes for an LLM 😄

### COR-2.4: Synchronise replay-on-register with the update path so a handler runs once per update
- Flag: a `Register`/`Subscribe` method that immediately invokes the new handler when state already exists, while the update path can invoke the same handler concurrently with no shared lock or generation check.

### COR-2.6: Claim a file or port atomically instead of checking that it is free first

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

discard, the evidence was already caught by an agent, so this doesn't add anything, and the flagged PR was literally doing this?

- ❌ `OnMethodEnd` resets thread-local state while `OnAsyncMethodEnd` calls `securityCoordinator.BlockAndReport(...)`.
- ✅ Block from an integration that only declares `OnAsyncMethodEnd`, or move the `OnMethodEnd` work into `OnAsyncMethodEnd`.

### COR-5.5: Check what a URL or path already contains before adding a separator or segment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

discard, to context specific, not a general rule


### COR-6.1: Create a fresh instance per test instead of using a static `.Instance` or the global tracer
- Flag: unit tests using a `SomeType.Instance` singleton, `[TracerRestorer]`/`SetTracer`, or `Tracer.Instance` where a locally constructed instance would do, or a `Reset()`/`Clear()` added to production state only so tests can reuse it.
- Flag: unit tests using a `SomeType.Instance` singleton, `[TracerRestorer]`/`SetTracer`, or `Tracer.Instance` where a locally constructed instance would do, or a `Reset()`/`Clear()` added to production state only so tests can reuse it. Also flag a test that changes process-wide state, such as `Tracer.Instance` or `Baggage.Current`, outside a non-parallel test collection. A restorer attribute alone does not stop parallel tests from racing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

discard, this duplicates CONV-4.9 now?

### XSDK-2.1: Register new telemetry metrics in the backend intake allow list before the tracer emits them
- Flag: new metric entries in `common_metrics.json` or new metric definitions in the PR, with no linked change that adds them to the intake allow list.

### XSDK-2.2: Record a shared telemetry metric with the tags and scope that the spec and other SDKs use

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

discard, this is already tracked in unit tests. As far as I can tell, this is reading the comments incorrectly, and the examples don't make any general sense


### DES-1.1: Read DD_ENV, DD_SITE, and DD_API_KEY from the tracer's settings objects, not from `IConfigurationSource`
- Flag: a new settings class or component calls `config.WithKeys(ConfigurationKeys.Environment|Site|ApiKey)` (or another key the tracer already extracts) itself, or native code re-reads an env var (e.g. `DD_PROFILING_ENABLED`) that the managed side already resolves. If the key isn't on the shared settings yet (today `DD_SITE` and `DD_API_KEY`), the fix is to extract it there once and pass it in, not to add another independent read.
- Flag: a new settings class or component calls `config.WithKeys(ConfigurationKeys.Environment|Site|ApiKey)` (or another key the tracer already extracts) itself, or native code re-reads an env var (e.g. `DD_PROFILING_ENABLED`) that the managed side already resolves. If the key isn't on the shared settings yet (today `DD_SITE` and `DD_API_KEY`), the fix is to extract it there once and pass it in, not to add another independent read. Also flag a settings class that parses a key another settings class owns, such as `DD_APPSEC_ENABLED` in `TracerSettings`. If the change adds an OTLP signal, the signal must resolve its endpoint and protocol through `ExporterSettings.GetOtlpTransport`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

discard, this is flagging something which we literally had to add, so can't be enforced 😅

- ❌ `if (_isOtlp) { _buffers[i].SetStartTime(now); }`
- ✅ `_buffers[i] = _isOtlp ? new OtlpStatsBuffer(...) : new DatadogStatsBuffer(...);`

### DES-3.8: Inject one test-seam interface instead of delegates or several time parameters

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

discard, This is a duplicate and two specific

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants