set up opentelemetry for metrics

Also adds an `allow_prometheus` option (disabled by default) to expose
a `/metrics` endpoint that returns Prometheus data.
This commit is contained in:
Charles Hall 2024-05-29 14:49:49 -07:00
parent 94fda7c875
commit a0b92c82e8
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
5 changed files with 97 additions and 2 deletions

View file

@ -412,6 +412,15 @@ fn routes(config: &Config) -> Router {
.put(c2s::send_state_event_for_empty_key_route),
);
let router = if config.allow_prometheus {
router.route(
"/metrics",
get(|| async { observability::METRICS.export() }),
)
} else {
router
};
let router = router
.route(
"/_matrix/client/r0/rooms/:room_id/initialSync",