Skip to content

Commit

Permalink
Make it possible to enable compression for the metrics HTTP resource (m…
Browse files Browse the repository at this point in the history
…atrix-org#12258)

* Make it possible to enable compression for the metrics HTTP resource

This can provide significant bandwidth savings pulling metrics from
synapse instances.

* Add changelog file.

* Fix type hint
  • Loading branch information
Fizzadar committed Mar 23, 2022
1 parent a9ee3ed commit ef3fdad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/12258.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Compress metrics HTTP resource when enabled. Contributed by Nick @ Beeper.
5 changes: 4 additions & 1 deletion synapse/app/homeserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ def _configure_named_resource(
resources[SERVER_KEY_V2_PREFIX] = KeyApiV2Resource(self)

if name == "metrics" and self.config.metrics.enable_metrics:
resources[METRICS_PREFIX] = MetricsResource(RegistryProxy)
metrics_resource: Resource = MetricsResource(RegistryProxy)
if compress:
metrics_resource = gz_wrap(metrics_resource)
resources[METRICS_PREFIX] = metrics_resource

if name == "replication":
resources[REPLICATION_PREFIX] = ReplicationRestResource(self)
Expand Down

0 comments on commit ef3fdad

Please sign in to comment.