Try it free

Explore the service entity in Smartscape on Grail

  • Latest Dynatrace
  • Tutorial
  • 6-min read

Smartscape on Grail is a Grail-based storage and analytics platform for topological data in Dynatrace. It records monitored entities (called nodes) and their relationships (called edges), enabling you to query, traverse, and analyze your environment with unprecedented flexibility and depth. The service entity is one of the key nodes in Smartscape on Grail: it bridges frontend, backend, and infrastructure, enabling end-to-end topology navigation.

This tutorial provides Dynatrace Query Language (DQL) examples for exploring service nodes, their call relationships, and their underlying infrastructure. We recommend running the DQL queries presented on this page in Notebooks Notebooks or Dashboards Dashboards. You can also visualize service topology and relationships directly in Smartscape Smartscape.

Who is this for?

This guide is designed for developers, site reliability engineers, DevOps, and anyone interested in advanced service-centric observability and troubleshooting.

What will you learn?

This page introduces the service entity in Smartscape on Grail, explains its relationships, and provides practical and advanced use case examples for analyzing services and their metrics in context.

As a user of Dynatrace Smartscape on Grail, you'll learn how to:

  • Explore and analyze the topology of your environment, focusing on service nodes and their relationships.
  • Enrich your monitoring data (logs, spans, and metrics) with service topology for more advanced troubleshooting and analytics.
  • Use DQL to query, traverse, and analyze how services interact with each other and with the underlying infrastructure.

Before you begin

Prerequisites

To follow the use cases and examples in this documentation, you need:

  • Access to a Dynatrace environment where Smartscape on Grail is enabled.
  • Sufficient permissions to run DQL queries and view Smartscape data.
  • Monitored nodes present in your environment, such as services, hosts, and containers.

Prior knowledge

Basic familiarity with DQL is helpful but not required, as examples are provided throughout the documentation.

What's a service entity?

A service entity in Smartscape on Grail represents a logical service, such as a web service, API, or back-end component. Services are connected to each other through call relationships, such as calls or called_by. Services are linked to the infrastructure they run on (such as a process, container, host, or cloud compute node) or to the infrastructure they belong to (such as a Kubernetes cluster, namespace, or managed cloud cluster). This node-centric view enables you to analyze dependencies, performance, and health in a holistic way.

Explore service and relationships

Understanding how a service interacts with other nodes is crucial for troubleshooting and optimization. Smartscape enables you to:

  • Analyze which services call or are called by a given service.
  • See the infrastructure that supports each service, such as a process, container, or host.
  • Traverse vertical and horizontal relationships for a complete topology view.
Find a specific service and its relationships
smartscapeNodes "SERVICE"
| filter name == "frontend-web"
Traverse all services called by a specific service
smartscapeNodes "SERVICE"
| filter name == "frontend-web"
| traverse {"calls"}, {"SERVICE"}, direction:"forward"
Count relationship types for services
smartscapeEdges "*"
| filter source_type == "SERVICE"
| fields type, source_id, source_type, target_id, target_type, dt.system.edge_kind
| summarize count = count(), by:{type}
| sort count desc

Explore vertical topology

The vertical topology shows how a service is deployed and what infrastructure supports it. You can use it to answer one of the following questions:

  • Where's the service deployed?
  • What infrastructure components support it?
  • How does it connect to other layers in the environment?
  • Is a performance issue caused by the application code or the underlying infrastructure?

A service can have two types of vertical relationships:

  • runs_on: The service runs directly on a compute resource, such as a host, container, Kubernetes pod, or a cloud compute node (for example, an AWS Lambda function, AWS EC2 instance, Azure Functions app, Azure Container App, or a Google Cloud Run service).
  • belongs_to: The service is grouped under a larger node, such as a Kubernetes cluster or namespace, or a managed cloud cluster (for example, Amazon EKS, Azure AKS, or Google GKE).

Use the following DQL examples to explore vertical relationships in your environment.

Explore all vertical relationships across all services

Get an overview of all vertical edges originating from services, including the relationship type and target node.

smartscapeEdges "runs_on", "belongs_to"
| filter source_type == "SERVICE"
| fields type, source_id, target_id, target_type
Discover which node types your services run on

Count runs_on relationships across all services, grouped by target node type.

smartscapeEdges runs_on
| filter source_type == "SERVICE"
| summarize count(), by:{target_type}
Discover which node types your services belong to

Count belongs_to relationships across all services, grouped by target node type.

smartscapeEdges belongs_to
| filter source_type == "SERVICE"
| summarize count(), by:{target_type}
Traverse from a service to all nodes it runs on

Find all nodes a service runs on, along with the node type and name.

smartscapeNodes "*"
| filter type == "SERVICE"
| filter name == "frontend-web"
| traverse "runs_on", "*", direction:"forward"
| fields id, type, name
Traverse from a service to all nodes it belongs to

Find all nodes a service belongs to, along with the node type and name.

