Latest Dynatrace
Once stored in Grail, you can interactively query your software lifecycle event data and analyze it using Dynatrace Query Language. Dynatrace Query Language (DQL) is the starting point for analysis, whether you use Davis for Notebooks, Dashboards, or the Grail - DQL Query execution via API. You can use query results interactively or pin them to a dashboard as charts, tiles, or tables.
This guide shows you how to analyze the SDLC events you generated from your pipeline.
You can look up the Swagger documentation to learn how to query SDLC events. The Swagger documentation is Dynatrace tenant-based.
To find the Grail - DQL Query definition and the Query Execution method in your tenant-based Swagger documentation
API
. In the search results, see Support resources section and Dynatrace API below it.To run a query for Grail and to retrieve its result, you need to make two different requests
/query:execute
request./query:poll
request.With DQL you can
This example calculates the average duration of test executions in the last week.
The metric below yields a single numerical value displayed as a Single value or a Record list.
fetch events, from:now()-7d, to:now()| filter event.kind == "SDLC_EVENT"| filter event.type == "test"| summarize {started = takeMin(if(event.status == "started", toTimestamp(start_time))),finished = takeMax(if(event.status == "finished", toTimestamp(end_time)))}, by: {test.id}| fieldsAdd duration = finished - started| summarize avg_test_duration = avg(duration)
This example calculates the average duration of an open request to merge a code change.
The metric below yields a single numerical value displayed as a Single value or a Record list.
fetch events, from:now()-7d, to:now()| filter event.kind == "SDLC_EVENT"| filter event.type == "change"| summarize {started = takeMax(if(event.status == "opened", toTimestamp(start_time))),finished = takeMax(if(event.status == "merged", toTimestamp(end_time)))}, by: {vcs.repository.change.id}| fieldsAdd duration = finished - started| summarize avg_time_to_merge = avg(duration)
This example derives the percentage of failed release validations in the last month.
pass
, warning
, fail
, or error
.The metric below yields a single numerical value displayed as a Single value or a Record list.
fetch events, from:now()-7d, to:now()| filter event.kind == "SDLC_EVENT"| filter event.type == "validation"| filter event.status == "finished"| summarize {failed = countIf(validation.status == "fail"),all = countIf(validation.status != "error")}| fields failed_validation_rate = (failed * 100 / all)
This query shows the distribution of pipeline executions by 2-minute buckets of the last week. To see how many pipelines took 0-2, 2-4, 4-6 minutes, and so on.
The Categorical chart is the best choice for displaying this data in columns showing the number of pipelines for each bucket.
fetch events, from:now()-7d, to:now()| filter event.kind == "SDLC_EVENT"| filter event.category == "pipeline"| filter event.status == "finished"| summarize numberOfPipelines = count(), by:{pipelineDuration = bin(toLong(duration), 120)}| fields pipelineDuration = concat(toString(toLong(pipelineDuration)), " - ", toString(toLong(pipelineDuration + 120))), numberOfPipelines