mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-11 10:07:59 +00:00
One emitter now sends both Python's and Rust's spans to the Jaeger agent. `init_tracer` sets the tracer up as before, with `initialize_tracer` (its sampler, remote or not, its throttler, its logging reporter, and the first-homeserver-wins guard), then swaps jaeger-client's reporter for one whose `report_span` converts the finished span into the Rust reporter's form, with the GIL held (a few attribute reads), and queues it. The encoding and the UDP send happen on the reporter thread, as for Rust's spans. Support for the external `rust_python_jaeger_reporter` package is removed. If tracing in Rust cannot start, jaeger-client's reporter stays. The conversion follows jaeger-client's `make_jaeger_batch`, so the datagrams are what jaeger-client sent, trace IDs from a remote context wider than 128 bits included: a test encodes spans of every shape (all tag types, logs, follows-from references, IDs at or above 2^63) both ways and compares the bytes. A failure to convert is logged with its traceback once, then at debug level. One jaeger `PrometheusMetricsFactory` serves the process, as each registers its metrics globally. jaeger-client's `reporter_*` options and metrics no longer apply: the docs say what the Rust reporter does instead. Tests run `init_tracer` and check that a Python span and a Rust span under it arrive in one datagram, and that `logging: true` keeps jaeger-client's logging reporter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W4zxygfJC93SsugxskhoJG
113 lines
3.3 KiB
INI
113 lines
3.3 KiB
INI
[mypy]
|
|
namespace_packages = True
|
|
# Our custom mypy plugin should remain first in this list.
|
|
#
|
|
# mypy has a limitation where it only chooses the first plugin that returns a non-None
|
|
# value for each hook (known-limitation, c.f.
|
|
# https://github.com/python/mypy/issues/19524). We workaround this by putting our custom
|
|
# plugin first in the plugin order and then manually calling any other conflicting
|
|
# plugin hooks in our own plugin followed by our own checks.
|
|
#
|
|
# If you add a new plugin, make sure to check whether the hooks being used conflict with
|
|
# our custom plugin hooks and if so, manually call the other plugin's hooks in our
|
|
# custom plugin. (also applies to if the plugin is updated in the future)
|
|
plugins = scripts-dev/mypy_synapse_plugin.py, pydantic.mypy, mypy_zope:plugin
|
|
follow_imports = normal
|
|
show_error_codes = True
|
|
show_traceback = True
|
|
mypy_path = stubs
|
|
warn_unreachable = True
|
|
local_partial_types = True
|
|
no_implicit_optional = True
|
|
|
|
# Strict checks, see mypy --help
|
|
warn_unused_configs = True
|
|
# disallow_any_generics = True
|
|
disallow_subclassing_any = True
|
|
# disallow_untyped_calls = True
|
|
disallow_untyped_defs = True
|
|
disallow_incomplete_defs = True
|
|
# check_untyped_defs = True
|
|
# disallow_untyped_decorators = True
|
|
warn_redundant_casts = True
|
|
warn_unused_ignores = True
|
|
# warn_return_any = True
|
|
# no_implicit_reexport = True
|
|
strict_equality = True
|
|
|
|
# Run mypy type checking with the minimum supported Python version to catch new usage
|
|
# that isn't backwards-compatible (types, overloads, etc).
|
|
python_version = 3.10
|
|
|
|
files =
|
|
docker/,
|
|
scripts-dev/,
|
|
synapse/,
|
|
synmark/,
|
|
tests/,
|
|
build_rust.py
|
|
|
|
[mypy-synapse.metrics._reactor_metrics]
|
|
# This module pokes at the internals of OS-specific classes, to appease mypy
|
|
# on different systems we add additional ignores.
|
|
warn_unused_ignores = False
|
|
|
|
[mypy-synapse.util.caches.treecache]
|
|
disallow_untyped_defs = False
|
|
disallow_incomplete_defs = False
|
|
|
|
[mypy-synapse.util.manhole]
|
|
# This module imports something from Twisted which has a bad annotation in Twisted trunk,
|
|
# but is unannotated in Twisted's latest release. We want to type-ignore the problem
|
|
# in the twisted trunk job, even though it has no effect on normal mypy runs.
|
|
warn_unused_ignores = False
|
|
|
|
|
|
;; Dependencies without annotations
|
|
;; Before ignoring a module, check to see if type stubs are available.
|
|
;; The `typeshed` project maintains stubs here:
|
|
;; https://github.com/python/typeshed/tree/master/stubs
|
|
;; and for each package `foo` there's a corresponding `types-foo` package on PyPI,
|
|
;; which we can pull in as a dev dependency by adding to `pyproject.toml`'s
|
|
;; `[dependency-groups]` `dev` list.
|
|
|
|
# https://github.com/lepture/authlib/issues/460
|
|
[mypy-authlib.*]
|
|
ignore_missing_imports = True
|
|
|
|
[mypy-ijson.*]
|
|
ignore_missing_imports = True
|
|
|
|
# https://github.com/msgpack/msgpack-python/issues/448
|
|
[mypy-msgpack]
|
|
ignore_missing_imports = True
|
|
|
|
# https://github.com/wolever/parameterized/issues/143
|
|
[mypy-parameterized.*]
|
|
ignore_missing_imports = True
|
|
|
|
[mypy-pymacaroons.*]
|
|
ignore_missing_imports = True
|
|
|
|
[mypy-pympler.*]
|
|
ignore_missing_imports = True
|
|
|
|
[mypy-pyperf.*]
|
|
ignore_missing_imports = True
|
|
|
|
[mypy-saml2.*]
|
|
ignore_missing_imports = True
|
|
|
|
[mypy-srvlookup.*]
|
|
ignore_missing_imports = True
|
|
|
|
# https://github.com/twisted/treq/pull/366
|
|
[mypy-treq.*]
|
|
ignore_missing_imports = True
|
|
|
|
[mypy-multipart.*]
|
|
ignore_missing_imports = True
|
|
|
|
[mypy-mypy_zope.*]
|
|
ignore_missing_imports = True
|