feat(apm): add sampling-rules CRUD commands#552
Draft
rachelyangdog wants to merge 1 commit into
Draft
Conversation
Adds `pup apm sampling-rules {list,get,create,update,delete}` for
managing customer per-(service,env,resource) head-based sampling rules.
Backed by Remote Config product APM_TRACING with provenance=customer.
Rules surface on traces with `_dd.p.dm:-11` and
`ingestion_reason:remote_rule`.
## Commands
pup apm sampling-rules list [--service S --env E]
pup apm sampling-rules get <id>
pup apm sampling-rules create --service S --env E --resource R --sample-rate F
pup apm sampling-rules update <id> --service S --env E --resource R --sample-rate F
pup apm sampling-rules delete <id>
When `--service` and `--env` are both given, list narrows via the
backend's `/configs/by_target` endpoint.
## Scopes
- apm_remote_configuration_read (added to default + read_only)
- apm_remote_configuration_write (added to default)
Both scopes are on pup's OUISvc registrable client allowlist as of the
recent OAuth rollout. Backend support is in place:
- dd-source PR `rachel.yang/apm-trace-configurations-oauth-auth`
(Rapid service-default OAuth on trace-configurations)
- dd-go PR `rachel.yang/rc-api-proxy-apm-tracing-oauth`
(rc-api-proxy authn_methods on apm_tracing routes)
## Tests
8 tests added in `commands::apm::tests`, matching the
service_remapping_* pattern:
test_sampling_rules_list
test_sampling_rules_list_by_target
test_sampling_rules_get
test_sampling_rules_get_not_found
test_sampling_rules_create
test_sampling_rules_create_api_error
test_sampling_rules_update
test_sampling_rules_delete
All pass locally. The 5 unrelated test failures in `cases`, `dbm`,
`logs`, `metrics`, `traces` are pre-existing DNS-resolution flakes
against `unused.local` and not touched by this change.
## Follow-ups
- `pup apm adaptive-sampling` commands (allotment + onboarding) —
separate PR. Requires the `apm_service_ingest_{read,write}` scopes
which are also already on the OUISvc allowlist.
- Flip the agent-skills `dd-apm/sampling` skill PR from draft to
ready once these commands ship in a release.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
pup apm sampling-rules {list,get,create,update,delete}for managing customer per-(service,env,resource) head-based sampling rules. Backed by Remote Config product APM_TRACING with provenance=customer. Rules surface on traces with_dd.p.dm:-11andingestion_reason:remote_rule.Commands
pup apm sampling-rules list [--service S --env E]
pup apm sampling-rules get
pup apm sampling-rules create --service S --env E --resource R --sample-rate F
pup apm sampling-rules update --service S --env E --resource R --sample-rate F
pup apm sampling-rules delete
When
--serviceand--envare both given, list narrows via the backend's/configs/by_targetendpoint.Scopes
Both scopes are on pup's OUISvc registrable client allowlist as of the recent OAuth rollout. Backend support is in place:
rachel.yang/apm-trace-configurations-oauth-auth(Rapid service-default OAuth on trace-configurations)rachel.yang/rc-api-proxy-apm-tracing-oauth(rc-api-proxy authn_methods on apm_tracing routes)Tests
8 tests added in
commands::apm::tests, matching the service_remapping_* pattern:test_sampling_rules_list
test_sampling_rules_list_by_target
test_sampling_rules_get
test_sampling_rules_get_not_found
test_sampling_rules_create
test_sampling_rules_create_api_error
test_sampling_rules_update
test_sampling_rules_delete
All pass locally. The 5 unrelated test failures in
cases,dbm,logs,metrics,tracesare pre-existing DNS-resolution flakes againstunused.localand not touched by this change.Follow-ups
pup apm adaptive-samplingcommands (allotment + onboarding) — separate PR. Requires theapm_service_ingest_{read,write}scopes which are also already on the OUISvc allowlist.dd-apm/samplingskill PR from draft to ready once these commands ship in a release.What does this PR do?
Motivation
Additional Notes
Checklist
Related Issues