Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
13d211ed
Unverified
Commit
13d211ed
authored
6 years ago
by
Will Hunt
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #3344 from Half-Shot/hs/as-metrics
Add metrics to track appservice transactions
parents
1152f495
d6e3c2c7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/appservice/api.py
+22
-0
22 additions, 0 deletions
synapse/appservice/api.py
with
22 additions
and
0 deletions
synapse/appservice/api.py
+
22
−
0
View file @
13d211ed
...
...
@@ -24,8 +24,27 @@ from synapse.types import ThirdPartyInstanceID
import
logging
import
urllib
from
prometheus_client
import
Counter
logger
=
logging
.
getLogger
(
__name__
)
sent_transactions_counter
=
Counter
(
"
synapse_appservice_api_sent_transactions
"
,
"
Number of /transactions/ requests sent
"
,
[
"
service
"
]
)
failed_transactions_counter
=
Counter
(
"
synapse_appservice_api_failed_transactions
"
,
"
Number of /transactions/ requests that failed to send
"
,
[
"
service
"
]
)
sent_events_counter
=
Counter
(
"
synapse_appservice_api_sent_events
"
,
"
Number of events sent to the AS
"
,
[
"
service
"
]
)
HOUR_IN_MS
=
60
*
60
*
1000
...
...
@@ -219,12 +238,15 @@ class ApplicationServiceApi(SimpleHttpClient):
args
=
{
"
access_token
"
:
service
.
hs_token
})
sent_transactions_counter
.
labels
(
service
.
id
).
inc
()
sent_events_counter
.
labels
(
service
.
id
).
inc
(
len
(
events
))
defer
.
returnValue
(
True
)
return
except
CodeMessageException
as
e
:
logger
.
warning
(
"
push_bulk to %s received %s
"
,
uri
,
e
.
code
)
except
Exception
as
ex
:
logger
.
warning
(
"
push_bulk to %s threw exception %s
"
,
uri
,
ex
)
failed_transactions_counter
.
labels
(
service
.
id
).
inc
()
defer
.
returnValue
(
False
)
def
_serialize
(
self
,
events
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment