prometheus/cloudwatch_exporter

Distinguishing metrics by tag

80kk opened this issue · 4 comments

80kk commented

Is it possible to have signle dimension defined multiple times for example with tag selection and without?
Lets say:

config: |-
  region: eu-west-1
  period_seconds: 240
  metrics:
  - aws_dimensions:
    - QueueName
    aws_metric_name: NumberOfMessagesSent
    aws_namespace: AWS/SQS
    aws_statistics: [Sum, SampleCount, Minimum, Maximum, Average]
---

and:

config: |-
  region: eu-west-1
  period_seconds: 240
  metrics:
  - aws_dimensions:
    - QueueName
    aws_metric_name: NumberOfMessagesSent
    aws_namespace: AWS/SQS
    aws_statistics: [Sum, SampleCount, Minimum, Maximum, Average]
   aws_tag_select:
     tag_selections:
       Monitoring: ["enabled"]
---

The reason I am asking is that I want to differentiate alert route in Grafana and send notification to Slack only or both to Slack and PagerDuty if particular queue has a desired tag.

This is an interesting use case! Unfortunately I don't think this solution would work. We would have to add the tag value as a label on the metric, which is unfortunately not something we support. You may be interested in the other CloudWatch exporter which includes this as a headline feature.

I am somewhat hesitant about adding this feature to CWE (this exporter), considering YACE has it. This exporter is more "pure" in that it really (almost) only translates CloudWatch without trying to know about all the different AWS services and how their tagging interacts with the CloudWatch metric. Even supporting tag selections results in an endless stream of "but how do I use it for this particular metric" questions 😅

I updated the labels and title to reflect the use case you are asking about.

@matthiasr Checking in - does that mean that it is currently impossible for my metric to contain information about the tags of the resource it is scraping?

This would definitely be one of my top feature asks. We have a set of nat gateways in our account, and we want to bucket them by category of network infrastructure that they belong to, which is currently indicated by a tag on the natgateway.

Correct – if you need this, use YACE instead. It is designed to understand AWS beyond CloudWatch, which this exporter is not.

I am not totally opposed – if someone comes up with a proposal how we could generically do this, what it would look like in configuration, and what the implementation would look like, we can talk about it. I'll leave this issue open for another few months as an invitation 😄