cloudwatch_exporter icon indicating copy to clipboard operation
cloudwatch_exporter copied to clipboard

[bug]: Not able to fetch metrics when tagging enabled.

Open shubhadaR opened this issue 1 year ago • 5 comments

we tried to use AWS tag select feature However we only got aws_resource_info with tags but not aws resource metric.

config.yaml

region: ap-south-1
delay_seconds: 10
use_get_metric_data: false
metrics:
- aws_namespace: AWS/ELB
   use_get_metric_data: false
   aws_metric_name: RequestCount
   aws_dimensions: [AvailabilityZone, LoadBalancerName]
   aws_tag_select:
     tag_selections:
       Monitoring: ["enabled"]
     resource_type_selection: "elasticloadbalancing:loadbalancer"
     resource_id_dimension: LoadBalancerName
   aws_statistics: [Sum]
- aws_namespace: AWS/ELB
   use_get_metric_data: false
   aws_metric_name: RequestCount
   aws_dimensions: [AvailabilityZone, LoadBalancerName]
   aws_statistics: [Sum]

shubhadaR avatar Sep 05 '23 08:09 shubhadaR

I believe I'm seeing similar issue with apigateway.

config:

metrics:
  - aws_namespace: AWS/ApiGateway
    aws_metric_name: 5XX
    aws_statistics: [Sum]
    aws_dimensions: [ApiId]
    aws_tag_select:
      tag_selections:
        Product: ["ABC"]
      resource_type_selection: "apigateway:apis"
      resource_id_dimension: ApiId

Then only aws_resource_info metric is returned. But that metric seems to have incorrect api_id label. Because it does not have only api gateway Id as value, but also apis prefix:

aws_resource_info{job="aws_apigateway",instance="",arn="arn:aws:apigateway:us-east-1::/apis/XXX",api_id="apis/XXX",tag_Product="ABC"} 1.0

klubi avatar Sep 05 '23 11:09 klubi

@shubhadaR take a look here.

JesusFrontelo avatar Sep 06 '23 06:09 JesusFrontelo

Interesting, so we've started getting prefixes in the ID dimension during tag selection, but the would need to strip them out when fetching the metrics?

matthiasr avatar Sep 06 '23 08:09 matthiasr

#571 has an explanation how to work around this. #648 is also related to the tag format issues, although I don't fully understand whether it will address the need for the workaround.

matthiasr avatar Mar 03 '24 14:03 matthiasr

@matthiasr i think this issue can be closed, because seems to be a configuration understanding.

JesusFrontelo avatar May 14 '24 14:05 JesusFrontelo