Skip to content

Commit

Permalink
Add prometheus client counter
Browse files Browse the repository at this point in the history
  • Loading branch information
idrissneumann committed Mar 10, 2024
1 parent 48f8979 commit 527d9ff
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/utils/counter.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
from prometheus_client import Counter

from utils.otel import get_otel_meter

def create_counter(name, description):
return get_otel_meter().create_counter(
name = name,
description = description,
unit = "1"
)
return {
'otel': get_otel_meter().create_counter(
name = name,
description = description,
unit = "1"
),
'prom': Counter(name, description)
}

def increment_counter(counter, tid):
counter.add(1, {"tid": tid})
counter['otel'].add(1, {"tid": tid})
counter['prom'].inc()

0 comments on commit 527d9ff

Please sign in to comment.