summary refs log tree commit diff
path: root/tests/logging (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Allow use of both `@trace` and `@tag_args` stacked on the same function (#13453)Eric Eastwood2022-08-091-0/+83
| | | | | | | | | | | | | ```py @trace @tag_args async def get_oldest_event_ids_with_depth_in_room(...) ... ``` Before this PR, you would see a warning in the logs and the span was not exported: ``` 2022-08-03 19:11:59,383 - synapse.logging.opentracing - 835 - ERROR - GET-0 - @trace may not have wrapped EventFederationWorkerStore.get_oldest_event_ids_with_depth_in_room correctly! The function is not async but returned a coroutine. ```
* Add missing types to opentracing. (#13345)Patrick Cloke2022-07-211-9/+21
| | | After this change `synapse.logging` is fully typed.
* More type hints for `synapse.logging` (#13103)Patrick Cloke2022-06-301-1/+1
| | | | Completes type hints for synapse.logging.scopecontextmanager and (partially) for synapse.logging.opentracing.
* Fixes for opentracing scopes (#11869)Richard van der Hoff2022-02-021-0/+184
| | | | | | | | | | | | | | | | | | | | `start_active_span` was inconsistent as to whether it would activate the span immediately, or wait for `scope.__enter__` to happen (it depended on whether the current logcontext already had an associated scope). The inconsistency was rather confusing if you were hoping to set up a couple of separate spans before activating either. Looking at the other implementations of opentracing `ScopeManager`s, the intention is that it *should* be activated immediately, as the name implies. Indeed, the idea is that you don't have to use the scope as a contextmanager at all - you can just call `.close` on the result. Hence, our cleanup has to happen in `.close` rather than `.__exit__`. So, the main change here is to ensure that `start_active_span` does activate the span, and that `scope.close()` does close the scope. We also add some tests, which requires a `tracer` param so that we don't have to rely on the global variable in unit tests.
* Include exception in json logging (#11028)Nick Barrett2021-10-081-0/+28
|
* Add reactor to `SynapseRequest` and fix up types. (#10868)Erik Johnston2021-09-241-1/+2
|
* Merge branch 'master' into developAndrew Morgan2021-04-201-2/+4
|\
| * Always use the name as the log ID. (#9829)Patrick Cloke2021-04-201-2/+4
| | | | | | | | | | As far as I can tell our logging contexts are meant to log the request ID, or sometimes the request ID followed by a suffix (this is generally stored in the name field of LoggingContext). There's also code to log the name@memory location, but I'm not sure this is ever used. This simplifies the code paths to require every logging context to have a name and use that in logging. For sub-contexts (created via nested_logging_contexts, defer_to_threadpool, Measure) we use the current context's str (which becomes their name or the string "sentinel") and then potentially modify that (e.g. add a suffix).
* | Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-143-3/+0
|/ | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Use mock from the stdlib. (#9772)Patrick Cloke2021-04-091-2/+1
|
* Record more information into structured logs. (#9654)Patrick Cloke2021-04-081-4/+66
| | | | Records additional request information into the structured logs, e.g. the requester, IP address, etc.
* Various clean-ups to the logging context code (#8935)Patrick Cloke2020-12-141-5/+2
|
* Improve tests for structured logging. (#8916)Patrick Cloke2020-12-111-27/+46
|
* Gracefully handle a pending logging connection during shutdown. (#8685)Patrick Cloke2020-10-291-0/+16
|
* Support generating structured logs in addition to standard logs. (#8607)Patrick Cloke2020-10-294-397/+257
| | | | | | | This modifies the configuration of structured logging to be usable from the standard Python logging configuration. This also separates the formatting of logs from the transport allowing JSON logs to files or standard logs to sockets.
* Separate the TCP and terse JSON formatting code. (#8587)Patrick Cloke2020-10-211-1/+1
| | | | This should (theoretically) allow for using the TCP code with a different output type and make it easier to use the JSON code with files / console.
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-2/+2
|
* Fix for structured logging tests stomping on logs (#6023)Amber Brown2019-09-132-6/+23
|
* Implement a structured logging output system. (#5680)Amber Brown2019-08-283-0/+431