Skip to content

增加环境变量配置 #147

@songlonqi-java

Description

@songlonqi-java

Service Mapping File

DD_SERVICE_MAPPING supports remapping span service names before traces are reported. For large mapping sets, use DD_SERVICE_MAPPING_FILE to load mappings from a file.

Environment Variables

  • DD_SERVICE_MAPPING: inline service mapping list.
  • DD_SERVICE_MAPPING_FILE: path to a file containing service mappings.

File Format

The mapping file uses the same source:target format as DD_SERVICE_MAPPING.

Each non-empty line can contain one mapping:

mysql:checkout-db
postgres:orders-db
redis:checkout-cache
kafka:order-events

Single-line comma-separated mappings are also valid:

mysql:checkout-db,postgres:orders-db,redis:checkout-cache

Example

Create a mapping file:

/etc/datadog/service-mapping.txt

mysql:checkout-db
postgres:orders-db
redis:checkout-cache
legacy-payment:payments

Configure the tracer:

export DD_SERVICE_MAPPING_FILE=/etc/datadog/service-mapping.txt

With this configuration:

  • spans with service mysql are reported as checkout-db
  • spans with service postgres are reported as orders-db
  • spans with service redis are reported as checkout-cache
  • spans with service legacy-payment are reported as payments

Inline Overrides

DD_SERVICE_MAPPING can be used together with DD_SERVICE_MAPPING_FILE. When the same source service appears in both places, the inline value takes precedence.

export DD_SERVICE_MAPPING_FILE=/etc/datadog/service-mapping.txt
export DD_SERVICE_MAPPING=mysql:checkout-db-v2

In this example, mysql is reported as checkout-db-v2, while all other mappings continue to come from the file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions