You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

homeserver.py 2.9 KiB

8 jaren geleden
9 jaren geleden
5 jaren geleden
5 jaren geleden
5 jaren geleden
5 jaren geleden
5 jaren geleden
5 jaren geleden
5 jaren geleden
5 jaren geleden
Add basic opentracing support (#5544) * Configure and initialise tracer Includes config options for the tracer and sets up JaegerClient. * Scope manager using LogContexts We piggy-back our tracer scopes by using log context. The current log context gives us the current scope. If new scope is created we create a stack of scopes in the context. * jaeger is a dependency now * Carrier inject and extraction for Twisted Headers * Trace federation requests on the way in and out. The span is created in _started_processing and closed in _finished_processing because we need a meaningful log context. * Create logcontext for new scope. Instead of having a stack of scopes in a logcontext we create a new context for a new scope if the current logcontext already has a scope. * Remove scope from logcontext if logcontext is top level * Disable tracer if not configured * typo * Remove dependence on jaeger internals * bools * Set service name * :Explicitely state that the tracer is disabled * Black is the new black * Newsfile * Code style * Use the new config setup. * Generate config. * Copyright * Rename config to opentracing * Remove user whitelisting * Empty whitelist by default * User ConfigError instead of RuntimeError * Use isinstance * Use tag constants for opentracing. * Remove debug comment and no need to explicitely record error * Two errors a "s(c)entry" * Docstrings! * Remove debugging brainslip * Homeserver Whitlisting * Better opentracing config comment * linting * Inclue worker name in service_name * Make opentracing an optional dependency * Neater config retreival * Clean up dummy tags * Instantiate tracing as object instead of global class * Inlcude opentracing as a homeserver member. * Thread opentracing to the request level * Reference opetnracing through hs * Instantiate dummy opentracin g for tests. * About to revert, just keeping the unfinished changes just in case * Revert back to global state, commit number: 9ce4a3d9067bf9889b86c360c05ac88618b85c4f * Use class level methods in tracerutils * Start and stop requests spans in a place where we have access to the authenticated entity * Seen it, isort it * Make sure to close the active span. * I'm getting black and blue from this. * Logger formatting Co-Authored-By: Erik Johnston <erik@matrix.org> * Outdated comment * Import opentracing at the top * Return a contextmanager * Start tracing client requests from the servlet * Return noop context manager if not tracing * Explicitely say that these are federation requests * Include servlet name in client requests * Use context manager * Move opentracing to logging/ * Seen it, isort it again! * Ignore twisted return exceptions on context exit * Escape the scope * Scopes should be entered to make them useful. * Nicer decorator names * Just one init, init? * Don't need to close something that isn't open * Docs make you smarter
4 jaren geleden
5 jaren geleden
8 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Copyright 2014-2016 OpenMarket Ltd
  2. # Copyright 2018 New Vector Ltd
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. from ._base import RootConfig
  16. from .api import ApiConfig
  17. from .appservice import AppServiceConfig
  18. from .auth import AuthConfig
  19. from .cache import CacheConfig
  20. from .captcha import CaptchaConfig
  21. from .cas import CasConfig
  22. from .consent_config import ConsentConfig
  23. from .database import DatabaseConfig
  24. from .emailconfig import EmailConfig
  25. from .experimental import ExperimentalConfig
  26. from .federation import FederationConfig
  27. from .groups import GroupsConfig
  28. from .jwt_config import JWTConfig
  29. from .key import KeyConfig
  30. from .logger import LoggingConfig
  31. from .metrics import MetricsConfig
  32. from .oidc_config import OIDCConfig
  33. from .password_auth_providers import PasswordAuthProviderConfig
  34. from .push import PushConfig
  35. from .ratelimiting import RatelimitConfig
  36. from .redis import RedisConfig
  37. from .registration import RegistrationConfig
  38. from .repository import ContentRepositoryConfig
  39. from .room import RoomConfig
  40. from .room_directory import RoomDirectoryConfig
  41. from .saml2_config import SAML2Config
  42. from .server import ServerConfig
  43. from .server_notices_config import ServerNoticesConfig
  44. from .spam_checker import SpamCheckerConfig
  45. from .sso import SSOConfig
  46. from .stats import StatsConfig
  47. from .third_party_event_rules import ThirdPartyRulesConfig
  48. from .tls import TlsConfig
  49. from .tracer import TracerConfig
  50. from .user_directory import UserDirectoryConfig
  51. from .voip import VoipConfig
  52. from .workers import WorkerConfig
  53. class HomeServerConfig(RootConfig):
  54. config_classes = [
  55. ServerConfig,
  56. ExperimentalConfig,
  57. TlsConfig,
  58. FederationConfig,
  59. CacheConfig,
  60. DatabaseConfig,
  61. LoggingConfig,
  62. RatelimitConfig,
  63. ContentRepositoryConfig,
  64. CaptchaConfig,
  65. VoipConfig,
  66. RegistrationConfig,
  67. MetricsConfig,
  68. ApiConfig,
  69. AppServiceConfig,
  70. KeyConfig,
  71. SAML2Config,
  72. OIDCConfig,
  73. CasConfig,
  74. SSOConfig,
  75. JWTConfig,
  76. AuthConfig,
  77. EmailConfig,
  78. PasswordAuthProviderConfig,
  79. PushConfig,
  80. SpamCheckerConfig,
  81. RoomConfig,
  82. GroupsConfig,
  83. UserDirectoryConfig,
  84. ConsentConfig,
  85. StatsConfig,
  86. ServerNoticesConfig,
  87. RoomDirectoryConfig,
  88. ThirdPartyRulesConfig,
  89. TracerConfig,
  90. WorkerConfig,
  91. RedisConfig,
  92. ]