跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
效率与协作

service-remapping

Create and manage APM service remapping rules — rewrite service names at ingestion time to collapse noisy inferred entities, clean up auto-generated names, handle org renames, or normalize naming conventions. Use for any request involving service renaming, service mapping, inferred service cleanup, peer.service normalization, or collapsing fragmented service names.

datadog-labs · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add datadog-labs/agent-skills --skill service-remapping

技能说明


name: service-remapping description: Create and manage APM service remapping rules — rewrite service names at ingestion time to collapse noisy inferred entities, clean up auto-generated names, handle org renames, or normalize naming conventions. Use for any request involving service renaming, service mapping, inferred service cleanup, peer.service normalization, or collapsing fragmented service names. metadata: version: "1.0.0" author: datadog-labs repository: https://github.com/datadog-labs/agent-skills tags: datadog,apm,service-remapping,service-naming,inferred-services,peer-service alwaysApply: "false" tools: pup

APM Service Remapping

Before acting: Surface an impact preview (monitors/dashboards referencing the old service name) before presenting the planned rule. For inferred-entity remaps, also confirm peer.service is set on outbound spans. Variables from ## Context to resolve before acting can be gathered alongside that preview rather than blocking it.


How Service Remapping Works — Domain Knowledge

Read this before building any rule. It gives you the mental model to construct the right filter and catch edge cases.

What remapping does: A rule intercepts telemetry at ingestion time and rewrites the service name before indexing. A rule says: "for any entity matching this filter, replace its service name with this new value."

Two entity types — pick the right one:

Entity typerule_type integerWhat it targets
SERVICE0Instrumented services — have spans with an explicit service tag set by a tracer
INFERRED_ENTITY1Auto-detected from outbound calls — named from peer.service. Requires peer.service to be set on outbound spans (see prerequisite below).

Prerequisite for inferred entity remapping — peer.service must be set:

Inferred entity remapping only works when the tracer sets peer.service on outbound spans. Without it, entities are keyed by peer.hostname and remapping rules will not apply.

To enable this, set the following env var on the instrumented service (not the downstream dependency):

DD_TRACE_PEER_SERVICE_DEFAULTS_ENABLED=true

This makes the ddtrace tracer automatically propagate peer.service from peer.hostname on outbound HTTP, gRPC, and database calls. Without this, pup traces search will show spans with peer.hostname but no peer.service, and no service remapping rule will match.

To verify peer.service is being set before building a rule:

pup traces search --query "@peer.service:<ENTITY_NAME>" --from 15m --limit 5

If zero results — the tracer is not setting peer.service. Ask the user to add DD_TRACE_PEER_SERVICE_DEFAULTS_ENABLED=true to their service's environment and redeploy before continuing.

Filter syntax — a standard Datadog event-grammar query string:

GoalFilter
Exact service matchservice:payments
All services with a prefixservice:deploy-test*
All services with a suffixservice:*.tropos
All services containing a stringservice:*payments*
All inferred services under a domainpeer.service:*.shopify.com
Service in one environment onlyservice:payments AND env:prod
Multiple possible valuesservice:(payments OR billing)

Supported operations only: The above forms — exact match, wildcards, AND/OR — are the only accepted operations. More advanced query syntax (CIDR ranges, numeric comparisons, fuzzy matching, etc.) is not supported and will be rejected by the API with a filter syntax error.

New name syntax — the value field in rewrite_tag_rules:

FormExampleUse for
Static stringmy-serviceEvery matched entity gets exactly this name
Tag interpolation{{service}}Substitute the full value of a tag
Tag + regex capture{{service|^(.+?)\..*$}}Extract part of a tag value (non-greedy capture)

Regex constraints for {{tag\|regex}}:

  • Maximum 1 capture group per expression
  • No greedy quantifiers inside capture groups — use non-greedy variants: (.+?) not (.+), (.*?) not (.*)
  • Quantifiers on capture groups themselves (e.g. (foo)+) are not allowed
  • No capture group → the entire match is used as the replacement value
  • Capture group spanning the entire match (e.g. ^(.*)$) is currently rejected by the UI and will soon be rejected by the API — if you want the full tag value, use tag interpolation ({{service}}) instead of a regex

Five remapping patterns:

PatternUser says…Filter exampleNew name example
N:1 group"These N services are all the same thing"peer.service:*.shopify.comshopify
Strip suffix/prefix"The name has junk at the end/start"service:*.tropos{{service|^(.+?)\..*$}}
1:1 rename"We renamed this service and Datadog needs to match"service:old-auth-serviceauth-service
Env split"I want separate services per env but they all have the same name"service:my-service AND env:prodmy-service-prod
Prefix normalization"All services should start with an env or team name"service:payments*{{env}}-{{service}}

Triggers

Invoke this skill when the user wants to:

  • Rename a service in Datadog without re-instrumenting
  • Collapse multiple inferred service names into one (e.g. many api.shopify.com/* variants → shopify)
  • Strip environment suffixes, version tags, or deployment metadata baked into service names
  • Normalize peer.service names to something meaningful
  • Rename a service after an org change, product rebrand, or migration
  • Split a single service into per-env variants (my-service + env:prod → my-service-prod)
  • List, review, or delete existing service remapping rules

Do NOT invoke this skill if:

  • The user wants to rename the service in their application code — that re
阅读完整来源 ↗