smartscapeNodes "*"
| filter type == "SERVICE"
| filter name == "frontend-web"
| traverse "belongs_to", "*", direction:"forward"
| fields id, type, name
Relationships to cloud compute nodes

Dynatrace automatically establishes runs_on and belongs_to relationships between services and their underlying cloud compute nodes across AWS, Azure, and Google Cloud, based on cloud resource attributes present in the service's span data.

For OpenTelemetry-instrumented services, ensure that the cloud.resource_id attribute or a cloud-specific equivalent (aws.arn, azure.resource.id, or gcp.resource.name) is set on the span emitted by the service.

Check additional use cases

Analyze service response time

Retrieve response time for a service from a service node.

smartscapeNodes "SERVICE"
| filter name == "frontend-web"
| join [
timeseries responseTime_p95_timeseries = percentile(dt.service.request.response_time, 95), by:{dt.smartscape.service}, bins: 60
], on: { left[id] == right[dt.smartscape.service]}
Get deployment details from Kubernetes

Retrieve deployment details, such as version, namespace, and cluster, for a service to correlate performance or incidents with recent changes.

smartscapeEdges "belongs_to"
| filter source_type == "SERVICE"
| fields type, source_id, source_type, target_id, target_type
| fieldsAdd service_name = getNodeName(source_id)
| filter contains(service_name, "astroshop-currency")
| filter target_type == "K8S_DEPLOYMENT"
| fieldsAdd result = lookup(
[
smartscapeNodes "K8S_DEPLOYMENT"
| fieldsAdd version = tags[`app.kubernetes.io/version`]
| fields id, version, k8s.cluster.name, name
],
sourceField: target_id, lookupField:id )
| fieldsAdd version = result[version]
| fieldsAdd cluster = result[k8s.cluster.name]
| fieldsAdd deployment_name = result[name]
| fieldsRemove result, target_type, target_id, source_type, source_id, type
Analyze downstream service impact

Analyze how issues in downstream services affect the performance of your service. Downstream services are the ones called by your service.

Show the 95th percentile of response times for the service:

timeseries responseTime_p95_timeseries = percentile(dt.service.request.response_time, 95), by:{dt.smartscape.service}, bins: 60, filter: dt.smartscape.service == "SERVICE-55A331C06F22D134"

Join with downstream service response times:

smartscapeEdges "calls"
| filter source_type == "SERVICE"
| filter source_id == toSmartscapeId("SERVICE-55A331C06F22D134")
| fieldsAdd service_name = getNodeName(source_id)
| join [
timeseries responseTime_p95_timeseries = percentile(dt.service.request.response_time, 95), by:{dt.smartscape.service}, bins: 60
], on: { left[target_id] == right[dt.smartscape.service]}

Use the traverse command for multi-hop analysis:

timeseries responseTime_p95_timeseries = percentile(dt.service.request.response_time, 95),
filter:dt.smartscape.service in [
smartscapeNodes "SERVICE"
| filter name == "frontend-web"
| traverse {"calls"}, {"SERVICE"}, direction:"forward"
| fields id
], by:{dt.smartscape.service}, nonempty: true
| fieldsAdd metricName = "Response time p95"
Analyze upstream service impact

Analyze how issues in upstream services affect the performance of your service. Upstream services are those that call your service.

smartscapeEdges "calls"
| filter source_type == "SERVICE"
| filter target_id == toSmartscapeId("SERVICE-55A331C06F22D134")
| fieldsAdd service_name = getNodeName(source_id)
| join [
timeseries responseTime_p95_timeseries = percentile(dt.service.request.response_time, 95), by:{dt.smartscape.service}, bins: 60
], on: { left[source_id] == right[dt.smartscape.service]}
Analyze traffic flow

Analyze request volumes between services to identify hotspots or unexpected spikes.

smartscapeEdges "calls"
| filter source_type == "SERVICE"
| filter source_id == toSmartscapeId("SERVICE-55A331C06F22D134")
| fieldsAdd source_name = getNodeName(source_id)
| fieldsAdd target_name = getNodeName(target_id)
| join [
timeseries request_counts_sum = sum(dt.service.request.count), by:{dt.smartscape.service}
| summarize request_counts_avg = avg(arrayAvg(request_counts_sum)), by:dt.smartscape.service
], on: { left[target_id] == right[dt.smartscape.service]}
| sort right.request_counts_avg desc

Congratulations!

You've completed this tutorial. You now know how to use Smartscape on Grail and DQL to explore service nodes and their relationships. You can:

  • Find a specific service and explore its call relationships with other services.
  • Navigate the vertical topology of a service, including the hosts, containers, Kubernetes pods, and cloud compute nodes it runs on, and the clusters and namespaces it belongs to.
  • Analyze service response time, Kubernetes deployment details, and downstream and upstream service impact using DQL.

As your environment evolves, continue experimenting with DQL queries and Smartscape features to unlock deeper insights from your data.

Related topics

  • Smartscape on Grail
  • Dynatrace Query Language
Related tags
Application Observability