Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add prometheus counters for content types other than events (#13175)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradtgmurray authored Jul 13, 2022
1 parent 4db7862 commit 3371e1a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/13175.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add prometheus counters for ephemeral events and to device messages pushed to app services. Contributed by Brad @ Beeper.
14 changes: 14 additions & 0 deletions synapse/appservice/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@
"synapse_appservice_api_sent_events", "Number of events sent to the AS", ["service"]
)

sent_ephemeral_counter = Counter(
"synapse_appservice_api_sent_ephemeral",
"Number of ephemeral events sent to the AS",
["service"],
)

sent_todevice_counter = Counter(
"synapse_appservice_api_sent_todevice",
"Number of todevice messages sent to the AS",
["service"],
)

HOUR_IN_MS = 60 * 60 * 1000


Expand Down Expand Up @@ -310,6 +322,8 @@ async def push_bulk(
)
sent_transactions_counter.labels(service.id).inc()
sent_events_counter.labels(service.id).inc(len(serialized_events))
sent_ephemeral_counter.labels(service.id).inc(len(ephemeral))
sent_todevice_counter.labels(service.id).inc(len(to_device_messages))
return True
except CodeMessageException as e:
logger.warning(
Expand Down

0 comments on commit 3371e1a

Please sign in to comment.