File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed
microbootstrap/instruments Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -226,6 +226,7 @@ class YourSettings(BaseServiceSettings):
226226 sentry_attach_stacktrace: bool = True
227227 sentry_integrations: list[Integration] = []
228228 sentry_additional_params: dict[str , typing.Any] = {}
229+ sentry_tags: dict[str , str ] | None = None
229230
230231 ... # Other settings here
231232```
Original file line number Diff line number Diff line change 11from __future__ import annotations
2+ import contextlib
23import typing
34
45import pydantic
@@ -19,6 +20,7 @@ class SentryConfig(BaseInstrumentConfig):
1920 sentry_attach_stacktrace : bool = True
2021 sentry_integrations : list [Integration ] = pydantic .Field (default_factory = list )
2122 sentry_additional_params : dict [str , typing .Any ] = pydantic .Field (default_factory = dict )
23+ sentry_tags : dict [str , str ] | None = None
2224
2325
2426class SentryInstrument (Instrument [SentryConfig ]):
@@ -40,6 +42,10 @@ def bootstrap(self) -> None:
4042 integrations = self .instrument_config .sentry_integrations ,
4143 ** self .instrument_config .sentry_additional_params ,
4244 )
45+ if self .instrument_config .sentry_tags :
46+ # for sentry<2.1.0
47+ with contextlib .suppress (AttributeError ):
48+ sentry_sdk .set_tags (self .instrument_config .sentry_tags )
4349
4450 @classmethod
4551 def get_config_type (cls ) -> type [SentryConfig ]:
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ def default_litestar_app() -> litestar.Litestar:
3737
3838@pytest .fixture
3939def minimal_sentry_config () -> SentryConfig :
40- return SentryConfig (
sentry_dsn = "https://[email protected] /0" )
40+ return SentryConfig (
sentry_dsn = "https://[email protected] /0" , sentry_tags = { "test" : "test" } )
4141
4242
4343@pytest .fixture
You can’t perform that action at this time.
0 commit comments