I am trying to filter the pending pods in one of the clusters and also only from any of the two namespaces, so I have written query like mentioned below,
I am getting null values as series, If there are no pending pods, I do expect that the query does not return any record.
Usually I take the last item from the array and consider that as the current state.
Am I missing anything here?
Query Used:
timeseries series=sum(dt.kubernetes.pods), by:{k8s.workload.name,k8s.namespace.name,k8s.cluster.name,pod_phase}
| filter k8s.cluster.name == “<myclustername>” and (startsWith(k8s.namespace.name, “<startofmynamespace1>”) or contains(k8s.namespace.name, “<substringmynamespace2>”)) and pod_phase == “Pending”
Result:
{
“series”: [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
“k8s.workload.name”: “<myworkloadname>”,
“k8s.namespace.name”: “<mynamespace1>”,
“k8s.cluster.name”: “<Mycluster>”,
“pod_phase”: “Pending”,
“timeframe”: {
“start”: “2023-07-18T10:19:00.000Z”,
“end”: “2023-07-18T10:30:00.000Z”
},
“interval”: “60000000000”
}