Skip to content

[FFE] Send DD-Service on agentless configuration requests - #9687

Merged
davidioin merged 9 commits into
masterfrom
david.ioinovitch/ffe-agentless-dd-service
Nov 18, 2026
Merged

davidioin merged 9 commits into
masterfrom
david.ioinovitch/ffe-agentless-dd-service

Conversation

@davidioin

@davidioin davidioin commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary of changes

Sends the tracer's service as a DD-Service header on agentless Feature Flags configuration requests. The value is the service normalized with the tracer's own NormalizerTraceProcessor.NormalizeService. When the normalized name is empty, the request has no header.

  • AgentlessConfigurationSource adds DD-Service to every poll. This includes polls that get a 304.
  • The value comes from DefaultServiceName, the name that the spans use. This is DD_SERVICE, then the service tag in DD_TAGS, then the inferred default.
  • The source normalizes that name with NormalizerTraceProcessor.NormalizeService. For example, My Service is sent as my_service. The tracer's own service does not change.
  • When the normalized name is empty, for example from ___, the request has no header. Polling continues.
Tracer service DD-Service header
checkout checkout
My Service my_service
Default Web Site/Shop (IIS default) default_web_site/shop
café-api café-api
支付 支付
___ none

Reason for change

The Feature Flags CDN uses DD-Service to attribute configuration requests to a service. Customers can then break down their Feature Flags usage by service.

The usage must have the same service name as APM, so the header uses the tracer's own normalizer. Feature Flags adds no normalizer of its own.

The IIS case

On .NET Framework, the default service of an IIS application is <site name>/<application path>, for example Default Web Site/Shop. That name has spaces. The header sends default_web_site/shop, as the tracer normalizes it.

Implementation details

  • UpdateService calls NormalizerTraceProcessor.NormalizeService when the service setting changes, not for each poll. RequestAsync() adds the header to each request.
  • The source sends the normalized name as it is. Feature Flags adds no check on the value. When the result is empty, the request has no header, and the source logs the service once at debug level.
Names with non-ASCII letters
  • The normalizer keeps non-ASCII letters, so café-api is sent as café-api.
  • HttpClient refuses a header value that is not ASCII. It throws "Request headers must contain only ASCII characters" (tested on .NET 11). So for such a name, each agentless poll fails, and flags do not load.
  • This follows the tracer's existing behavior. Feature Flags adds no check of its own.
Known difference: names that start with a digit

NormalizeService follows an older Agent. It removes the characters before the first letter, so 2fa-service is sent as fa-service. With client-side stats or OTLP export, the spans go through the same function, so APM also shows fa-service. In the default mode, the Agent normalizes the spans and keeps 2fa-service.

The APM team owns the fix in the tracer's normalizer. When it lands, the header follows with no change in Feature Flags.

Other details
  • The header is not in the static headers of CreateRequestFactory, because there the value cannot change. Code can change the service after startup, and the settings callback updates the header.
  • The settings subscription now tracks the environment and the service, so its field is _settingsSubscription.
  • Create takes an optional request factory. A test can then build the source from tracer settings and examine its requests.
  • Nothing else changes: the tracer's service, the Remote Configuration path, the other headers and the ETag handling stay the same. DD-Service is not part of the CDN cache key.

Test coverage

Tests in AgentlessConfigurationSourceTests use a mocked request. The tracer's own tests cover the normalizer, so these tests check the wiring:

  • One theory checks 5 names on two polls: checkout, My Service, Default Web Site/Shop, café-api and ___ (no header).
  • Tests start from tracer settings and go through Create. DD_SERVICE=My Service sends my_service. With ___, the request goes out with no header. The tracer's ServiceName and DefaultServiceName do not change.
Other tests
  • DD-Service is on every poll. This includes the 304 that answers If-None-Match.
  • There is no header when the service is null or empty.
  • A service that code changes is sent on the next request.
  • The inferred default is sent when DD_SERVICE is not set.
  • The source logs a rejected name once. A settings change that keeps the service does not log it again.

