PluginBench
Skill
Pass
Audit score 90

dt-migration

dynatrace/dynatrace-for-ai

Migrate Dynatrace classic and Gen2 entity-based DQL queries to Smartscape equivalents.

What is dt-migration?

This skill helps you rewrite Dynatrace DQL queries that use classic entity constructs (dt.entity.*, classicEntitySelector, entity relationships) to modern Smartscape-based syntax. Use it when refactoring legacy queries or integrating with Dynatrace's newer data model.

  • Classifies query intent to determine the correct migration strategy (mass data filtering, entity subqueries, or pure entity lists)
  • Maps classic entity types (host, service, process, container, Kubernetes, cloud application) to Smartscape equivalents
  • Rewrites entity-based filters and subqueries using smartscapeNodes, smartscapeEdges, and traverse primitives
  • Handles special constructs like entityName(), entityAttr(), classicEntitySelector(), and classic relationship patterns (belongs_to, runs, instance_of)
  • Provides decision gates and field-discovery steps to verify equivalence before committing to a migration path

How to install dt-migration

npx skills add https://github.com/dynatrace/dynatrace-for-ai --skill dt-migration
Prerequisites
  • Familiarity with Dynatrace DQL syntax and classic entity types (dt.entity.host, dt.entity.service, etc.)
  • Access to the dt-dql-essentials skill for validating final query syntax
  • Understanding of Smartscape concepts (nodes, edges, traversal)
Claude Code
Cursor
Windsurf
Cline

How to use dt-migration

  1. 1.Classify your query into one of three situations: mass data filtered by entity conditions, mass data using entity subqueries, or pure entity list queries
  2. 2.For mass data queries (situations 1–2), load the mass-data-filtering-strategy reference and complete field discovery and equivalence verification steps
  3. 3.For pure entity list queries (situation 3) or Smartscape subqueries, identify the classic entity types and look them up in the core entity mapping table
  4. 4.Rewrite using Smartscape primitives: smartscapeNodes, smartscapeEdges, traverse, references, getNodeName(), and getNodeField()
  5. 5.Check the special-cases reference for host groups, process groups, container groups, and other patterns without direct Smartscape equivalents
  6. 6.Load the entity-specific guide (entity-host.md, entity-service.md, etc.) if your migration centers on a particular entity family
  7. 7.Validate the final query using dt-dql-essentials to ensure it follows current DQL syntax rules

Use cases

Good for
  • Migrating timeseries or logs queries that filter by classic entity conditions to dimension-first or Smartscape subquery equivalents
  • Converting entity subqueries in lookup or join clauses from dt.entity.* to smartscapeNodes filters
  • Rewriting pure entity list queries (fetch dt.entity.*) to use smartscapeNodes with appropriate node types
  • Updating signal queries that reference classic entity fields to use Smartscape fields and getNodeField() accessors
  • Handling host-group, process-group, and container-group patterns that have no direct Smartscape standalone entity
Who it's for
  • Dynatrace DQL developers maintaining or modernizing queries built on the classic entity model
  • Platform engineers migrating monitoring dashboards and alerts to Smartscape
  • DevOps teams refactoring Dynatrace automation that relies on entity-based filtering

dt-migration FAQ

Should I always use Smartscape for entity filtering in mass data queries?

No. For situations 1 and 2 (mass data queries), resolve entity conditions to raw data dimensions first, and use Smartscape only as a fallback when dimension equivalents do not exist. Load the mass-data-filtering-strategy reference to verify field availability before choosing Smartscape.

Can I reuse classic entity IDs in Smartscape queries?

No. Classic entity IDs do not carry over to Smartscape automatically. You must use Smartscape node IDs and fields instead.

What do I do if my query uses host groups or process groups?

Host groups and process groups have no standalone Smartscape entity. Instead, use the fields available on the HOST and PROCESS node types respectively. Load the special-cases reference for detailed guidance.

How do I migrate entityName() and entityAttr() calls?

Prefer direct node fields when querying Smartscape nodes directly. Use getNodeName(x) and getNodeField(x, "...") only when you need to access properties of a referenced or traversed node.

What is the difference between references and traverse in Smartscape?

traverse is used for dynamic relationship traversal across multiple hops. references works only for static edges and is simpler when the relationship is fixed. Choose based on your query's relationship complexity.

Full instructions (SKILL.md)

Source of truth, from dynatrace/dynatrace-for-ai.


name: dt-migration description: Migrate Dynatrace classic and Gen2 entity-based DQL to Smartscape equivalents. Covers three scenarios. (1) mass data queries filtered by classic entity conditions — migrate to direct dimension filters first, Smartscape only as fallback; (2) mass data queries using entity subqueries for filtering — same dimension-first strategy; (3) pure entity list queries — migrate fetch dt.entity.* to smartscapeNodes. Also handles entityName, entityAttr, classicEntitySelector, and classic relationship patterns. license: Apache-2.0

Smartscape Migration Skill

This skill migrates Dynatrace classic and Gen2 entity-based DQL queries and query patterns to Smartscape-based equivalents.

Load the dt-dql-essentials skill before writing final DQL so the translated query also follows current DQL syntax rules.

This skill focuses on Smartscape-oriented DQL migration only. It does not cover asset-level migration workflows.

Query Purpose Classification

Start here. The correct migration strategy depends on what the query is actually trying to do — not just which classic constructs it uses.

There are three distinct situations:

#SituationClassic anti-patternMigration strategy
1Mass data query filtered by entity conditionsclassicEntitySelector(...) inline in filter: of a timeseries, logs, or metrics queryResolve entity conditions to raw data dimensions first. Smartscape is a fallback, not the default.
2Mass data query using entity subquery for filteringfetch dt.entity.* inside in [...], lookup [...], or join [...] to filter the outer mass data querySame dimension-first strategy. Rewrite as raw dimension filter or in [smartscapeNodes ...] subquery.
3Pure entity list queryfetch dt.entity.* used standalone or as the primary result sourcesmartscapeNodes is the only valid path. No raw dimension alternative exists.

Decision:

  • Situations 1 or 2 — load references/mass-data-filtering-strategy.md and complete all steps including field discovery (Step 2) and equivalence verification (Step 4). Do not skip the fieldsSnapshot gates — they determine which approach is viable. Only fall back to the Migration Workflow below when the entity-type mapping or relationship traversal is needed to complete a Smartscape subquery.
  • Situation 3 — continue with the Migration Workflow and entity mapping table below.

Note: Situation 3 has a sub-case where classicEntitySelector is used to filter the entities returned by fetch dt.entity.*. This is rare and follows the same smartscapeNodes path — resolve the selector conditions using references/mass-data-filtering-strategy.md Step 1B, then apply them as node filters in smartscapeNodes.

Migration Workflow

Follow this order for Situation 3 (pure entity list queries) and for constructing Smartscape subqueries in Situations 1 and 2:

  1. Identify the classic input pattern:
    • fetch dt.entity.*
    • classicEntitySelector(...)
    • relationship field access such as belongs_to[...], runs[...], instance_of[...]
    • signal or event queries using dt.entity.*
  2. Identify the involved classic entity types.
  3. Look up the Smartscape replacement in the core entity mapping table below.
  4. Check which classic DQL constructs need explicit migration.
  5. Rewrite the query using Smartscape primitives:
    • smartscapeNodes
    • smartscapeEdges
    • traverse
    • references
    • getNodeName()
    • getNodeField()
  6. Check for special cases, unsupported entities, or ID assumptions.
  7. Load the matching detailed references for the specific entity family or migration pattern.

For the full migration process and output expectations, load references/migration-workflow.md.

Core Entity Mapping Table

Use this compact table first for common migrations. For the full mapping set, load references/type-mappings.md.

Classic / Gen2 entitySmartscape fieldSmartscape node typeNotes
dt.entity.hostdt.smartscape.hostHOSTStandard host mapping
dt.entity.servicedt.smartscape.serviceSERVICEStandard service mapping
dt.entity.process_group_instancedt.smartscape.processPROCESSProcess instance maps directly
dt.entity.container_group_instancedt.smartscape.containerCONTAINERContainer-group instance maps directly
dt.entity.kubernetes_clusterdt.smartscape.k8s_clusterK8S_CLUSTERKubernetes cluster
dt.entity.kubernetes_nodedt.smartscape.k8s_nodeK8S_NODEKubernetes node
dt.entity.kubernetes_servicedt.smartscape.k8s_serviceK8S_SERVICEKubernetes service
dt.entity.cloud_applicationmultiple workload fieldsmultiple K8S workload node typesMaps to multiple workload types; load the cloud-application guide
dt.entity.cloud_application_instancedt.smartscape.k8s_podK8S_PODClassic cloud app instance becomes pod
dt.entity.cloud_application_namespacedt.smartscape.k8s_namespaceK8S_NAMESPACENamespace mapping
dt.entity.applicationdt.smartscape.frontendFRONTENDFrontend application mapping
dt.entity.aws_lambda_functiondt.smartscape.aws.lambda_functionAWS_LAMBDA_FUNCTIONCloud-function entity mapping

DQL Constructs to Inspect During Migration

These classic constructs usually need explicit rewriting:

Classic constructTypical Smartscape replacementNotes
entityName(x)name or getNodeName(x)Prefer name when querying nodes directly
entityAttr(x, "...")direct node field or getNodeField(x, "...")Prefer direct fields when available
classicEntitySelector(...)node filters plus traverseStart from the constrained side; for mass data queries see mass-data-filtering-strategy.md first
dt.entity.* in signal queriesdt.smartscape.*Applies to by, filter, fieldsAdd, expand, and related clauses
belongs_to[...], runs[...], instance_of[...]traverse or references[...]references works only for static edges
classic entity ID filtersSmartscape idDo not reuse classic IDs blindly
affected_entity_ids and affected_entity_typessmartscape.affected_entitiesOne record array replaces the two parallel arrays; each record has id, type, and name

For the detailed function-by-function guide, load references/dql-function-migration.md.

Special Cases

Do not translate these patterns literally:

  • Host group — no standalone Smartscape entity; use fields on HOST
  • Process group — no standalone Smartscape entity; use fields on PROCESS
  • Container group — no standalone Smartscape entity; preserve output shape with placeholders if needed
  • Classic IDs — classic entity IDs do not carry over to Smartscape automatically
  • Planned, missing, or not-planned mappings — check the full mapping table before assuming direct support

Load references/special-cases.md before migrating these patterns.

Entity-Focused Guides

When a migration centers on a specific entity family, load the matching detailed guide:

Each guide explains:

  • what the classic entity represented
  • what the Smartscape replacement is
  • which fields usually change
  • how relationships are migrated
  • common examples and pitfalls

References