Skip to content

Commit

Permalink
added grouping key to pushgateway call
Browse files Browse the repository at this point in the history
  • Loading branch information
danwagoner committed Feb 26, 2024
1 parent e6a3c8f commit 197f4c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import time
from botocore.exceptions import ClientError
from aws_lambda_powertools.utilities import parameters
from prometheus_client import CollectorRegistry, Gauge, Counter, push_to_gateway
from prometheus_client import CollectorRegistry, Gauge, Counter, pushadd_to_gateway

session = boto3.session.Session()
pushgateway_host = os.environ.get('PUSHGATEWAY_HOST')
Expand Down Expand Up @@ -40,5 +40,5 @@ def lambda_handler(event, context):
metric_request_total.labels(environment=full_env, event=str(event), status=resp.status_code).inc()
metric_runtime = Gauge('queue_scheduled_lambda_runtime_milliseconds', 'Total runtime of the lambda in milliseconds', ['environment', 'event'], registry=registry)
metric_runtime.labels(environment=full_env, event=str(event)).set(round((end_time - start_time)*1000))
push_to_gateway(pushgateway_host, job='lambda', registry=registry)
pushadd_to_gateway(pushgateway_host, grouping_key={'event': str(event)}, job='lambda', registry=registry)

0 comments on commit 197f4c3

Please sign in to comment.