Skip to content

Send the service on agentless Feature Flags configuration requests - #13378

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 11 commits into
masterfrom
david.ioinovitch/ffe-agentless-dd-service
Nov 18, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 11 commits into
masterfrom
david.ioinovitch/ffe-agentless-dd-service

Conversation

@davidioin

@davidioin davidioin commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

The base branch sends no DD-Service header. With this change, the SDK sends its service in a DD-Service header on each agentless Feature Flags configuration poll, 304 polls included. The value is the service name that APM shows. If that name is empty, the SDK sends no header. For a set service, it also writes one debug log. The poll still runs.

Tracer service APM shows DD-Service header
checkout checkout checkout
My Service my_service my_service
svc _svc _svc
café-api café-api café-api, which the JDK client sends as caf?-api
支付 支付 支付, which the JDK client refuses
___ or empty a fallback name none
  • With dd-java-agent, the value is the service of the agent's spans. DD_TAGS=service:checkout with no DD_SERVICE sends checkout, because the agent sets that service on every span.
  • Only the header value is normalized. The configured service stays the same.

The SDK also sends DD-Client-Library-Language: java and DD-Client-Library-Version: <SDK version> on the same request.

With dd-java-agent, the Feature Flags service setting is the service of the spans. It follows a service or service.name tag in DD_TAGS or DD_TRACE_SPAN_TAGS, and it applies DD_SERVICE_MAPPING, as the spans do. On the base branch, it ignores the tags and the mapping. The exposure events use this setting, so their service also matches the spans.

Agent settings Span service and DD-Service
DD_SERVICE=checkout checkout
DD_TAGS=service:checkout, no DD_SERVICE checkout
DD_SERVICE=app, DD_TRACE_SPAN_TAGS=service.name:checkout checkout
DD_SERVICE=checkout, DD_SERVICE_MAPPING=checkout:store store
DD_SERVICE=checkout, DD_SERVICE_MAPPING=mysql:checkout-db checkout

No other behavior changes. The Remote Configuration path, the event intake and the ETag handling stay the same.

Motivation

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

The usage must show the same service name as APM. Otherwise, customers cannot match their usage to their APM services. Thus the header is the APM name or nothing.

The SDK does not check the CDN's format. The CDN copies the value to its usage logs, and metering-api normalizes every tag again.

The CDN logs the requesting SDK from the DD-Client-Library-* headers. The base branch does not send them.

This is the same change as DataDog/dd-trace-js#11166 for Node.js.

Additional Notes

  • The SDK normalizes the service with the rules of NormalizeService in the Datadog Agent v0.82.3. The Agent applies these rules to the span service, so the result is the name that APM shows.
  • The SDK cannot call TraceUtils.normalizeServiceName. That helper is in internal-api, and dd-openfeature does not depend on it. The helper also follows older Agent rules. Thus CdnConfigurationSource has a small port of the Agent rules.
  • The SDK reads the service without trimming it. The tracer does not trim the service of its spans, so APM shows svc as _svc.
  • The SDK sends the APM name as it is. It adds no check on the value; only an empty result sends no header. The JDK HttpClient decides how it sends a non-ASCII value. It sends é as ?, so café-api arrives as caf?-api. It throws IllegalArgumentException: invalid header value on 支付, so for such a name each agentless poll fails, and flags do not load.
  • With dd-java-agent, FeatureFlagsBackend gives the SDK its service. On the base branch, it gives Config.getServiceName(), which ignores the service tags and DD_SERVICE_MAPPING. Thus with DD_TAGS=service:checkout, the spans show checkout, but Config.getServiceName() gives the inferred name, for example app.
  • The backend now does the same three steps as the tracer, with the same code:
    1. It merges the global tags and the span tags into a TagMap, as CoreTracer does. The span tags win. TagMap stores service.name as service.
    2. It returns that tag when the ServiceNameTagInterceptor rule is on, as TagInterceptor does. Else it returns Config.getServiceName().
    3. It applies DD_SERVICE_MAPPING with the lookup of TraceCollector.mapServiceName.
  • Config drops a service tag from DD_TAGS when DD_SERVICE is set, so DD_SERVICE wins over it. Config does not drop service.name, so a DD_TAGS service.name wins over DD_SERVICE, on spans and in the header.
The normalization rules and other design notes

