synapse/scripts-dev
Eric Eastwood d05f44a1c6
Introduce Clock.add_system_event_trigger(...) to include logcontext by default (#18945)
Introduce `Clock.add_system_event_trigger(...)` to wrap system event
callback code in a logcontext, ensuring we can identify which server
generated the logs.

Background:

>  Ideally, nothing from the Synapse homeserver would be logged against the `sentinel` 
>  logcontext as we want to know which server the logs came from. In practice, this is not 
>  always the case yet especially outside of request handling. 
>   
>  Global things outside of Synapse (e.g. Twisted reactor code) should run in the 
>  `sentinel` logcontext. It's only when it calls into application code that a logcontext 
>  gets activated. This means the reactor should be started in the `sentinel` logcontext, 
>  and any time an awaitable yields control back to the reactor, it should reset the 
>  logcontext to be the `sentinel` logcontext. This is important to avoid leaking the 
>  current logcontext to the reactor (which would then get picked up and associated with 
>  the next thing the reactor does). 
>
> *-- `docs/log_contexts.md`

Also adds a lint to prefer `Clock.add_system_event_trigger(...)` over
`reactor.addSystemEventTrigger(...)`

Part of https://github.com/element-hq/synapse/issues/18905
2025-09-22 11:47:22 -05:00
..
build_debian_packages.py Remove support for python 3.8 (#17908) 2024-11-06 19:36:01 +00:00
check_line_terminators.sh
check_locked_deps_have_sdists.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
check_pydantic_models.py Enable flake8-logging and flake8-logging-format rules in Ruff and fix related issues throughout the codebase (#18542) 2025-06-13 09:44:18 +02:00
check_schema_delta.py Check for CREATE/DROP INDEX in schema deltas (#18440) 2025-05-19 10:52:05 +00:00
check-newsfragment.sh
complement.sh Configure Synapse to run MSC4306: Thread Subscriptions Complement tests. (#18819) 2025-09-09 11:40:10 +01:00
config-lint.sh
database-save.sh
docker_update_debian_changelog.sh
dump_macaroon.py
federation_client.py Replace deprecated HTTPAdapter.get_connection method with get_connection_with_tls_context (#17536) 2024-08-08 14:59:37 +01:00
gen_config_documentation.py Use UTF-8 for config doc generation (#18580) 2025-07-22 17:54:47 +00:00
generate_sample_config.sh
lint.sh Add config doc generation command to lint.sh and add missing config schema. (#18522) 2025-06-10 12:43:58 +01:00
make_full_schema.sh
mypy_synapse_plugin.py Introduce Clock.add_system_event_trigger(...) to include logcontext by default (#18945) 2025-09-22 11:47:22 -05:00
next_github_number.sh
release.py Use markdown-it-py instead of commonmark in the release script. (#18637) 2025-07-11 12:54:46 +00:00
schema_versions.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
sign_json.py Introduce Clock.call_when_running(...) to include logcontext by default (#18944) 2025-09-22 10:27:59 -05:00