microbootstrap 0.2.3__tar.gz → 0.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/PKG-INFO +1 -1
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/bootstrappers/litestar.py +10 -17
- microbootstrap-0.2.5/microbootstrap/config/litestar.py +14 -0
- microbootstrap-0.2.5/microbootstrap/py.typed +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/pyproject.toml +1 -1
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/README.md +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/__init__.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/bootstrappers/__init__.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/bootstrappers/base.py +0 -0
- {microbootstrap-0.2.3/microbootstrap/instruments → microbootstrap-0.2.5/microbootstrap/config}/__init__.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/console_writer.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/exceptions.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/granian_server.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/helpers.py +0 -0
- {microbootstrap-0.2.3/microbootstrap/middlewares → microbootstrap-0.2.5/microbootstrap/instruments}/__init__.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/instruments/base.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/instruments/cors_instrument.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/instruments/instrument_box.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/instruments/logging_instrument.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/instruments/opentelemetry_instrument.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/instruments/prometheus_instrument.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/instruments/sentry_instrument.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/instruments/swagger_instrument.py +0 -0
- /microbootstrap-0.2.3/microbootstrap/py.typed → /microbootstrap-0.2.5/microbootstrap/middlewares/__init__.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/middlewares/fastapi.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/middlewares/litestar.py +0 -0
- {microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/settings.py +0 -0
|
@@ -3,18 +3,17 @@ import typing
|
|
|
3
3
|
|
|
4
4
|
import litestar
|
|
5
5
|
import litestar.types
|
|
6
|
-
import sentry_sdk
|
|
7
6
|
import typing_extensions
|
|
8
|
-
from litestar import openapi
|
|
9
|
-
from litestar.config.app import AppConfig as LitestarConfig
|
|
7
|
+
from litestar import openapi
|
|
10
8
|
from litestar.config.cors import CORSConfig as LitestarCorsConfig
|
|
11
9
|
from litestar.contrib.opentelemetry.config import OpenTelemetryConfig as LitestarOpentelemetryConfig
|
|
12
10
|
from litestar.contrib.prometheus import PrometheusConfig as LitestarPrometheusConfig
|
|
13
11
|
from litestar.contrib.prometheus import PrometheusController
|
|
14
|
-
from litestar.exceptions.http_exceptions import HTTPException
|
|
15
12
|
from litestar_offline_docs import generate_static_files_config
|
|
13
|
+
from sentry_sdk.integrations.litestar import LitestarIntegration
|
|
16
14
|
|
|
17
15
|
from microbootstrap.bootstrappers.base import ApplicationBootstrapper
|
|
16
|
+
from microbootstrap.config.litestar import LitestarConfig
|
|
18
17
|
from microbootstrap.instruments.cors_instrument import CorsInstrument
|
|
19
18
|
from microbootstrap.instruments.logging_instrument import LoggingInstrument
|
|
20
19
|
from microbootstrap.instruments.opentelemetry_instrument import OpentelemetryInstrument
|
|
@@ -41,19 +40,13 @@ class LitestarBootstrapper(
|
|
|
41
40
|
|
|
42
41
|
@LitestarBootstrapper.use_instrument()
|
|
43
42
|
class LitestarSentryInstrument(SentryInstrument):
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
or exception.status_code >= status_codes.HTTP_500_INTERNAL_SERVER_ERROR
|
|
52
|
-
):
|
|
53
|
-
sentry_sdk.capture_exception(exception)
|
|
54
|
-
|
|
55
|
-
def bootstrap_before(self) -> dict[str, typing.Any]:
|
|
56
|
-
return {"after_exception": [self.sentry_exception_catcher_hook]}
|
|
43
|
+
def bootstrap(self) -> None:
|
|
44
|
+
for sentry_integration in self.instrument_config.sentry_integrations:
|
|
45
|
+
if isinstance(sentry_integration, LitestarIntegration):
|
|
46
|
+
break
|
|
47
|
+
else:
|
|
48
|
+
self.instrument_config.sentry_integrations.append(LitestarIntegration())
|
|
49
|
+
super().bootstrap()
|
|
57
50
|
|
|
58
51
|
|
|
59
52
|
@LitestarBootstrapper.use_instrument()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import dataclasses
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from litestar.config.app import AppConfig
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from litestar.types import OnAppInitHandler
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclasses.dataclass
|
|
13
|
+
class LitestarConfig(AppConfig):
|
|
14
|
+
on_app_init: typing.Sequence[OnAppInitHandler] | None = None
|
|
File without changes
|
|
@@ -26,7 +26,7 @@ classifiers = [
|
|
|
26
26
|
"Programming Language :: Python :: 3.11",
|
|
27
27
|
"Programming Language :: Python :: 3.12",
|
|
28
28
|
]
|
|
29
|
-
version = "0.2.
|
|
29
|
+
version = "0.2.5"
|
|
30
30
|
description = "Package for bootstrapping new micro-services"
|
|
31
31
|
authors = ["community-of-python"]
|
|
32
32
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/instruments/logging_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/instruments/opentelemetry_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/instruments/prometheus_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/instruments/sentry_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-0.2.3 → microbootstrap-0.2.5}/microbootstrap/instruments/swagger_instrument.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|