The rules, in order:

  1. Cut the name to 100 bytes of UTF-8. Do not split a character.
  2. Lowercase the ASCII letters.
  3. Keep a-z, 0-9, :, ., /, -, and the non-ASCII letters and decimal digits.
  4. Replace each run of other characters with one _. Remove a run at the end.
  5. Send the result only if it is not empty.

Other notes:

  • Step 3 keeps non-ASCII letters, like the Agent. Thus café-api stays café-api.
  • For an empty result, like ___, APM shows a fallback name. The SDK sends no header.
  • The SDK reads and normalizes the service once, when it builds the configuration source. The service does not change after startup. Remote Configuration can change the service mapping and the tags of the tracer at run time (tracing_service_mapping, tracing_tags). The header does not follow those changes.
  • The SDK also sends the header to a custom endpoint (DD_FEATURE_FLAGS_CONFIGURATION_SOURCE_AGENTLESS_BASE_URL). A service name is not a secret, unlike the API key.
  • java in DD-Client-Library-Language matches Datadog-Meta-Lang.

How it was tested, in CdnConfigurationSourceTest, against a local HTTP server. The SDK builds the source from the settings.

  • One parameterized test has 31 services, set as dd.service. The expected headers come from the real Agent code (NormalizeService v0.82.3). Each case sends a real request and applies the configuration. A set service without a header logs one debug message.
  • With the service from the agent settings: My Service sends my_service, _svc sends _svc, and ___ sends no header. The request is sent, and the SDK settings still show the configured service.
  • The header is on every poll, including a 304. It is not sent if the service is unset, empty or blank.
  • sendsApiKeyAndMetadataHeaders also checks the two DD-Client-Library-* headers.
  • FeatureFlagsBackendTest.resolvesTheServiceOfTheTracerSpans uses the real Config with 11 cases: DD_SERVICE only, a DD_TAGS service only, DD_SERVICE with a DD_TAGS service, a DD_TRACE_SPAN_TAGS service, the tag interceptor turned off, a mapping of another service, a mapping of DD_SERVICE, a mapping of a DD_TAGS service, a service.name span tag, a service.name in DD_TAGS with DD_SERVICE, and a mapping of a service.name span tag. For each case, the test also starts a span on a real CoreTracer with the same Config, and checks that the span has the same service as the header.
  • ffe-dogfooding ran the Java app from this branch against the staging CDN. A proxy recorded each poll. The header matched the service of the spans in each case. This run used an earlier commit, so it does not cover names like _svc, DD_SERVICE_MAPPING or service.name; the unit tests cover them.
Results, run locally
  • ./gradlew :dd-openfeature:spotlessCheck :dd-openfeature:test --tests 'com.datadog.openfeature.internal.delivery.*': passes, 143 tests (93 in CdnConfigurationSourceTest).
  • ./gradlew :dd-openfeature:test: 985 of 989 pass. The 4 failures are CanonicalFixtureTest. It needs the ffe-system-test-data submodule, which is not checked out locally. These failures are not related to this change.
  • ./gradlew :products:feature-flagging:feature-flagging-lib:spotlessCheck :products:feature-flagging:feature-flagging-lib:test: passes, 108 tests (29 in FeatureFlagsBackendTest). Run with JDK 21 in Docker.
  • With the FeatureFlagsBackend of the base branch, 2 of the first 5 cases fail: the DD_TAGS service and the DD_TRACE_SPAN_TAGS service.
  • With the FeatureFlagsBackend of the previous commit (no mapping, no service.name), 5 of the 6 new cases fail: the 3 mappings and the 2 service.name cases. The mapping of another service passes, as it must.
Dogfooding results (ffe-dogfooding, staging CDN)

The app ran dd-java-agent and dd-openfeature from this branch, in agentless mode. A proxy recorded the DD-Service header of each poll. The span service is from the agent debug log.

Settings DD-Service Span service
DD_TAGS=service:tagged-svc,team:ffe, no DD_SERVICE tagged-svc tagged-svc
DD_SERVICE=dd-wins, DD_TAGS=service:tagged-svc dd-wins dd-wins
DD_SERVICE=dd-svc, DD_TRACE_SPAN_TAGS=service:span-svc span-svc span-svc
DD_TRACE_SPAN_TAGS=service:span-svc, no DD_SERVICE span-svc span-svc
DD_SERVICE=My Service my_service My Service (APM shows my_service)

