microbootstrap 1.2.2__tar.gz → 1.2.4__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.
Files changed (34) hide show
  1. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/PKG-INFO +2 -2
  2. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/instruments/logging_instrument.py +20 -0
  3. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/instruments/pyroscope_instrument.py +0 -2
  4. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/pyproject.toml +2 -2
  5. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/README.md +0 -0
  6. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/__init__.py +0 -0
  7. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/bootstrappers/__init__.py +0 -0
  8. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/bootstrappers/base.py +0 -0
  9. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/bootstrappers/fastapi.py +0 -0
  10. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/bootstrappers/faststream.py +0 -0
  11. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/bootstrappers/litestar.py +0 -0
  12. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/config/__init__.py +0 -0
  13. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/config/fastapi.py +0 -0
  14. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/config/faststream.py +0 -0
  15. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/config/litestar.py +0 -0
  16. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/console_writer.py +0 -0
  17. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/exceptions.py +0 -0
  18. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/granian_server.py +0 -0
  19. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/helpers.py +0 -0
  20. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/instruments/__init__.py +0 -0
  21. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/instruments/base.py +0 -0
  22. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/instruments/cors_instrument.py +0 -0
  23. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/instruments/health_checks_instrument.py +0 -0
  24. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/instruments/instrument_box.py +0 -0
  25. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/instruments/opentelemetry_instrument.py +0 -0
  26. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/instruments/prometheus_instrument.py +0 -0
  27. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/instruments/sentry_instrument.py +0 -0
  28. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/instruments/swagger_instrument.py +0 -0
  29. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/instruments_setupper.py +0 -0
  30. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/middlewares/__init__.py +0 -0
  31. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/middlewares/fastapi.py +0 -0
  32. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/middlewares/litestar.py +0 -0
  33. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/py.typed +0 -0
  34. {microbootstrap-1.2.2 → microbootstrap-1.2.4}/microbootstrap/settings.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: microbootstrap
3
- Version: 1.2.2
3
+ Version: 1.2.4
4
4
  Summary: Package for bootstrapping new micro-services
5
5
  Keywords: python,microservice,bootstrap,opentelemetry,logging,error-tracing,litestar,fastapi
6
6
  Author: community-of-python
@@ -29,7 +29,7 @@ Requires-Dist: pydantic-settings>=2
29
29
  Requires-Dist: rich>=13
30
30
  Requires-Dist: sentry-sdk>=2.7
31
31
  Requires-Dist: structlog>=24
32
- Requires-Dist: pyroscope-io<=1.0.0 ; sys_platform != 'win32'
32
+ Requires-Dist: pyroscope-io>=1.0.0 ; sys_platform != 'win32'
33
33
  Requires-Dist: opentelemetry-distro[otlp]>=0.54b1
34
34
  Requires-Dist: opentelemetry-instrumentation-aio-pika>=0.54b1
35
35
  Requires-Dist: opentelemetry-instrumentation-aiohttp-client>=0.54b1
@@ -93,6 +93,19 @@ STRUCTLOG_FORMATTER_PROCESSOR: typing.Final = structlog.processors.JSONRenderer(
93
93
  serializer=_serialize_log_with_orjson_to_string
94
94
  )
95
95
 
96
+ _FAKER_STDLIB_LOGGER = logging.getLogger("microbootstrap.structlog")
97
+ _FAKER_STDLIB_LOGGER.propagate = False
98
+ _FAKER_STDLIB_LOGGER.addHandler(logging.NullHandler())
99
+
100
+
101
+ def redirect_json_log_to_stdlib(_: WrappedLogger, __: str, event_dict: EventDict) -> EventDict:
102
+ __tracebackhide__ = True
103
+ getattr(_FAKER_STDLIB_LOGGER, event_dict["level"])(
104
+ STRUCTLOG_FORMATTER_PROCESSOR(_, __, event_dict),
105
+ exc_info=event_dict.get("exc_info", bool(event_dict.get("exception", False))),
106
+ )
107
+ return event_dict
108
+
96
109
 
97
110
  class MemoryLoggerFactory(structlog.stdlib.LoggerFactory):
98
111
  def __init__(
@@ -161,6 +174,13 @@ class LoggingInstrument(Instrument[LoggingConfig]):
161
174
 
162
175
  def _configure_structlog_loggers(self) -> None:
163
176
  if self.instrument_config.service_debug:
177
+ structlog.configure(
178
+ processors=[
179
+ *structlog.get_config()["processors"][:-1],
180
+ redirect_json_log_to_stdlib, # ensure log is sent to Sentry
181
+ structlog.get_config()["processors"][-1],
182
+ ]
183
+ )
164
184
  return
165
185
  structlog.configure(
166
186
  processors=[
@@ -19,7 +19,6 @@ class PyroscopeConfig(BaseInstrumentConfig):
19
19
 
20
20
  pyroscope_endpoint: pydantic.HttpUrl | None = None
21
21
  pyroscope_sample_rate: int = 100
22
- pyroscope_auth_token: str | None = None
23
22
  pyroscope_tags: dict[str, str] = pydantic.Field(default_factory=dict)
24
23
  pyroscope_additional_params: dict[str, typing.Any] = pydantic.Field(default_factory=dict)
25
24
 
@@ -38,7 +37,6 @@ class PyroscopeInstrument(Instrument[PyroscopeConfig]):
38
37
  pyroscope.configure(
39
38
  application_name=self.instrument_config.opentelemetry_service_name or self.instrument_config.service_name,
40
39
  server_address=str(self.instrument_config.pyroscope_endpoint),
41
- auth_token=self.instrument_config.pyroscope_auth_token or "",
42
40
  sample_rate=self.instrument_config.pyroscope_sample_rate,
43
41
  tags=(
44
42
  {"service_namespace": self.instrument_config.opentelemetry_namespace}
@@ -41,7 +41,7 @@ dependencies = [
41
41
  "rich>=13",
42
42
  "sentry-sdk>=2.7",
43
43
  "structlog>=24",
44
- "pyroscope-io<=1.0.0; platform_system != 'Windows'",
44
+ "pyroscope-io>=1.0.0; platform_system != 'Windows'",
45
45
  "opentelemetry-distro[otlp]>=0.54b1",
46
46
  "opentelemetry-instrumentation-aio-pika>=0.54b1",
47
47
  "opentelemetry-instrumentation-aiohttp-client>=0.54b1",
@@ -56,7 +56,7 @@ dependencies = [
56
56
  "opentelemetry-instrumentation-asgi>=0.46b0",
57
57
  "orjson>=3.10.18",
58
58
  ]
59
- version = "1.2.2"
59
+ version = "1.2.4"
60
60
  authors = [{ name = "community-of-python" }]
61
61
 
62
62
  [project.optional-dependencies]
File without changes