Reputation: 105
I have a counting metric in DataDog, that has positive and negative counts. When using a "timeseries" visualization to show only the positive counts, I simply just apply a clamp_min(query1, 0)
, and it works.
Essentially, the JSON looks like below for the "timeseries"
{
"viz": "timeseries",
"requests": [
{
"style": {
"palette": "dog_classic",
"type": "solid",
"width": "normal"
},
"type": "line",
"formulas": [
{
"formula": "clamp_min(query1, 0)"
}
],
"response_format": "timeseries",
"queries": [
{
"query": "sum:my_counting_metric.as_count()",
"data_source": "metrics",
"name": "query1"
}
]
}
]
}
When I try to do this same thing, and aggregate all these positive numbers that I've filtered for on a "query_value" viz, I can't find a single way to do anything similar because it sums all the counts to a number before making it possible to apply filters like clamp_min
above. Ideally, I would like to do something like below if possible.
{
"viz": "query_value",
"requests": [
{
"response_format": "scalar",
"formulas": [
{
"formula": "query1"
}
],
"queries": [
{
"query": "sum:clamp_min(my_counting_metric.as_count(), 0)",
"data_source": "metrics",
"name": "query1",
"aggregator": "avg"
}
]
}
],
"precision": 2,
"autoscale": true
}
Is there any way to do this? I'm feeling pretty stuck and would greatly appreciate any help! 🙏🏻
Upvotes: 1
Views: 2679
Reputation: 105
I was able to get in contact with DataDog on this question.
They basically told me this behavior mentioned in my post is expected because the "query_value" viz runs a procedure called point reduction. This is why the clamp_min
function had no effect. To put it short, there's not a way to filter/map before the execution of the initial aggregating function on a "query_value" viz.
Upvotes: 1