The focused tests pass locally on net11.0 (37 tests): dotnet test tracer/test/Datadog.Trace.Tests/Datadog.Trace.Tests.csproj --framework net11.0 --filter "FullyQualifiedName~FeatureFlags.AgentlessConfigurationSourceTests".

The header path also ran in the ffe-dogfooding app, built from source, against the staging CDN. The CDN logs show my_service for My Service, a_b for a b! and tagged-svc for DD_TAGS=service:tagged-svc. café-api and 支付 sent no header, and the polls continued. CDN errors (503, 429, timeouts) did not stop the polls, and Remote Configuration mode sent no CDN request. That run used an earlier commit of this PR. NormalizeService gives the same header for each of these names.

Other details

The header also goes to custom endpoints. Unlike the API key, a service name is not a secret.

Generated with Claude Code

The Feature Flags CDN logs each configuration request for usage metering and
attributes it to a service when the request carries DD-Service. Send the
tracer's service on every agentless poll, so Feature Flags usage can be
broken down by service.

The service can be changed in code after startup, so it is read per request
and kept current through the settings subscription the source already uses
for the environment. When DD_SERVICE isn't set, the inferred default is sent,
the same name the spans use.

Only a service matching the format the CDN accepts is sent. The CDN drops any
other value, and a header value with a line break or a non-ASCII character
can make the request fail, which would fail every poll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pr-commenter

pr-commenter Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-11-17 19:56:00

