Body:
I am trying to visualize CI test results that I uploaded in JUnit XML format.I have two data sources available ci_tests and ci_pipelines, both containing a status variable.
My requirement is to display a pie chart showing the test result distribution (pass/fail/skip) of only the last build run based on the time window selected by the user.
However, my current query shows accumulated test results across multiple builds, even if multiple builds ran on the same day.
Here’s the JSON query I tried:
{
"title": "Last Build Status",
"requests": [
{
"response_format": "scalar",
"queries": [
{
"name": "query1",
"data_source": "ci_tests",
"search": {
"query": "test_level:test @test.name:* @test.suite:TEMI*"
},
"indexes": ["*"],
"group_by": [
{
"facet": "@test.status",
"limit": 1000,
"sort": {
"aggregation": "count",
"order": "desc",
"metric": "count"
},
"should_exclude_missing": true
}
],
"compute": {
"aggregation": "cardinality",
"metric": "@test.name"
},
"storage": "hot"
}
],
"style": {
"palette": "semantic"
},
"formulas": [
{ "formula": "query1" }
],
"sort": {
"count": 1000,
"order_by": [
{
"type": "formula",
"index": 0,
"order": "desc"
}
]
}
}
],
"type": "sunburst",
"legend": { "type": "automatic" }
}
This visualization works but shows cumulative results instead of just the latest build results.
How can I modify my Datadog dashboard query (or add filters) so that the pie chart reflects only the most recent build’s test results, rather than cumulative data from multiple builds?