Skip to content

Commit

Permalink
Merge pull request #9 from infinite-options/ss_1209
Browse files Browse the repository at this point in the history
added .inc in request counter
  • Loading branch information
saumya4751 authored Dec 17, 2024
2 parents d5d9dbc + 5f90852 commit f32a0d6
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 f32a0d6

Please sign in to comment.