2

I have a Spring Boot microservice (Spring Cloud Gateway) deployed on AWS EKS. It sends metrics to CloudWatch, but I can't figure out how to define an alert on an aggregate metric. This is a sample of the metrics:

Spring Cloud Gateway metrics

I added a custom tag ("instanceId") which provides the instance identifier of the pod:

@Bean
public MeterRegistryCustomizer<CloudWatchMeterRegistry> cloudWatchMetricsCommonTags() {
    return (registry) -> registry.config().commonTags("instanceId", EC2MetadataUtils.getInstanceId());
}

This query provides the slowest request:

SELECT MAX("spring.cloud.gateway.requests.max") FROM "tas-gpp-gateway"

Max graph

But it seems to be impossible define an alert on it. I found this issue, but I can't provide all possible metric dimensions because outcome, httpMethod and instanceId have many different values. In fact, according to the documentation, you should:

  • provide a set of metrics
  • define a math expression using the metrics
  • create an alert based on the math expression

For example:

enter image description here

But this is not an option, because I can't list all the possible dimensions of the metric spring.cloud.gateway.requests.max.

Claudio Tasso
  • 417
  • 5
  • 13

0 Answers0