microbootstrap 1.2.3__tar.gz → 1.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-1.2.3 → microbootstrap-1.2.5}/PKG-INFO +1 -1
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/logging_instrument.py +20 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/opentelemetry_instrument.py +4 -8
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/pyproject.toml +1 -1
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/README.md +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/__init__.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/bootstrappers/__init__.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/bootstrappers/base.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/bootstrappers/fastapi.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/bootstrappers/faststream.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/bootstrappers/litestar.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/config/__init__.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/config/fastapi.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/config/faststream.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/config/litestar.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/console_writer.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/exceptions.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/granian_server.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/helpers.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/__init__.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/base.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/cors_instrument.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/health_checks_instrument.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/instrument_box.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/prometheus_instrument.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/pyroscope_instrument.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/sentry_instrument.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/swagger_instrument.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments_setupper.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/middlewares/__init__.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/middlewares/fastapi.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/middlewares/litestar.py +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/py.typed +0 -0
- {microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/settings.py +0 -0
{microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/logging_instrument.py
RENAMED
|
@@ -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=[
|
{microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/opentelemetry_instrument.py
RENAMED
|
@@ -2,7 +2,6 @@ from __future__ import annotations
|
|
|
2
2
|
import dataclasses
|
|
3
3
|
import logging
|
|
4
4
|
import os
|
|
5
|
-
import threading
|
|
6
5
|
import typing
|
|
7
6
|
|
|
8
7
|
import pydantic
|
|
@@ -200,17 +199,14 @@ class PyroscopeSpanProcessor(SpanProcessor):
|
|
|
200
199
|
def on_start(self, span: Span, parent_context: Context | None = None) -> None: # noqa: ARG002
|
|
201
200
|
if _is_root_span(span):
|
|
202
201
|
formatted_span_id: typing.Final = format_span_id(span.context.span_id)
|
|
203
|
-
thread_id: typing.Final = threading.get_ident()
|
|
204
|
-
|
|
205
202
|
span.set_attribute(OTEL_PROFILE_ID_KEY, formatted_span_id)
|
|
206
|
-
pyroscope.add_thread_tag(
|
|
207
|
-
pyroscope.add_thread_tag(
|
|
203
|
+
pyroscope.add_thread_tag(PYROSCOPE_SPAN_ID_KEY, formatted_span_id)
|
|
204
|
+
pyroscope.add_thread_tag(PYROSCOPE_SPAN_NAME_KEY, span.name)
|
|
208
205
|
|
|
209
206
|
def on_end(self, span: ReadableSpan) -> None:
|
|
210
207
|
if _is_root_span(span):
|
|
211
|
-
|
|
212
|
-
pyroscope.remove_thread_tag(
|
|
213
|
-
pyroscope.remove_thread_tag(thread_id, PYROSCOPE_SPAN_NAME_KEY, span.name)
|
|
208
|
+
pyroscope.remove_thread_tag(PYROSCOPE_SPAN_ID_KEY, format_span_id(span.context.span_id))
|
|
209
|
+
pyroscope.remove_thread_tag(PYROSCOPE_SPAN_NAME_KEY, span.name)
|
|
214
210
|
|
|
215
211
|
def force_flush(self, timeout_millis: int = 30000) -> bool: # noqa: ARG002 # pragma: no cover
|
|
216
212
|
return True
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/health_checks_instrument.py
RENAMED
|
File without changes
|
|
File without changes
|
{microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/prometheus_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/pyroscope_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/sentry_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-1.2.3 → microbootstrap-1.2.5}/microbootstrap/instruments/swagger_instrument.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|