From c97e3d048748d5f322ca3a9f2cf1f9234de38681 Mon Sep 17 00:00:00 2001 From: Jimmy Royer Date: Wed, 20 Nov 2024 16:48:27 -0500 Subject: [PATCH 1/2] Added query to fetch gunicorn total time --- aws/eks/cloudwatch_queries.tf | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/aws/eks/cloudwatch_queries.tf b/aws/eks/cloudwatch_queries.tf index 2b3ea4fac..97aa2fd96 100644 --- a/aws/eks/cloudwatch_queries.tf +++ b/aws/eks/cloudwatch_queries.tf @@ -220,6 +220,22 @@ fields @timestamp, log, kubernetes.container_name as app, kubernetes.pod_name as QUERY } +resource "aws_cloudwatch_query_definition" "api-gunicorn-total-time" { + count = var.cloudwatch_enabled ? 1 : 0 + name = "API / GUnicorn total running time" + + log_group_names = [ + local.eks_application_log_group + ] + + query_string = <.*?) seconds/ +| order by @timestamp asc +| display @timestamp, @gunicorn_time +QUERY +} + resource "aws_cloudwatch_query_definition" "bounce-rate-critical" { count = var.cloudwatch_enabled ? 1 : 0 name = "Bounces / Critical bounces" From 4f782c23e98b86993cde48814bae94aaac57d3f9 Mon Sep 17 00:00:00 2001 From: Jimmy Royer Date: Wed, 20 Nov 2024 17:38:16 -0500 Subject: [PATCH 2/2] Updated query for latest log message --- aws/eks/cloudwatch_queries.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/eks/cloudwatch_queries.tf b/aws/eks/cloudwatch_queries.tf index 97aa2fd96..76cbd9046 100644 --- a/aws/eks/cloudwatch_queries.tf +++ b/aws/eks/cloudwatch_queries.tf @@ -230,7 +230,7 @@ resource "aws_cloudwatch_query_definition" "api-gunicorn-total-time" { query_string = <.*?) seconds/ +| parse @message /Total gunicorn API running time: (?<@gunicorn_time>.*?) seconds/ | order by @timestamp asc | display @timestamp, @gunicorn_time QUERY