Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional operators usage in Datadog dashboard queries #19301

Open
sravani-64 opened this issue Dec 23, 2024 · 0 comments
Open

Conditional operators usage in Datadog dashboard queries #19301

sravani-64 opened this issue Dec 23, 2024 · 0 comments

Comments

@sravani-64
Copy link

Discussed in #19300

Originally posted by sravani-64 December 23, 2024
Hi team,
As a part of developing Aerospike integration dashboards, we need to create a query using conditional operators such as IF, OR. But we are not able to replicate the exact query as similar to Grafana.
Grafana's query:
(sum( # Running individual exporter for each node in a cluster
(avg by (ns) ( aerospike_namespace_ns_cluster_size {job="$job_name", } ))
== bool
(count by (ns) (aerospike_namespace_ns_cluster_size {job="$job_name", } ))
)> bool 0) * # migration check with RX metric
(sum((sum by (ns) (aerospike_namespace_migrate_rx_partitions_remaining + aerospike_namespace_migrate_tx_partitions_remaining) != bool 0))
== bool 0) * # Consistent Effective Replication factor across all nodes
(sum(
min by (ns) (aerospike_namespace_effective_replication_factor {job="$job_name", })
== bool
max by (ns) (aerospike_namespace_effective_replication_factor {job="$job_name", })
) > bool 0)

Query tried in Datadog:
{
"title": "Cluster - Historical - Usage Bytes",
"type": "query_value",
"requests": [
{
"formulas": [
{
"formula": "((count_nonzero(query1) / count_nonzero(query2)) * (abs(count_nonzero(query3) + count_nonzero(query4)) + 1) * (count_nonzero(query5) / count_nonzero(query6)) * (query7 / query8) / query9) - (query10 * 39)"
}
],
"queries": [
{
"name": "query1",
"data_source": "metrics",
"query": "avg:aerospike.aerospike_namespace_ns_cluster_size{$aerospike_cluster}",
"aggregator": "last"
},
{
"name": "query2",
"data_source": "metrics",
"query": "count:aerospike.aerospike_namespace_ns_cluster_size{$aerospike_cluster}",
"aggregator": "last"
},
{
"name": "query3",
"data_source": "metrics",
"query": "sum:aerospike.aerospike_namespace_migrate_rx_partitions_remaining{$aerospike_cluster}",
"aggregator": "last"
},
{
"name": "query4",
"data_source": "metrics",
"query": "sum:aerospike.aerospike_namespace_migrate_tx_partitions_remaining{$aerospike_cluster}",
"aggregator": "last"
},
{
"name": "query5",
"data_source": "metrics",
"query": "min:aerospike.aerospike_namespace_effective_replication_factor{$aerospike_cluster}",
"aggregator": "last"
},
{
"name": "query6",
"data_source": "metrics",
"query": "max:aerospike.aerospike_namespace_effective_replication_factor{$aerospike_cluster}",
"aggregator": "last"
},
{
"name": "query7",
"data_source": "metrics",
"query": "sum:aerospike.aerospike_namespace_data_used_bytes{$aerospike_cluster}",
"aggregator": "last"
},
{
"name": "query8",
"data_source": "metrics",
"query": "avg:aerospike.aerospike_namespace_effective_replication_factor{$aerospike_cluster}",
"aggregator": "last"
},
{
"name": "query9",
"data_source": "metrics",
"query": "avg:aerospike.aerospike_namespace_data_compression_ratio{$aerospike_cluster}",
"aggregator": "last"
},
{
"name": "query10",
"data_source": "metrics",
"query": "sum:aerospike.aerospike_namespace_master_objects{$aerospike_cluster}",
"aggregator": "last"
}
],
"response_format": "scalar",
"conditional_formats": [
{
"comparator": ">=",
"value": 0,
"palette": "white_on_green"
}
]
}
],
"autoscale": true,
"text_align": "center",
"custom_links": [],
"precision": 2,
"timeseries_background": {
"type": "area",
"yaxis": {
"include_zero": true
}
}
}

But the above Datadog query does not fetch the required output, can someone please help in understanding the usage of conditional functions in Datadog queries?
Thank you
cc @ @gandham-santhosh @srikanth-6520 @raj-Optit @VENKATA-SIVA-OPTIT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant