-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add metrics about Matrix API calls #68
Add metrics about Matrix API calls #68
Conversation
N.B. I think |
mautrix/api.py
Outdated
"The number of Matrix client API calls made", ("method",)) | ||
API_CALLS_FAILED = Counter("bridge_matrix_api_calls_failed", | ||
"The number of Matrix client API calls which failed", ("method",)) | ||
MATRIX_REQUEST_SECONDS = Histogram("bridge_matrix_request_seconds", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In practise I think we got this wrong. The IRC/Slack bridges use this name to mean requests coming from matrix and the outcome (e.g. did we fail to send a message to IRC, how long did it take).
We found this out when the change got deployed and alerts kept firing because we wern't doing this enough.
I'd propose that we move this Histogram to the event handling portion of the library and report the ourtcome of a processed AS event from a transaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only incorrect metric is bridge_matrix_request_seconds
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the others look fine!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed bridge_matrix_request_seconds
from this PR. I may come in another PR.
This is an alternative to #67.
This adds the following Prometheus metrics:
bridge_matrix_api_calls
Counter: Number of API calls madebridge_matrix_api_calls_failed
Counter: Number of API calls which failedThe names and types have been chosen to match those of https://github.com/matrix-org/matrix-appservice-bridge.
Incomplete list of things which could be improved
method
labels to other parts of the API, not justevents.py
.Differences to PR #67
events.js
, however, all others have an empty string as themethod
label.bridge_matrix_request_seconds
s it was implemented differently from the NodeJS bridges.