Reputation: 2589
I am doing a union operation on two datapoints.
database_bootstrapping{instance="host1",job="db"}!=0. no data
absent(database_bootstrapping{instance="host1",job="db"}).
Query is
database_bootstrapping{instance="host1",job="db"}!=0 or absent(database_bootstrapping{instance="host1",job="db"})
Result is
{instance="host1",job="db"}. 1
What I want is
database_bootstrapping{instance="host1",job="db"} 1
How can I retain the ____metric____ label name in the query output?
Upvotes: 0
Views: 1217
Reputation: 2589
https://prometheus.io/docs/prometheus/latest/querying/functions/#label_replace
label_replace(database_bootstrapping{instance="host1",job="db"}!=0 or absent(database_bootstrapping{instance="host1",job="db"}), "__name", "database_bootstrapping")
Upvotes: 1