Try it free

Enrich extensions with primary Grail fields and tags

  • Latest Dynatrace
  • How-to guide
  • 8-min read

This documentation describes the new tagging model for Latest Dynatrace. Some capabilities are still rolling out. If you're currently using Dynatrace Classic auto-tagging, see Dynatrace Classic versus Latest Dynatrace to understand how your existing setup maps to the new model.

Dynatrace enables you to enrich telemetry from extensions with primary Grail fields and tags, which you can use for segments, pipeline routing, bucket assignment, Grail permissions, and cost allocation, consistently across logs, metrics, spans, events, and Smartscape entities.

Enrichment can be configured per monitoring configuration of an extension, allowing you to define primary Grail fields and tags for your different deployments of the same extension.

The two extension types differ in how enrichment works:

  • Local extensions run on OneAgent and automatically inherit both primary Grail fields and primary Grail tags from the host. Primary fields come exclusively from the OneAgent host and cannot be configured explicitly. You can also configure primary tags explicitly per monitoring configuration.
  • Remote extensions run on the Extension Execution Controller (EEC) without a OneAgent host, so enrichment cannot be inherited automatically. You can configure both primary Grail fields and primary Grail tags explicitly per monitoring configuration.

For general guidance on primary Grail fields and tags, see Primary tags.

Prerequisites

  • OneAgent version 1.343+
  • ActiveGate version 1.343+
  • Primary Grail field and tag enrichment for extensions requires EEC version 1.343+.

Configure enrichment

Built-in primary Grail fields

For local extensions, OneAgent automatically detects and enriches primary Grail fields such as dt.host_group.id without any manual configuration. Extensions deployed in a Kubernetes environment are also automatically enriched with k8s.cluster.name and k8s.namespace.name. If these built-in fields cover your filtering and access control needs, no additional setup is required.

Enrichment can be set at two levels within a monitoring configuration. Most support both levels, but some don't define individual endpoints—in those cases, only whole-configuration enrichment applies.

  • Whole configuration: Values apply to all data ingested through the monitoring configuration. Use this for shared metadata that is consistent across all monitored targets in this configuration.
  • Per endpoint: Values apply to a single endpoint only and override whole-configuration values for the same key. Keys not set at the endpoint level fall back to the whole-configuration values. Use this when individual endpoints need different enrichment from the rest of the configuration. Available only for extensions that define endpoints.

Select your preferred method.

Configure enrichment via UI

You can set primary Grail fields and tags at both levels directly in the Dynatrace UI.

Local extensions support primary Grail tags only.

  1. Go to Extensions Extensions Dynatrace > Extensions and select your extension.
  2. Open or create a monitoring configuration.
  3. To configure per-endpoint enrichment, locate the endpoint within the configuration form.
    • Under Primary tags, for each tag you want to apply, select Add and enter the tag key and the tag value. You can also modify existing tags.
  4. To configure whole-configuration enrichment, go to the last page of the monitoring configuration form.
    • Under Primary tags, for each tag you want to apply, select Add and enter the tag key and the tag value. You can also modify existing tags.
  5. Select Save.

Remote extensions support both primary Grail fields and primary Grail tags.

  1. Go to Extensions Extensions Dynatrace > Extensions and select your extension.
  2. Open or create a monitoring configuration.
  3. To configure per-endpoint enrichment, locate the endpoint within the configuration form.
    • Under Primary fields, for each field you want to apply, select Add, select the field key from the list, and then enter the field value. You can also modify existing fields.
    • Under Primary tags, for each tag you want to apply, select Add and enter the tag key and the tag value. You can also modify existing tags.
  4. To configure whole-configuration enrichment, go to the last page of the monitoring configuration form.
    • Under Primary fields, for each field you want to apply, select Add, select the field key from the list, and then enter the field value. You can also modify existing fields.
    • Under Primary tags, for each tag you want to apply, select Add and enter the tag key and the tag value. You can also modify existing tags.
  5. Select Save.

Configure enrichment via API

Use the Extensions API to set primary fields and tags on an extension monitoring configuration. The top-level primaryTags and primaryFields properties apply to the whole configuration.

Local extensions accept primary Grail tags only. Providing primaryFields has no effect.

PUT /api/v2/extensions/{extensionName}/monitoringConfigurations/{configurationId}
{
"primaryTags": [
{
"key": "primary_tags.environment",
"value": "production"
},
{
"key": "primary_tags.team",
"value": "platform"
},
{
"key": "primary_tags.application",
"value": "metrics-ingestion"
}
]
}

Enrichment can also be set per endpoint. The exact location in the request body depends on the extension's configuration schema.

Remote extensions accept both primary Grail fields and primary Grail tags.

PUT /api/v2/extensions/{extensionName}/monitoringConfigurations/{configurationId}
{
"primaryFields": [
{
"key": "aws.region",
"value": "us-east-1"
}
],
"primaryTags": [
{
"key": "primary_tags.environment",
"value": "production"
},
{
"key": "primary_tags.team",
"value": "platform"
}
]
}

Enrichment can also be set per endpoint. The exact location in the request body depends on the extension's configuration schema.

Precedence

When the same key is set at multiple levels, the most specific definition wins. Endpoint-level enrichment takes priority over extension configuration enrichment, which in turn takes priority over host-level enrichment.

Remote extensions

  1. Endpoint-level enrichment
  2. Extension configuration enrichment

Local extensions

  1. Endpoint-level enrichment
  2. Extension configuration enrichment
  3. Host-level enrichment (from oneagentctl or host metadata)

For both extension types, endpoint-level tags and fields override the extension configuration values for matching keys. Keys not set at the endpoint level fall back to the extension configuration. For local extensions, keys not set in the monitoring configuration at all fall back to the OneAgent host.

Working example: remote extension

A remote extension has no host to inherit from. The monitoring configuration sets the base enrichment. One endpoint overrides the environment tag.

LevelDefined valuesEnrichment result

Configuration

primary_tags.environment=production, primary_tags.team=platform

primary_tags.environment=production, primary_tags.team=platform

Endpoint

primary_tags.environment=staging

primary_tags.environment=staging, primary_tags.team=platform

Working example: local extension

A host is configured with primary_tags.environment=production and primary_tags.team=platform via oneagentctl. The monitoring configuration overrides the environment tag for all endpoints. One endpoint overrides it again.

LevelDefined valuesEnrichment result

Host (oneagentctl)

primary_tags.environment=production, primary_tags.team=platform

primary_tags.environment=production, primary_tags.team=platform

Configuration

primary_tags.environment=staging

primary_tags.environment=staging, primary_tags.team=platform

Endpoint

primary_tags.environment=hardening

primary_tags.environment=hardening, primary_tags.team=platform

OneAgent enrichment for local extensions

Local extensions automatically inherit both primary Grail fields and primary Grail tags from the OneAgent they run on. Any enrichment configured through the OneAgent enrichment guide—whether at install time, via oneagentctl, or through central configuration—is passed down to every local extension on that host as the base layer of enrichment.

You can also set primary tags explicitly at the host level using oneagentctl. This is useful when you want consistent tags across every local extension on a host without configuring each monitoring configuration individually.

oneagentctl --set-host-tag="primary_tags.environment=production"
oneagentctl --set-host-tag="primary_tags.team=platform"

For the full set of host-level and process-level options, see the OneAgent enrichment guide.

Query enriched data in Grail

Primary Grail fields and tags applied through extension configuration appear as top-level fields and can be queried with DQL:

Filter metrics by team and environment
fetch metrics
| filter primary_tags.team == "platform" AND primary_tags.environment == "production"
Cost allocation for extension-collected data
fetch metrics
| filter dt.cost.costcenter == "12345"
| summarize sum(value), by: {dt.cost.product}
Security context filtering
fetch logs
| filter dt.security_context == "confidential"
| filter primary_tags.application == "metrics-ingestion"

Limitations

  • Local extensions are automatically enriched with primary Grail fields from the OneAgent host. You cannot configure primary Grail fields explicitly for local extensions.
  • Dynatrace Classic is not supported.
  • Up to 20 primary tags per monitoring configuration; excess tags are silently dropped without a warning.

Related topics

  • Primary Grail fields and tags
  • Organize your data with primary Grail fields and tags
  • Enrich OneAgent telemetry with primary Grail fields and tags
  • Enrich Kubernetes telemetry with primary Grail fields and tags
  • OneAgent configuration via command-line interface
  • Global field reference
  • Primary Grail fields
  • Plan your tagging strategy
  • Best practices for enriching primary Grail fields and tags
Related tags
Dynatrace Platform