microbootstrap 1.2.4__tar.gz → 1.3.0__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.4 → microbootstrap-1.3.0}/PKG-INFO +1 -1
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/logging_instrument.py +9 -2
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/opentelemetry_instrument.py +4 -8
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/pyproject.toml +1 -1
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/README.md +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/__init__.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/bootstrappers/__init__.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/bootstrappers/base.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/bootstrappers/fastapi.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/bootstrappers/faststream.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/bootstrappers/litestar.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/config/__init__.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/config/fastapi.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/config/faststream.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/config/litestar.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/console_writer.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/exceptions.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/granian_server.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/helpers.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/__init__.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/base.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/cors_instrument.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/health_checks_instrument.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/instrument_box.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/prometheus_instrument.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/pyroscope_instrument.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/sentry_instrument.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/swagger_instrument.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments_setupper.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/middlewares/__init__.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/middlewares/fastapi.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/middlewares/litestar.py +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/py.typed +0 -0
- {microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/settings.py +0 -0
{microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/logging_instrument.py
RENAMED
|
@@ -78,7 +78,6 @@ STRUCTLOG_PRE_CHAIN_PROCESSORS: typing.Final[list[typing.Any]] = [
|
|
|
78
78
|
structlog.stdlib.add_logger_name,
|
|
79
79
|
tracer_injection,
|
|
80
80
|
structlog.stdlib.PositionalArgumentsFormatter(),
|
|
81
|
-
structlog.processors.TimeStamper(fmt="%Y-%m-%d %H:%M:%S"),
|
|
82
81
|
structlog.processors.StackInfoRenderer(),
|
|
83
82
|
structlog.processors.format_exc_info,
|
|
84
83
|
structlog.processors.UnicodeDecoder(),
|
|
@@ -149,6 +148,9 @@ class LoggingConfig(BaseInstrumentConfig):
|
|
|
149
148
|
)
|
|
150
149
|
logging_exclude_endpoints: list[str] = pydantic.Field(default_factory=lambda: ["/health/", "/metrics"])
|
|
151
150
|
logging_turn_off_middleware: bool = False
|
|
151
|
+
logging_timestamper_extra_params: dict[str, typing.Any] = pydantic.Field(
|
|
152
|
+
default_factory=lambda: {"fmt": "%Y-%m-%d %H:%M:%S"}
|
|
153
|
+
)
|
|
152
154
|
|
|
153
155
|
@pydantic.model_validator(mode="after")
|
|
154
156
|
def remove_trailing_slashes_from_logging_exclude_endpoints(self) -> typing_extensions.Self:
|
|
@@ -172,6 +174,10 @@ class LoggingInstrument(Instrument[LoggingConfig]):
|
|
|
172
174
|
for unset_handlers_logger in self.instrument_config.logging_unset_handlers:
|
|
173
175
|
logging.getLogger(unset_handlers_logger).handlers = []
|
|
174
176
|
|
|
177
|
+
@property
|
|
178
|
+
def _timestamper_processor(self) -> structlog.processors.TimeStamper:
|
|
179
|
+
return structlog.processors.TimeStamper(**self.instrument_config.logging_timestamper_extra_params)
|
|
180
|
+
|
|
175
181
|
def _configure_structlog_loggers(self) -> None:
|
|
176
182
|
if self.instrument_config.service_debug:
|
|
177
183
|
structlog.configure(
|
|
@@ -186,6 +192,7 @@ class LoggingInstrument(Instrument[LoggingConfig]):
|
|
|
186
192
|
processors=[
|
|
187
193
|
structlog.stdlib.filter_by_level,
|
|
188
194
|
*STRUCTLOG_PRE_CHAIN_PROCESSORS,
|
|
195
|
+
self._timestamper_processor,
|
|
189
196
|
*self.instrument_config.logging_extra_processors,
|
|
190
197
|
STRUCTLOG_FORMATTER_PROCESSOR,
|
|
191
198
|
],
|
|
@@ -213,7 +220,7 @@ class LoggingInstrument(Instrument[LoggingConfig]):
|
|
|
213
220
|
)
|
|
214
221
|
if self.instrument_config.service_debug
|
|
215
222
|
else structlog.stdlib.ProcessorFormatter(
|
|
216
|
-
foreign_pre_chain=STRUCTLOG_PRE_CHAIN_PROCESSORS,
|
|
223
|
+
foreign_pre_chain=[*STRUCTLOG_PRE_CHAIN_PROCESSORS, self._timestamper_processor],
|
|
217
224
|
processors=[
|
|
218
225
|
structlog.stdlib.ProcessorFormatter.remove_processors_meta,
|
|
219
226
|
STRUCTLOG_FORMATTER_PROCESSOR,
|
{microbootstrap-1.2.4 → microbootstrap-1.3.0}/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.4 → microbootstrap-1.3.0}/microbootstrap/instruments/health_checks_instrument.py
RENAMED
|
File without changes
|
|
File without changes
|
{microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/prometheus_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/pyroscope_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-1.2.4 → microbootstrap-1.3.0}/microbootstrap/instruments/sentry_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-1.2.4 → microbootstrap-1.3.0}/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
|