matrix-js-sdk icon indicating copy to clipboard operation
matrix-js-sdk copied to clipboard

Log `Synapse-Trace-Id` header on requests

Open bwindels opened this issue 4 years ago • 3 comments

This allows correlating the logs with the synapse logs in case of a problem.

See https://github.com/matrix-org/synapse/issues/9480

bwindels avatar Aug 23 '21 12:08 bwindels

I'm not sure I understand the intention behind this issue, if you could provide additional info @bwindels, that would be really helpful.

  • Is the idea to log the Synapse-Trace-Id header of all responses? Won't that flood the log, since we'll be logging all responses (that carry the Synapse-Trace-Id header)?
  • At what level should the logging happen (info, debug, other)?
  • Should other information about the request/response be logged along with the header, e.g. URL or other information?

Thanks!

psrpinto avatar Aug 30 '21 12:08 psrpinto

I'm not sure I understand the intention behind this issue, if you could provide additional info @bwindels, that would be really helpful.

Sorry that I didn't see this before!

Synapse can be configured to trace how it processes incoming requests using a tool called Jaeger. This provides detailed insight in how a request was processed. On matrix.org, currently 1% of requests are traced. Specific users can also be configured to always have their requests traced. Ideally, whenever a request is traced, the trace-id would be logged on the client side in such a way that it is contained in debug logs. That way client and server logs can be put together and you might be a better understanding of a bug.

* Is the idea to log the `Synapse-Trace-Id` header of all responses? Won't that flood the log, since we'll be logging all responses (that carry the `Synapse-Trace-Id` header)?

Yes, only 1% if requests are traced on the server-side, so this should not flood the logs.

* At what level should the logging happen (info, debug, other)?

Not sure, anything will do as long as it ends up in the rageshake/debug logs.

* Should other information about the request/response be logged along with the header, e.g. URL or other information?

Yeah, ideally at least the url and the method.

Thanks!

bwindels avatar Jan 02 '23 09:01 bwindels

matrix-js-sdk shouldn't really house Synapse-specific idioms, it should be [made] flexible enough to do this at the application level

t3chguy avatar Jan 03 '23 10:01 t3chguy