From d2c7ead6b583bd53b3c710ebe1510b541c19a4fe Mon Sep 17 00:00:00 2001 From: Puneeth Date: Thu, 20 Jan 2022 19:48:38 +0100 Subject: [PATCH] Expand lambda metrics in SFN + APIG + Increase refresh interval (#51) --- lib/api_gateways.py | 4 +++- lib/commons.py | 1 + lib/ecs.py | 14 ++------------ lib/elasticache_redis.py | 6 ++---- lib/elasticsearch.py | 7 ++----- lib/lambdas.py | 2 ++ lib/rds.py | 6 ++---- lib/step_functions.py | 5 +++-- 8 files changed, 17 insertions(+), 28 deletions(-) diff --git a/lib/api_gateways.py b/lib/api_gateways.py index ee66da6..4dcf632 100644 --- a/lib/api_gateways.py +++ b/lib/api_gateways.py @@ -19,6 +19,7 @@ from lib.commons import ( ALERT_REF_ID, ALERT_THRESHOLD, + DEFAULT_REFRESH, EDITABLE, SHARED_CROSSHAIR, TIMEZONE, @@ -164,7 +165,7 @@ def generate_api_gateways_dashboard( lambda_metrics_row = Row( title="{} Lambda Metrics".format(l), showTitle=True, - collapse=True, + collapse=False, panels=[ lambda_generate_invocations_graph( name, cloudwatch_data_source, notifications=[] @@ -199,5 +200,6 @@ def generate_api_gateways_dashboard( tags=tags, timezone=TIMEZONE, sharedCrosshair=SHARED_CROSSHAIR, + refresh=DEFAULT_REFRESH, rows=rows, ).auto_panel_ids() diff --git a/lib/commons.py b/lib/commons.py index ad3c2ad..730ba23 100644 --- a/lib/commons.py +++ b/lib/commons.py @@ -6,6 +6,7 @@ TRANSPARENT = True RAW_QUERY = True RETENTION_POLICY = "autogen" +DEFAULT_REFRESH = "1m" def get_documentation_link(url: str): diff --git a/lib/ecs.py b/lib/ecs.py index 47f49ce..c22d60f 100644 --- a/lib/ecs.py +++ b/lib/ecs.py @@ -5,7 +5,6 @@ from grafanalib.core import ( Alert, AlertCondition, - AlertList, Dashboard, Graph, GreaterThan, @@ -25,6 +24,7 @@ from lib.commons import ( ALERT_REF_ID, ALERT_THRESHOLD, + DEFAULT_REFRESH, EDITABLE, SHARED_CROSSHAIR, TIMEZONE, @@ -95,17 +95,6 @@ def generate_running_count_stats_panel( ) -# def generate_alert_list_panel(name: str, grid_pos: GridPos): -# return AlertList( -# title="Alerts: {}".format(name), -# gridPos=grid_pos, -# description="Alerts for service {}".format(name), -# transparent=TRANSPARENT, -# onlyAlertsOnDashboard=True, -# show=True -# ) - - def generate_cpu_utilization_graph( name: str, cloudwatch_data_source: str, @@ -793,4 +782,5 @@ def generate_ecs_alb_service_dashboard( timezone=TIMEZONE, sharedCrosshair=SHARED_CROSSHAIR, panels=panels, + refresh=DEFAULT_REFRESH, ).auto_panel_ids() diff --git a/lib/elasticache_redis.py b/lib/elasticache_redis.py index 092c114..e3cd6bf 100644 --- a/lib/elasticache_redis.py +++ b/lib/elasticache_redis.py @@ -9,17 +9,13 @@ Dashboard, LowerThan, Graph, - GreaterThan, MILLISECONDS_FORMAT, OP_OR, PERCENT_FORMAT, - Repeat, Row, RTYPE_MAX, SHORT_FORMAT, Target, - Template, - Templating, TimeRange, single_y_axis, YAxes, @@ -33,6 +29,7 @@ from lib import colors from lib.commons import ( ALERT_REF_ID, + DEFAULT_REFRESH, EDITABLE, SHARED_CROSSHAIR, TIMEZONE, @@ -626,4 +623,5 @@ def generate_elasticache_redis_dashboard( sharedCrosshair=SHARED_CROSSHAIR, rows=rows, links=[DOCUMENTATION_LINK], + refresh=DEFAULT_REFRESH, ).auto_panel_ids() diff --git a/lib/elasticsearch.py b/lib/elasticsearch.py index 8780207..ac0c1d3 100644 --- a/lib/elasticsearch.py +++ b/lib/elasticsearch.py @@ -12,13 +12,10 @@ GreaterThan, OP_OR, PERCENT_FORMAT, - Repeat, Row, RTYPE_MAX, SHORT_FORMAT, Target, - Template, - Templating, TimeRange, single_y_axis, YAxes, @@ -32,9 +29,8 @@ from lib import colors from lib.commons import ( ALERT_REF_ID, + DEFAULT_REFRESH, EDITABLE, - RAW_QUERY, - RETENTION_POLICY, SHARED_CROSSHAIR, TIMEZONE, TRANSPARENT, @@ -727,4 +723,5 @@ def generate_elasticsearch_dashboard( sharedCrosshair=SHARED_CROSSHAIR, rows=rows, links=[DOCUMENTATION_LINK], + refresh=DEFAULT_REFRESH, ).auto_panel_ids() diff --git a/lib/lambdas.py b/lib/lambdas.py index 2ec84b9..a33f949 100644 --- a/lib/lambdas.py +++ b/lib/lambdas.py @@ -25,6 +25,7 @@ from lib.commons import ( ALERT_REF_ID, ALERT_THRESHOLD, + DEFAULT_REFRESH, EDITABLE, SHARED_CROSSHAIR, TIMEZONE, @@ -710,4 +711,5 @@ def lambda_sns_sqs_dashboard( panels=[dead_letter_sqs_graph], ), ], + refresh=DEFAULT_REFRESH, ).auto_panel_ids() diff --git a/lib/rds.py b/lib/rds.py index f516c41..2fffdff 100644 --- a/lib/rds.py +++ b/lib/rds.py @@ -18,8 +18,6 @@ TimeRange, Row, Target, - YAxes, - YAxis, ) from grafanalib.formatunits import BYTES, BYTES_SEC, SECONDS from grafanalib.cloudwatch import CloudwatchMetricsTarget @@ -28,11 +26,10 @@ from lib.annotations import get_release_annotations from lib.commons import ( ALERT_REF_ID, + DEFAULT_REFRESH, EDITABLE, get_documentation_link, get_series_overrides, - RAW_QUERY, - RETENTION_POLICY, SHARED_CROSSHAIR, TIMEZONE, TRANSPARENT, @@ -562,4 +559,5 @@ def generate_rds_dashboard( "https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MonitoringOverview.html" ) ], + refresh=DEFAULT_REFRESH, ).auto_panel_ids() diff --git a/lib/step_functions.py b/lib/step_functions.py index c64e3e2..e354cda 100644 --- a/lib/step_functions.py +++ b/lib/step_functions.py @@ -16,9 +16,9 @@ ) from grafanalib.cloudwatch import CloudwatchMetricsTarget -from lib.annotations import get_release_annotations from lib.commons import ( ALERT_THRESHOLD, + DEFAULT_REFRESH, EDITABLE, SHARED_CROSSHAIR, TIMEZONE, @@ -315,7 +315,7 @@ def generate_sfn_dashboard( lambda_metrics_row = Row( title="{} Lambda Metrics".format(l), showTitle=True, - collapse=True, + collapse=False, panels=[ lambda_generate_invocations_graph( l, cloudwatch_data_source, notifications=[] @@ -351,4 +351,5 @@ def generate_sfn_dashboard( timezone=TIMEZONE, sharedCrosshair=SHARED_CROSSHAIR, rows=rows, + refresh=DEFAULT_REFRESH, ).auto_panel_ids()