Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
8f5a688d
Commit
8f5a688d
authored
6 years ago
by
Amber Brown
Browse files
Options
Downloads
Patches
Plain Diff
cleanups, self-registration
parent
a8990fa2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
synapse/handlers/presence.py
+4
-3
4 additions, 3 deletions
synapse/handlers/presence.py
synapse/http/request_metrics.py
+3
-12
3 additions, 12 deletions
synapse/http/request_metrics.py
synapse/replication/tcp/resource.py
+5
-4
5 additions, 4 deletions
synapse/replication/tcp/resource.py
with
12 additions
and
19 deletions
synapse/handlers/presence.py
+
4
−
3
View file @
8f5a688d
...
@@ -142,8 +142,9 @@ class PresenceHandler(object):
...
@@ -142,8 +142,9 @@ class PresenceHandler(object):
}
}
LaterGauge
(
LaterGauge
(
"
user_to_current_state_size
"
,
""
,
[],
lambda
:
len
(
self
.
user_to_current_state
)
"
synapse_handlers_presence_user_to_current_state_size
"
,
""
,
[],
).
register
()
lambda
:
len
(
self
.
user_to_current_state
)
)
now
=
self
.
clock
.
time_msec
()
now
=
self
.
clock
.
time_msec
()
for
state
in
active_presence
:
for
state
in
active_presence
:
...
@@ -212,7 +213,7 @@ class PresenceHandler(object):
...
@@ -212,7 +213,7 @@ class PresenceHandler(object):
60
*
1000
,
60
*
1000
,
)
)
LaterGauge
(
"
wheel_timer_size
"
,
""
,
[],
lambda
:
len
(
self
.
wheel_timer
))
.
register
()
LaterGauge
(
"
synapse_handlers_presence_
wheel_timer_size
"
,
""
,
[],
lambda
:
len
(
self
.
wheel_timer
))
@defer.inlineCallbacks
@defer.inlineCallbacks
def
_on_shutdown
(
self
):
def
_on_shutdown
(
self
):
...
...
This diff is collapsed.
Click to expand it.
synapse/http/request_metrics.py
+
3
−
12
View file @
8f5a688d
...
@@ -71,24 +71,14 @@ in_flight_requests_db_sched_duration = Counter("synapse_http_request_in_flight_r
...
@@ -71,24 +71,14 @@ in_flight_requests_db_sched_duration = Counter("synapse_http_request_in_flight_r
_in_flight_requests
=
set
()
_in_flight_requests
=
set
()
def
_collect_in_flight
():
"""
Called just before metrics are collected, so we use it to update all
the in flight request metrics
"""
for
rm
in
_in_flight_requests
:
rm
.
update_metrics
()
metrics
.
register_collector
(
_collect_in_flight
)
def
_get_in_flight_counts
():
def
_get_in_flight_counts
():
"""
Returns a count of all in flight requests by (method, server_name)
"""
Returns a count of all in flight requests by (method, server_name)
Returns:
Returns:
dict[tuple[str, str], int]
dict[tuple[str, str], int]
"""
"""
for
rm
in
_in_flight_requests
:
rm
.
update_metrics
()
# Map from (method, name) -> int, the number of in flight requests of that
# Map from (method, name) -> int, the number of in flight requests of that
# type
# type
...
@@ -99,6 +89,7 @@ def _get_in_flight_counts():
...
@@ -99,6 +89,7 @@ def _get_in_flight_counts():
return
counts
return
counts
LaterGauge
(
LaterGauge
(
"
synapse_http_request_metrics_in_flight_requests_count
"
,
""
,
"
synapse_http_request_metrics_in_flight_requests_count
"
,
""
,
[
"
method
"
,
"
servlet
"
],
[
"
method
"
,
"
servlet
"
],
...
...
This diff is collapsed.
Click to expand it.
synapse/replication/tcp/resource.py
+
5
−
4
View file @
8f5a688d
...
@@ -73,8 +73,8 @@ class ReplicationStreamer(object):
...
@@ -73,8 +73,8 @@ class ReplicationStreamer(object):
# Current connections.
# Current connections.
self
.
connections
=
[]
self
.
connections
=
[]
l
=
LaterGauge
(
"
synapse_replication_tcp_resource_total_connections
"
,
""
,
[],
lambda
:
len
(
self
.
connections
))
LaterGauge
(
"
synapse_replication_tcp_resource_total_connections
"
,
""
,
[],
l
.
register
(
)
lambda
:
len
(
self
.
connections
)
)
# List of streams that clients can subscribe to.
# List of streams that clients can subscribe to.
# We only support federation stream if federation sending hase been
# We only support federation stream if federation sending hase been
...
@@ -87,14 +87,15 @@ class ReplicationStreamer(object):
...
@@ -87,14 +87,15 @@ class ReplicationStreamer(object):
self
.
streams_by_name
=
{
stream
.
NAME
:
stream
for
stream
in
self
.
streams
}
self
.
streams_by_name
=
{
stream
.
NAME
:
stream
for
stream
in
self
.
streams
}
LaterGauge
(
LaterGauge
(
"
synapse_replication_tcp_resource_connections_per_stream
"
,
""
,
[
"
stream_name
"
],
"
synapse_replication_tcp_resource_connections_per_stream
"
,
""
,
[
"
stream_name
"
],
lambda
:
{
lambda
:
{
(
stream_name
,):
len
([
(
stream_name
,):
len
([
conn
for
conn
in
self
.
connections
conn
for
conn
in
self
.
connections
if
stream_name
in
conn
.
replication_streams
if
stream_name
in
conn
.
replication_streams
])
])
for
stream_name
in
self
.
streams_by_name
for
stream_name
in
self
.
streams_by_name
})
.
register
()
})
self
.
federation_sender
=
None
self
.
federation_sender
=
None
if
not
hs
.
config
.
send_federation
:
if
not
hs
.
config
.
send_federation
:
...
...
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