Skip to content

Commit

Permalink
added .inc in request counter
Browse files Browse the repository at this point in the history
  • Loading branch information
saumya4751 committed Dec 17, 2024
1 parent ec69856 commit 5f90852
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions caption_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2616,17 +2616,17 @@ def after_request(response):
f"User-Agent: {user_agent}, Query: {query_params}, Payload: {payload}"
)

if endpoint != "/metrics":
if endpoint != "/metrics" and endpoint != "/favicon.ico":
endpoint_parts = endpoint.split('/')
if len(endpoint_parts) > 3:
normalized_endpoint = '/'.join(endpoint_parts[:3])
if len(endpoint_parts) > 4:
normalized_endpoint = '/'.join(endpoint_parts[:4])
else:
normalized_endpoint = endpoint

REQUEST_COUNTER_JUST_ENDPOINT.labels(
client_ip=client_ip,
endpoint=normalized_endpoint
)
).inc()

REQUEST_COUNTER.labels(
method=method,
Expand Down

0 comments on commit 5f90852

Please sign in to comment.