Comparing candidate commit 5ee22e2 in PR branch david.ioinovitch/ffe-agentless-dd-service with baseline commit 04d3e39 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 72 metrics, 0 unstable metrics, 13 known flaky benchmarks, 112 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.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472

  • 🟩 execution_time [-670.838ns; -562.623ns] or [-11.900%; -9.980%]
  • 🟩 throughput [+19931.072op/s; +23674.611op/s] or [+11.229%; +13.338%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net472

  • 🟩 execution_time [-404.533ns; -374.331ns] or [-6.741%; -6.238%]
  • 🟩 throughput [+11122.422op/s; +12004.628op/s] or [+6.674%; +7.203%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net472

  • 🟩 execution_time [-652.157ns; -551.360ns] or [-11.917%; -10.075%]
  • 🟩 throughput [+20713.787op/s; +24287.901op/s] or [+11.326%; +13.281%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net472

  • 🟩 execution_time [-388.447ns; -344.614ns] or [-6.014%; -5.335%]
  • 🟩 throughput [+8758.952op/s; +9869.594op/s] or [+5.657%; +6.375%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 allocated_mem [+223 bytes; +223 bytes] or [+5.983%; +5.990%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟩 execution_time [-147.543µs; -133.484µs] or [-6.960%; -6.297%]
  • 🟩 throughput [+31.816op/s; +35.177op/s] or [+6.744%; +7.456%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • unstable execution_time [-0.004ns; +0.002ns] or [-32.680%; +17.240%]
  • unstable throughput [-102305258307.678op/s; +183958082385.118op/s] or [-57.738%; +103.820%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [-443.706µs; -136.920µs] or [-23.189%; -7.156%]
  • unstable throughput [+31.020op/s; +107.415op/s] or [+5.606%; +19.412%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472

  • 🟩 execution_time [-330.221µs; -148.426µs] or [-15.034%; -6.758%]
  • 🟩 throughput [+28.251op/s; +65.336op/s] or [+6.082%; +14.065%]

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

  • unstable execution_time [+22.527µs; +210.705µs] or [+1.262%; +11.800%]
  • unstable throughput [-133.597op/s; -13.362op/s] or [-22.293%; -2.230%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1

  • 🟥 allocated_mem [+16.030KB; +16.051KB] or [+6.253%; +6.261%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • 🟩 execution_time [-7.777µs; -4.171µs] or [-13.187%; -7.072%]
  • 🟩 throughput [+1382.288op/s; +2530.901op/s] or [+8.111%; +14.851%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • unstable execution_time [-0.000ns; +0.009ns] or [-0.566%; +77.132%]
  • unstable throughput [-226818790606.478op/s; +379625180310.586op/s] or [-112.908%; +188.973%]

Known flaky benchmarks without significant changes:

  • 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 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 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 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.Trace.ActivityBenchmark.StartStopWithChild net6.0
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1
  • 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 net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
  • 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.StringConcatBenchmark net472
  • 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.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

davidioin and others added 2 commits November 11, 2026 13:56
The CDN attributes usage to DD-Service only when it matches its service
format, so a name like "My Service" was not sent and its usage billed
without a service, while APM shows it as my_service. On IIS the inferred
name is the site and application path, such as "Default Web Site/Shop", so
the default name was affected too.

Clean the name up with NormalizerTraceProcessor.NormalizeService, the
tracer's port of the Agent's service normalization, right before it becomes
the header: "My Service" is sent as my_service and "Default Web Site/Shop"
as default_web_site/shop. The tracer's own service is left as configured.

The result is still checked against the CDN's format, because the
normalizer keeps non-ASCII letters and can leave nothing at all. A name with
nothing usable left is not sent, with a debug log, and polling carries on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the reuse of NormalizerTraceProcessor.NormalizeService with a small
helper that matches the Node.js tracer's normalizeService, so both tracers
send the same DD-Service for the same name: lowercase, every character other
than a-z 0-9 _ : . / - becomes _, the characters before the first letter or
digit are dropped, and the name is cut to 100 characters.

Unlike that normalizer, this keeps a leading digit (2fa-service), replaces
non-ASCII letters instead of keeping them (cafe with an accent is sent as
caf_ rather than not at all), and doesn't merge runs of replaced characters.
It also no longer logs "Fixing malformed trace" for a long name. A name with
no ASCII letter or digit is still not sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@davidioin davidioin added area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) type:new-feature feature_flags labels Nov 11, 2026
@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (9687) and master.

✅ No regressions detected

📄 View the full report (charts + all metrics) →

DD-Service is now the service name that APM shows, or the request has
no header. Before, the header used the cleanup of the Node.js tracer.
That cleanup can bill usage under a name that APM does not show: it
sent _svc as svc, but APM shows _svc.

CleanUpService is now a port of NormalizeService in the current Agent
(pkg/trace/traceutil/normalize, v0.82.3). It cuts the name to 100 bytes
of UTF-8 and lowercases ASCII letters. It keeps letters, digits and
: . / -, and changes each run of other characters to one _. It removes
a run at the end of the name. NormalizerTraceProcessor.NormalizeService
is not used, because it follows an older Agent. That version removes
the characters before the first letter, so 2fa-service becomes
fa-service.

The CDN drops some names that APM shows, such as _svc and café-api.
The source does not send these names. It logs them once at debug
level and continues to poll.

The tests check 36 names against values from the Agent code and the
CDN pattern. The comments that this PR adds now use short, simple
sentences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The source no longer copies the CDN pattern. The CDN alone decides
which DD-Service values it attributes, so that rule can change without
an SDK release. The source now sends the name that APM shows when it
is not empty and has only printable ASCII (0x21 to 0x7E).

The ASCII check stays because HttpClient throws "Request headers must
contain only ASCII characters" for a value such as café-api. Then every
poll fails, and flags never load. The CDN drops non-ASCII values
anyway, so attribution does not change.

_svc, -svc, .svc, :svc, - and " svc" (as _svc) now send a header.
Non-ASCII and empty names still send no header and log once at debug
level. CleanUpService does not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comments said that the CDN drops _svc and every non-ASCII name.
The source now sends _svc, and it does not send a name that is empty or
not plain ASCII. The comments now say that. No code changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@greghuels greghuels left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving at 000c9c0. The only validation is the printable-ASCII guard (0x21–0x7E), with no CDN shape pattern left. Normalization gives the same header as the Agent's NormalizeService (via dd-trace-go#5878) on all 20,334 test inputs: generated strings, control characters, CRLF payloads, and cases like _svc, unnamed-service and a²b.

@davidioin
davidioin marked this pull request as ready for review November 13, 2026 21:01
@davidioin
davidioin requested a review from a team as a code owner November 13, 2026 21:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T21:03:40.784480Z 000c9c0 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-13T21:05:26.216519Z 000c9c0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 000c9c0cad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@davidioin davidioin added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Nov 13, 2026

@datadog-prod-us1-4 datadog-prod-us1-4 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

With client-side stats normalization active, DD_SERVICE=2fa-service produces spans named fa-service while Feature Flags requests send 2fa-service, splitting usage attribution from APM.

Open Bits AI session

🤖 Bits Code Review · Commit 000c9c0

@andrewlock andrewlock left a comment

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.

I don't think we should have another implementation of service normalization (which even differs from the other implementations). It's just asking for issues with drift and difference.

Also, most of the testing is adding a lot of noise trying to test other components because it's testing along the wrong seams IMO

@leoromanovsky leoromanovsky added the crucible: reviewing A Crucible review has started; this PR has reviewer attention. label Nov 16, 2026 — with ChatGPT Codex Connector

@leoromanovsky leoromanovsky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 Comment from Codex working with leoromanovsky:

Approving as requested by leoromanovsky. The service-normalization mismatch and late-activation settings replay findings remain open; their reproduction and suggested remedies are recorded in the review threads.

@leoromanovsky leoromanovsky removed the crucible: reviewing A Crucible review has started; this PR has reviewer attention. label Nov 16, 2026
The DD-Service header now uses NormalizerTraceProcessor.NormalizeService,
the tracer's own service normalizer, instead of a copy in Feature Flags.
The ASCII check stays. The tests check only the wiring, because the
tracer's own tests cover the normalizer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@datadog-prod-us1-4 datadog-prod-us1-4 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bits Code Review: PASS

More details

The PR sends an ASCII-safe, shared-normalized DD-Service header on every agentless poll; the earlier client-side stats/OTLP mismatch is fixed. Default Agent export can still attribute 2fa-service as fa-service, a known discrepancy explicitly deferred to APM normalization work in the PR discussion.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 1b6f87e

davidioin and others added 2 commits November 17, 2026 11:38
HttpClient throws on any non-ASCII header value, so the check stays in
.NET. The comment no longer says that the CDN decides which names it
attributes, because the CDN will copy any value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The source now sends the result of NormalizerTraceProcessor.NormalizeService
as it is. Only an empty result sends no header. Feature Flags adds no
check of its own on the value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@datadog-prod-us1-4 datadog-prod-us1-4 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

The PR adds DD-Service attribution to agentless polls, but removing the ASCII guard makes services such as café-api fail every configuration request on modern .NET. The earlier stats/OTLP naming mismatch is fixed; the default-export naming discrepancy remains deferred to APM normalization work.

Open Bits AI session

🤖 Bits Code Review · Commit 5ee22e2

@davidioin
davidioin requested a review from andrewlock November 17, 2026 17:20

@andrewlock andrewlock left a comment

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.

Thanks for tweaking!

@davidioin
davidioin merged commit 8d7b937 into master Nov 18, 2026
147 of 150 checks passed
@davidioin
davidioin deleted the david.ioinovitch/ffe-agentless-dd-service branch November 18, 2026 19:43
@github-actions github-actions Bot added this to the vNext-v3 milestone Nov 18, 2026
gh-worker-dd-mergequeue-cf854d Bot pushed a commit to DataDog/libdatadog that referenced this pull request Nov 18, 2026
# What does this PR do?

Adds an optional `service` to `CdnConfig`. Each CDN configuration request sends it in a `DD-Service` header, 304 revalidations included. The header has the service name after the trace normalizer, or there is no header.

- `cdn.rs`: new `CdnConfig::service`. `CdnFetcher::new` passes it to the transport.
- `cdn/transport.rs`: `usage_service` normalizes the service once, when the fetcher is built. `build_request` adds `DD-Service` when there is a value.
- `Cargo.toml`: `libdd-ffe` uses `normalize_service` from `libdd-trace-normalization`. The `cdn` feature turns on this optional dependency.

The request has no header when the normalized name is empty or the normalizer fallback `unnamed-service`. The fetcher logs this once at debug level and continues to poll. A non-ASCII name goes out as its UTF-8 bytes.

| `service` | `DD-Service` header |
|---|---|
| `checkout` | `checkout` |
| `My Service` | `my_service` |
| `Default Web Site/Shop` | `default_web_site/shop` |
| `café-api` | `café-api` (UTF-8 bytes) |
| `支付` | `支付` (UTF-8 bytes) |
| `___` | no header (the fallback `unnamed-service`) |

<details><summary>Why no header for the fallback</summary>

`normalize_service` gives `unnamed-service` when nothing is left of the name, for example `___` or a blank name. That value says only that the service has no usable name, so the request has no header. A service that is itself named `unnamed-service` also has no header, because it is the same value.

</details>

# Motivation

The Feature Flags CDN uses `DD-Service` to attribute configuration requests to a service. Customers can then break their Feature Flags usage down by service. Any SDK that fetches through `libdd-ffe` gets this when it sets the field. Today that is PHP, through the sidecar. dd-trace-php sets `service` in DataDog/dd-trace-php#4495.

The header uses the normalizer that libdatadog already has for span services, so this PR adds no other copy of the normalization rules. A later fix to that normalizer also changes the header.

The tracers also send `DD-Service`: DataDog/dd-trace-go#5878, DataDog/dd-trace-java#13378, DataDog/dd-trace-dotnet#9687, DataDog/dd-trace-js#11166, DataDog/dd-trace-py#21683, DataDog/dd-trace-rb#6673. System tests: DataDog/system-tests#8446.

<details><summary>More detail</summary>

- The CDN copies the header value to its usage logs, and metering-api normalizes every usage tag again.
- The `http` crate accepts UTF-8 header values, and hyper sends their bytes. So a non-ASCII name cannot make a request fail, and the fetcher sends it as is.
- The normalization also protects polling. A value with CR/LF is not a valid header value. The request cannot be built, so every poll fails. The normalizer replaces CR/LF, so a bad service removes only the header. It never stops flag fetching.

</details>

# Additional Notes

- `CdnConfig` is the fetcher identity (Eq/Hash, and IPC). So the sidecar runs one fetcher for each service. This is expected.
- Breaking: `CdnConfig` has a new public field, so struct literals need `service`. The field is `#[serde(default)]`, so JSON without it reads as no service. IPC uses bincode, so the client and the sidecar must come from the same libdatadog version, as before.
- Custom endpoints also get the header. A service name is not a secret, unlike the API key.
- Nothing else changes. `DD-Service` is not part of the CDN cache key, so ETags work as before.

<details><summary>Implementation notes</summary>

- `libdd-trace-normalization` adds no new crate to `Cargo.lock`. Its dependencies (`anyhow`, `libdd-trace-protobuf`) are already in the workspace.
- `normalize_service` removes the characters before the first letter, so `2fa-service` becomes `fa-service` and `_svc` becomes `svc`. The current Agent keeps them. That difference is in the shared normalizer, and the APM team owns its fix. This PR does not change the normalizer.
- A whitespace-only service and `___` get the debug log. An empty service gets no log.
- The shared test log capture moves from `telemetry/` to the crate root, so CDN tests can check the debug log.

</details>

# How to test the change?

- `CdnFetcher` tests against a mock HTTP server:
  - `checkout` is sent on the first 200 and on the next 304.
  - `My Service` arrives as `DD-Service: my_service`, and `Default Web Site/Shop` as `DD-Service: default_web_site/shop`, on 2 polls each.
  - With `___` or `!!!` (the fallback `unnamed-service`), requests have no header. The debug log appears once over several polls.
  - With `café-api` or `支付`, a raw socket server gets the UTF-8 bytes of the name on 2 polls, and fetching works. (httpmock cannot match a header value that is not ASCII.)
  - With no service or an empty service, requests have no header and fetching works.
- A unit test checks that the header carries the result of `normalize_service`, also for `café-api` and `支付`, and which results send no header. The normalizer has its own tests in its crate.
- The sidecar CDN HTTP/IPC test registers a service. Its mock answers only requests that have the header.
- ffe-dogfooding ran a PHP app end to end against the staging CDN, on an earlier head of this PR. A proxy recorded the `DD-Service` header of each poll, and the CDN logs had the same values. Each name in the PHP results below gives the same header with `normalize_service`.

<details><summary>Results</summary>

- `cargo nextest run -p libdd-ffe --features cdn`: 94 pass. `cargo nextest run -p libdd-ffe`: 45 pass. `cargo nextest run -p datadog-sidecar -E 'test(/cdn/)'`: 11 pass.
- `cargo clippy -p libdd-ffe --features cdn --all-targets -- -D warnings` is clean. `cargo check -p libdd-ffe --no-default-features` passes with and without `cdn`.
- `cargo +nightly-2026-07-26 fmt -p libdd-ffe -- --check` is clean.

</details>

<details><summary>PHP dogfooding results</summary>

The PHP app ran dd-trace-php from DataDog/dd-trace-php#4312 (the CDN integration). #4312 pins libdatadog at #2676, so the build used that commit plus an earlier head of this PR.

#4312 does not set `service` yet, so the build also had a small local patch, the shape of the dd-trace-php follow-up:

- `ddog_ffe_cdn_config_new` gets a `service` argument and sets `CdnConfig.service`. An empty value gives `None`.
- `ddtrace_ffe_startup` passes `DD_SERVICE` (which falls back to `OTEL_SERVICE_NAME`), else `datadog_default_service_name()`. The root span uses the same rule. PHP ignores a `service` tag in `DD_TAGS` on spans, so the patch ignores it too.

The app was in agentless mode with a 5-second poll interval. A proxy recorded each poll and forwarded it to the staging CDN.

| Case | `DD-Service` |
|---|---|
| `DD_SERVICE=My Service` | `my_service` |
| `DD_SERVICE=checkout-dogfood` | `checkout-dogfood` |
| `DD_SERVICE=café-api` | no header on that head; the current head sends `café-api` |
| `DD_SERVICE=支付` | no header on that head; the current head sends `支付` |
| `DD_SERVICE=a  b!` | `a_b` |
| empty `DD_SERVICE`, `OTEL_SERVICE_NAME=ffe-dogfooding-php8-openfeature` | `ffe-dogfooding-php8-openfeature` |
| `DD_SERVICE=ffe-dogfooding-php-agentless`, straight to the CDN with no proxy | `ffe-dogfooding-php-agentless` (CDN logs) |
| `OTEL_SERVICE_NAME=My OTel Svc` only | `my_otel_svc` |
| `DD_TAGS=service:tagged-svc,team:ffe` only | `web.request`, the default PHP service of the spans |
| `DD_SERVICE=dd-wins`, `OTEL_SERVICE_NAME=otel-loses` | `dd-wins` |

- Each case sent the header on the first `200` and on each later `304`. The provider was ready and the flags evaluated.
- After 3 polls with `503`, 2 polls with `429` and 2 polls slower than the request timeout, the polls continued with the same header and the app recovered.
- In Remote Configuration mode, the app sent no CDN polls.

</details>

Generated with [Claude Code](https://claude.com/claude-code)




Co-authored-by: david.ioinovitch <david.ioinovitch@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) feature_flags type:new-feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants