matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.82k stars 2.13k forks source link

Adding opentracing headers for appservice requests #16226

Closed MTRNord closed 1 year ago

MTRNord commented 1 year ago

Description:

Currently, synapse only sends the tracing span headers over federation (using the whitelist) and over replication. However, for appservice devs, it might also be nice to have the trace spans from synapse to follow the flow from the start instead of needing to manually find the right span.

For reference, I think it's probably just adding opentracing.inject_header_dict(headers, check_destination=False) somewhere in this area: https://github.com/matrix-org/synapse/blob/93f2fdd8d1d56a55bddc5b13fd46042ecabea178/synapse/http/client.py#L562 or in https://github.com/matrix-org/synapse/blob/93f2fdd8d1d56a55bddc5b13fd46042ecabea178/synapse/appservice/api.py#L363-L368

However, I didn't work on the synapse codebase so far. So the pointers may not be accurate.

clokep commented 1 year ago

Seems like a good idea, would be great to have a PR adding this.

MTRNord commented 1 year ago

Seems like a good idea, would be great to have a PR adding this.

I will see how my weekend plays out and do that. I am coming from actually having somewhat a need for this :) So I guess I can learn how to do a synapse PR :) This seems like a rather small change.