14 more cases passed. They ran before the service tag change, and they set no service tag:

  • The names My Service, checkout-dogfood, _svc, a b!, and an empty DD_SERVICE sent the expected header or no header. The CDN logs had the same values. The café-api and 支付 cases of that run predate the current behavior. One more case polled the staging CDN directly, with no proxy.
  • OTEL_SERVICE_NAME only, and DD_SERVICE with OTEL_SERVICE_NAME, sent the expected service.
  • 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.

Generated with Claude Code

davidioin and others added 2 commits November 11, 2026 12:46
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 SDK's service on every agentless poll, so Feature Flags usage can be
broken down by service. With the Java agent attached, that is the
agent's resolved service name, the one its spans use.

Only a service matching the format the CDN accepts is sent; anything
else is skipped with a debug log. The CDN drops any other value, and a
header value with a line break or a character outside Latin-1 makes
HttpRequest.Builder throw, which would fail every poll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Feature Flags CDN logs the requesting SDK from the
DD-Client-Library-Language and DD-Client-Library-Version headers. The
Java SDK doesn't send them, so its configuration requests are logged
without an SDK name. Send java and the SDK version on the configuration
request only; event intake requests are unchanged.

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

datadog-official Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 93.75%
• Overall Coverage: 60.43% (-0.02%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 74b9e3e | Docs | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.95 s 14.73 s [+0.7%; +2.2%] (maybe worse)
startup:insecure-bank:tracing:Agent 13.74 s 13.70 s [-0.5%; +1.1%] (no difference)
startup:petclinic:appsec:Agent 17.25 s 17.14 s [-0.6%; +1.8%] (no difference)
startup:petclinic:iast:Agent 17.09 s 17.14 s [-1.2%; +0.6%] (no difference)
startup:petclinic:profiling:Agent 16.64 s 16.25 s [-1.8%; +6.6%] (no difference)
startup:petclinic:sca:Agent 17.30 s 16.93 s [+1.4%; +2.8%] (significantly worse)
startup:petclinic:tracing:Agent 16.24 s 16.32 s [-1.3%; +0.3%] (no difference)

Commit: 74b9e3ea · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

davidioin and others added 2 commits November 11, 2026 14:07
The CDN attributes usage to DD-Service only when it matches its service
format, so a service like "My Service" was skipped and its usage billed
without a service, while APM shows it as my_service. Clean the name up
right before it becomes the header: lowercase it, replace each
character outside a-z, 0-9 and _:./- with _, drop the leading
characters that aren't letters or digits, and cut it to 100 characters.

The character rules are those of TagsHelper.sanitize, which the tracer
applies to the service it sends to Remote Configuration. dd-openfeature
is published on its own and doesn't depend on internal-api, so it has
its own copy. Only the header value is cleaned up; the configured
service is unchanged. A name with nothing left once cleaned up, like
支付, is still not sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit cleaned up the service with the rules of
TagsHelper.sanitize. These rules can give a name that APM does not
show: _svc becomes svc, but APM shows _svc. Thus the CDN can bill usage
to a service that APM does not have.

Now DD-Service is the name that APM shows, or the SDK sends no header.
The SDK normalizes the service with the rules of NormalizeService in
the Datadog Agent (v0.82.3). It sends the result only if the result
matches the CDN format. My Service gives my_service. _svc and café-api
give no header.

The SDK cannot call TraceUtils.normalizeServiceName, because
dd-openfeature does not depend on internal-api. That helper also
follows older Agent rules. Thus the SDK has its own port.

The SDK now reads the service without trimming it. The tracer does not
trim the service of its spans, so APM shows " svc" as _svc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tracer sets the service of every span from a service tag in DD_TAGS
or DD_TRACE_SPAN_TAGS. The Feature Flags service setting read
Config.getServiceName(), which ignores these tags. Thus with
DD_TAGS=service:checkout and no DD_SERVICE, spans showed checkout, but
DD-Service and the exposure events had the inferred name.

Use the service tag of the merged span tags when the service-name tag
interceptor is on, as the tracer does. Config already drops the DD_TAGS
service tag when DD_SERVICE is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SDK sent the APM name of the service only if it matched the CDN
format. The CDN is the only place that decides which DD-Service values
it accepts. It drops other values, from any client. The SDK now does
not copy that rule, so the rule can change in one place, without SDK
releases.

The SDK now sends the APM name if it is not empty and is printable
ASCII. After normalization, only non-ASCII letters and digits fail this
check. The JDK HttpClient throws IllegalArgumentException on a header
value like 支付, and then every poll fails. The CDN drops non-ASCII
values anyway, so this check does not change the usage attribution.

_svc, " svc", -svc and .svc now send their APM name. café-api, 支付
and ___ still send no header.

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

@greghuels greghuels 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.

Approving at 2b15e80. 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 review from a team as code owners November 13, 2026 21:01
@davidioin
davidioin requested review from sarahchen6 and removed request for a team November 13, 2026 21:01
@dd-octo-sts

dd-octo-sts Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Add at least one type, and one component or instrumentation label to the pull request

If you need help, please check our contributing guidelines.

@dd-octo-sts dd-octo-sts Bot added the tag: ai generated Largely based on code generated by an AI or LLM label Nov 13, 2026
@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:39.051517Z 2b15e80 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-13T21:04:56.175886Z 2b15e80 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: 2b15e800b2

ℹ️ 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 type: feature Enhancements and improvements comp: openfeature OpenFeature labels Nov 13, 2026

@datadog-official datadog-official Bot 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.

Bits Code Review: FAIL

CDN usage can be attributed to a different service from APM when service mappings or service.name tags are configured. On JDK 11, newer Unicode letters can also normalize to an unrelated ASCII name instead of causing the header to be omitted.

Open Bits AI session

🤖 Bits Code Review · Commit 2b15e80

@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.

🤖 Review from Codex working with leoromanovsky:

Approved. The service-attribution findings remain documented in the existing review threads.

davidioin and others added 2 commits November 17, 2026 11:38
The JDK HttpClient throws on a value like 支付 and sends é as ?, so the
check stays in Java. The comment no longer says that the CDN decides
which values it attributes, because the CDN will copy any value.

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

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

@datadog-official datadog-official Bot 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.

Bits Code Review: FAIL

The PR adds service and SDK identity headers to agentless polls, but removing ASCII validation now makes services such as 支付 fail every poll, preventing flag loading. Earlier attribution defects involving service mappings, service.name tags, and Unicode classification on JDK 11 remain unresolved.

Open Bits AI session

🤖 Bits Code Review · Commit e69b6d6

davidioin and others added 2 commits November 17, 2026 14:41
Master added a FlagSelectionRequest parameter to the CdnConfigurationSource
constructors. The merge keeps it and adds the service parameter next to the
API key, so both changes compile together. Two tests pass the new arguments.

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

@datadog-official datadog-official Bot 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.

Bits Code Review: FAIL

Service mappings and the service.name tag alias can make the new DD-Service header identify a different service than APM, undermining the service-level usage attribution this change introduces.

Open Bits AI session

🤖 Bits Code Review · Commit 1c502ff

The header now gets the service of the tracer's spans in the same three
steps as the tracer: merge the global and span tags into a TagMap (which
stores service.name as service), take that tag when the
ServiceNameTagInterceptor rule is on, then apply DD_SERVICE_MAPPING with
the TraceCollector.mapServiceName lookup.

For example, DD_SERVICE=checkout with DD_SERVICE_MAPPING=checkout:store
now sends store, and DD_SERVICE=app with
DD_TRACE_SPAN_TAGS=service.name:checkout now sends checkout.

The backend test checks each case against the service of a span from a
real CoreTracer with the same Config.

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

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-18 19:44:37 UTC ℹ️ Start processing command /merge


2026-11-18 19:44:49 UTC ℹ️ MergeQueue: Pull request is not mergeable yet

It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.

  • Run /code blockers to see what is blocking it.
  • Run /remove to cancel it.

2026-11-18 20:00:15 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in master is approximately 1h (p90).


2026-11-18 20:41:34 UTC ℹ️ MergeQueue: This merge request was merged

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>
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 748275a into master Nov 18, 2026
920 of 922 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the david.ioinovitch/ffe-agentless-dd-service branch November 18, 2026 20:41
@github-actions github-actions Bot added this to the 1.70.0 milestone Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: openfeature OpenFeature tag: ai generated Largely based on code generated by an AI or LLM type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants