I've deployed the official Amazon Cloudwatch exporter (
https://github.com/prometheus/cloudwatch_exporter)[1] and I'm satisfied with the metrics offered by the exporter, and when I instruct Prometheus to pick up the metrics from this exporter, Prometheus says it successfully picked up all the metrics (`scrape_samples_scraped` matches `curl -s localhost:9106/metrics |grep -cv \#`)
... but when I ask Prometheus for the metrics, almost all of them are missing.
I've been at this for a few days now and I am stumped. I hope someone else has encountered this problem before.
```
cloudwatch_requests_total 64.0
aws_usage_call_count_maximum{job="aws_usage",instance="",type="API",resource="ListMetrics",service="CloudWatch",class="None",} 1.0 1567009560000
aws_usage_call_count_maximum{job="aws_usage",instance="",type="API",resource="GetMetricStatistics",service="CloudWatch",class="None",} 1.0 1567009560000
aws_usage_call_count_average{job="aws_usage",instance="",type="API",resource="ListMetrics",service="CloudWatch",class="None",} 1.0 1567009560000
aws_usage_call_count_average{job="aws_usage",instance="",type="API",resource="GetMetricStatistics",service="CloudWatch",class="None",} 1.0 1567009560000
cloudwatch_exporter_scrape_duration_seconds 0.0508605
cloudwatch_exporter_scrape_error 0.0
```
so far so good. having "job" as a label, and an explicitly empty "instance" label are weird, but this is the official exporter so I guess they know what they're doing.
Prometheus config to scrape this exporter is:
```
---
global: null
alerting: {alertmangers: null}
rule_files: null
scrape_configs:
- job_name: aws-cloudwatch
static_configs:
- { targets: ['localhost:9106'] }
```
after waiting a minute, when I ask prometheus for metrics:
```
$ curl -gs 'localhost:9090/api/v1/query?query=scrape_samples_scraped{job="aws-cloudwatch"}' |jq -rS '.data.result[]|"\(.metric.__name__) \(.value[1])"'`
scrape_samples_scraped 7
```
seven lines from the exporter, 7 scrape samples scraped, looks good. So now I try to get one of the metrics:
```
curl -gs 'localhost:9090/api/v1/query?query=aws_usage_call_count_maximum'
{"status":"success","data":{"resultType":"vector","result":[]}}
```
Empty. But if I ask for the only three metrics that don't have job/instance labels i.e. cloudwatch_requests_total
```
curl -gs 'localhost:9090/api/v1/query?query=cloudwatch_requests_total' |jq .data.result[0]
{
"metric": {
"__name__": "cloudwatch_requests_total",
"instance": "localhost:9106",
"job": "aws-cloudwatch-AWS"
},
"value": [ 1567010659.893, "88" ]
}
```
There it is.
What am I doing wrong here that's causing prometheus to pick up 7 metrics but only keep 3 of them? I launched prometheus with --log.level=info and I don't see error messages by prometheus.