diff --git a/src/main/java/io/prometheus/cloudwatch/CloudWatchCollector.java b/src/main/java/io/prometheus/cloudwatch/CloudWatchCollector.java index 71ff755c..f5ea9a79 100644 --- a/src/main/java/io/prometheus/cloudwatch/CloudWatchCollector.java +++ b/src/main/java/io/prometheus/cloudwatch/CloudWatchCollector.java @@ -639,8 +639,12 @@ private void scrape(List mfs) { // "tag_" prefix // The AWS tags are case sensitive, so to avoid loosing information and label // collisions, tag keys are not snaked cased - labelNames.add("tag_" + safeLabelName(tag.key())); - labelValues.add(tag.value()); + String labelName = "tag_" + safeLabelName(tag.key()); + // If multiple labels end up with the same safe label name, use only the first + if (!labelNames.contains(labelName)) { + labelNames.add(labelName); + labelValues.add(tag.value()); + } } infoSamples.add(