[TP] Lab - Advanced analysis with Grail, DQL and Entity Selectors
What you will learn in this TP :
- Understand the role of Grail
- Apply DQL best practices
Review of Grail and DQL
What you will learn in this section :Before starting, let's review Grail and best practices for building your DQL queries.
- Understand the role of Grail
- Apply DQL best practices
-
What is Grail?
Grail is Dynatrace's data lakehouse. Unlike traditional databases, Grail is designed specifically for observability. It stores logs, metrics, traces, and business events (bizevents) in a unified way, without requiring strict schemas or prior indexing (schema-on-read). This allows massive data querying with topological context (Smartscape) always preserved. -
Best practices for DQL queries
To write high-performance queries in DQL (Dynatrace Query Language), you must follow a few golden rules:- Filter early: Use the
filtercommand as early as possible in your query to reduce the data volume processed in subsequent pipelines. - Time selectivity: Always limit the time range of your search (directly via the timeframe selector or in the query).
- Leverage Entity Selectors: Use the
entitySelector()function to benefit from dynamic context instead of hardcoding static IDs. - Use limit(): When writing and testing, end your queries with
limit 10to speed up response times.
- Filter early: Use the
Creating DQL queries
You will create 5 DQL queries that leverage the `entitySelector()` function to dynamically target your entities.-
Query 1: Production host logs
Write a DQL query to retrieve logs only for hosts bearing the 'ENV:PROD' tag. You must use an Entity Selector. -
Query 2: Events related to Java services
Write a query to list and count recent events related to services running the 'Java' technology. -
Query 3: CPU usage via Timeseries
Grail also allows querying metrics. Display the average CPU usage (metric `builtin:host.cpu.usage`) for all hosts belonging to a Management Zone named 'MZ_Finance'. -
Query 4: Search for a specific team's errors
Retrieve logs containing the word 'error' for process groups (PROCESS_GROUP) owned by the backend team (tag 'owner:backend'). -
Query 5: Business events (Bizevents) by application
Retrieve the latest business events (bizevents) generated, but limit this search only to monitored applications of type APPLICATION (Web or Mobile).
Export to Notebook and Dashboard
The goal here is to save, document, and visualize the result of your queries for your teams.-
Creating the Notebook
Execute your DQL queries in the Notebooks application. Format your document and save it following the naming standard: `formation-` (for example: `formation-martin`). -
Pin to a Dashboard
Create a new dashboard named `formation-`. Pin at least 3 of your DQL results to this dashboard.
Recommended Articles
Understand the evolution of billing in Dynatrace: the difference between the ...
Discover why and how to configure Grafana Alloy so that it monitors itself, c...
Discover how to enable, secure, and use Grafana Alloy's built-in web interfac...
Discover the fundamental concepts of Grafana Alloy, the transition from the s...
As part of a Grafana training or observability training, master the declarati...
Learn how to configure Grafana Alloy to collect, transform, and forward metri...
Discover how to configure Grafana Alloy to read log files, journald, or netwo...
Dive into distributed trace processing. Learn how to ingest OTLP, Jaeger, or ...
Discover how to configure continuous profiling in your environments using Gra...
Learn how to manage large-scale Grafana Alloy deployments. Configure Clusteri...
Discover Grafana Assistant, the artificial intelligence integrated into Grafa...
Comparison between Grafana Alloy and Dynatrace ActiveGate. Understand the fun...
Course Glossary
The use of artificial intelligence and machine learning to automate and improve IT operations (e.g., anomaly detection, reducing alert noise).
An open source framework providing standards, APIs, and SDKs to collect and export observability data (traces, metrics, logs) in an agnostic way.