Commit Graph
18 Commits
Author SHA1 Message Date
Dominik Röttsches 1a086b543d Format log timestamps in the local timezone
Replace the UTC-only SystemTime timer in EventFormatter with chrono's
ChronoLocal, which resolves the zone from TZ, then /etc/localtime, then
/usr/share/zoneinfo, and falls back to UTC when none are available. The
published image is distroless and ships none of them, so the default
output is unchanged and operators opt in by mounting a zone file; the
only difference for existing deployments is the offset suffix, Z ->
+00:00.
2026-08-21 23:14:37 +03:00
Quentin Gliech 44c834bc45 mas-context: track cumulative DB query count and time on LogContext
Add db_queries / db_time / db_rows_fetched / db_rows_affected counters to
LogContext, mirroring Synapse's LoggingContext db_txn_count / db_txn_duration_sec.

They are exposed through LogContextStats and its Display, so they appear
automatically in the existing HTTP request-completion and job-completion log
lines.
2026-06-22 14:43:05 +02:00
Quentin Gliech e42d85d14e Merge branch 'main' into the requester logging branch 2026-06-18 13:43:59 +02:00
Quentin Gliech e0c03b06e8 deps: upgrade reqwest 0.13, sentry 0.48, opentelemetry 0.32
We need to group the sentry and opentelemetry bumps together because they both
upgraded reqwest to 0.13.

- reqwest 0.12 -> 0.13: rename the rustls feature to rustls-no-provider,
  add the now-opt-in 'form' feature.
- sentry 0.46 -> 0.48: add rustls-no-provider so Sentry's reqwest 0.13
  transport reuses our process-wide aws-lc-rs provider.
- opentelemetry 0.31 -> 0.32 / tracing-opentelemetry 0.33: update the
  get_otel_context call in mas-context for the new signature.

opentelemetry-jaeger-propagator 0.32 is deprecated upstream but still
published; we keep it for now (with an expect(deprecated)) and will
vendor it in-tree once it's actually removed.
2026-06-17 19:00:25 +02:00
Quentin Gliech c6cd294777 mas-context: add a Requester to the LogContext
Add a `Requester` enum (a user, an OAuth2 client, or the homeserver) stored
in a set-once slot on the `LogContext`. This lets request handlers record
which entity authenticated a request so it can be logged later.
2026-06-17 14:14:23 +02:00
Quentin Gliech b0c878026e Use get_otel_context instead of accessing OtelData directly
`OtelData` is going to become private in a future version of
`tracing-opentelemetry`. Use the new `get_otel_context` function
introduced in 0.32.1 to extract the trace ID from the span context.
2026-03-31 12:24:08 +02:00
Olivier 'reivilibre 9566dc49b6 Fix broken link in rustdoc 2025-11-06 09:20:20 +00:00
Quentin Gliech acb5290326 Adapt to the new tracing-opentelemetry API 2025-10-08 11:12:30 +02:00
Quentin Gliech 45b6b567db Collapse a few nested if now that we have if let chains 2025-08-18 10:29:30 +02:00
Quentin Gliech 3d96dc9d47 Update license headers to match the actual license 2025-06-12 10:32:16 +02:00
Quentin Gliech ac5f4b96b5 Log the trace ID in the log line only if the span is sampled 2025-05-07 10:56:19 +02:00
Quentin Gliech 2a99af6349 perf: avoid unnecessary clones of the log context 2025-04-24 14:19:26 +02:00
Quentin Gliech 295436af12 Format code 2025-04-23 17:36:48 +02:00
Quentin Gliech 0c74ecdde7 Suggestions from code review:
- what unit is cpu_time in
 - reduce the number of digits when logging timings
2025-04-23 17:24:18 +02:00
Quentin Gliech 78ccdf7db2 Log on every HTTP response 2025-04-18 09:58:57 +02:00
Quentin Gliech 4820b75157 Roll our own event formatter 2025-04-18 09:58:47 +02:00
Quentin Gliech 9075ed771d Provide log context stats in a separate structure 2025-04-18 09:58:42 +02:00
Quentin Gliech 3c7b8618f2 Introduce a task-level log context 2025-04-16 16:07:27 +02:00