Customize service detection in Service Detection v2

  • Latest Dynatrace
  • How-to guide
  • 2min

Service Detection v2 (SDv2) allows you to define services based on resource attributes. You can use the default Dynatrace detection rules and also define your own custom rules.

Aim and context

This page describes service detection for SDv2, how to use default detection rules, and how to create your own custom rules.

Service detection rules

  • Rules apply only to spans.
  • Rules are evaluated in order, from top to bottom.
  • Custom rules are always evaluated before default rules.
  • Only the first matching rule is applied.

Default service detection rules

Since the introduction of Unified Services, Dynatrace has provided several default service detection rules.

  • Dynatrace SaaS versions prior to 1.317: the default service detection rules are hard-coded.
  • Dynatrace SaaS versions 1.317+: the default service detection rules can be activated and deactivated. Additionally, custom rules can be created as described in Create new rule.

Priority

Condition

Service name

1

adobe.em.tier, adobe.em.env_type, adobe.em.program attributes present

{adobe.em.tier}-{adobe.em.env_type}-{adobe.em.program}

2

k8s.workload.name attribute present

{k8s.workload.name}

3

dt.kubernetes.workload.name attribute present

{dt.kubernetes.workload.name}

4

istio.canonical_service attribute present

{istio.canonical_service}

5

service.name attribute present

{service.name}

The service ID is a unique identifier, such as SERVICE-649B4E44CBA804F4, that is the result of hashing the service name string and service splitting attributes, when applicable.

Steps

Detection rules are customized in Settings Settings > Process and contextualize > Services > Service detection.

Create new rule

  1. In Service detection, select Add rule.

  2. Fill in the following optional and required fields:

    • Rule name: required A user-defined name for the rule.

    • Description: optional A human-readable descriptor of the rule.

    • Matching condition: required A DQL matcher. If the matching condition applies, the rule is evaluated.

    • Service name template: required The name that you want the service to have. You can use plain text, or resource attributes surrounded by curly braces ({}). In order for the rule to be applied, the span must have all of the specified resource attributes.

    • Additional service detection attributes: optional Additional attribute(s) used to detect and split services without affecting the generated name. Each attribute consists of a resource attribute specified without curly braces, e.g. service.name or k8s.workload.name.

      Up to 10 additional service detection attributes can be applied.

  3. To save, select Save changes.

Edit custom rules

You can re-order custom rules.

You can also edit a custom rule.

  1. Navigate to the rule and select Details > .
  2. Edit the field(s) as appropriate.
  3. Select Save changes.

Delete custom rules

To delete a custom rule

  1. Navigate to the rule and select Delete > .
  2. Select Save changes to permanently delete the rule, or Discard changes to keep the rule.

You can delete only custom rules, not the built-in rules.

Related tags
Application Observability