private boolean metricIsInAwsTagSelect(
      MetricRule rule, List<String> tagBasedResourceIds, Metric metric) {
    if (rule.awsTagSelect.tagSelections == null) {
      return true;
    }
    for (Dimension dimension : metric.dimensions()) {
      String dimensionName = dimension.name();
      String dimensionValue = dimension.value();
      if (rule.awsTagSelect.resourceIdDimension.equals(dimensionName)
          && !tagBasedResourceIds.contains(dimensionValue)) {
        return false;
      }
    }
    return true;
  }
Check if a metric is matched in `aws_tag_select`
src/main/java/io/prometheus/cloudwatch/DefaultDimensionSource.java