microbootstrap 1.2.1__tar.gz → 1.2.2__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.1 → microbootstrap-1.2.2}/PKG-INFO +1 -1
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/opentelemetry_instrument.py +9 -7
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/pyproject.toml +1 -1
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/README.md +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/__init__.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/bootstrappers/__init__.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/bootstrappers/base.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/bootstrappers/fastapi.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/bootstrappers/faststream.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/bootstrappers/litestar.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/config/__init__.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/config/fastapi.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/config/faststream.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/config/litestar.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/console_writer.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/exceptions.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/granian_server.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/helpers.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/__init__.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/base.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/cors_instrument.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/health_checks_instrument.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/instrument_box.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/logging_instrument.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/prometheus_instrument.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/pyroscope_instrument.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/sentry_instrument.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/swagger_instrument.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments_setupper.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/middlewares/__init__.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/middlewares/fastapi.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/middlewares/litestar.py +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/py.typed +0 -0
- {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/settings.py +0 -0
{microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/opentelemetry_instrument.py
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
import dataclasses
|
|
3
|
+
import logging
|
|
3
4
|
import os
|
|
4
5
|
import threading
|
|
5
6
|
import typing
|
|
@@ -35,7 +36,6 @@ if typing.TYPE_CHECKING:
|
|
|
35
36
|
from opentelemetry.metrics import Meter, MeterProvider
|
|
36
37
|
from opentelemetry.trace import TracerProvider
|
|
37
38
|
|
|
38
|
-
|
|
39
39
|
OpentelemetryConfigT = typing.TypeVar("OpentelemetryConfigT", bound="OpentelemetryConfig")
|
|
40
40
|
|
|
41
41
|
|
|
@@ -101,7 +101,7 @@ class BaseOpentelemetryInstrument(Instrument[OpentelemetryConfigT]):
|
|
|
101
101
|
ready_condition = "Provide all necessary config parameters"
|
|
102
102
|
|
|
103
103
|
def _load_instrumentors(self) -> None:
|
|
104
|
-
for entry_point in entry_points(group="opentelemetry_instrumentor"):
|
|
104
|
+
for entry_point in entry_points(group="opentelemetry_instrumentor"):
|
|
105
105
|
if entry_point.name in self.instrument_config.opentelemetry_disabled_instrumentations:
|
|
106
106
|
continue
|
|
107
107
|
|
|
@@ -131,7 +131,9 @@ class BaseOpentelemetryInstrument(Instrument[OpentelemetryConfigT]):
|
|
|
131
131
|
instrumentor_with_params.instrumentor.uninstrument(**instrumentor_with_params.additional_params)
|
|
132
132
|
|
|
133
133
|
def bootstrap(self) -> None:
|
|
134
|
-
|
|
134
|
+
logging.getLogger("opentelemetry.instrumentation.instrumentor").disabled = True
|
|
135
|
+
logging.getLogger("opentelemetry.trace").disabled = True
|
|
136
|
+
attributes: typing.Final = {
|
|
135
137
|
ResourceAttributes.SERVICE_NAME: self.instrument_config.opentelemetry_service_name
|
|
136
138
|
or self.instrument_config.service_name,
|
|
137
139
|
ResourceAttributes.TELEMETRY_SDK_LANGUAGE: "python",
|
|
@@ -169,7 +171,7 @@ class BaseOpentelemetryInstrument(Instrument[OpentelemetryConfigT]):
|
|
|
169
171
|
|
|
170
172
|
class OpentelemetryInstrument(BaseOpentelemetryInstrument[OpentelemetryConfig]):
|
|
171
173
|
def define_exclude_urls(self) -> list[str]:
|
|
172
|
-
exclude_urls = [*self.instrument_config.opentelemetry_exclude_urls]
|
|
174
|
+
exclude_urls: typing.Final = [*self.instrument_config.opentelemetry_exclude_urls]
|
|
173
175
|
if (
|
|
174
176
|
not self.instrument_config.opentelemetry_generate_health_check_spans
|
|
175
177
|
and self.instrument_config.health_checks_path
|
|
@@ -197,8 +199,8 @@ def _is_root_span(span: ReadableSpan) -> bool:
|
|
|
197
199
|
class PyroscopeSpanProcessor(SpanProcessor):
|
|
198
200
|
def on_start(self, span: Span, parent_context: Context | None = None) -> None: # noqa: ARG002
|
|
199
201
|
if _is_root_span(span):
|
|
200
|
-
formatted_span_id = format_span_id(span.context.span_id)
|
|
201
|
-
thread_id = threading.get_ident()
|
|
202
|
+
formatted_span_id: typing.Final = format_span_id(span.context.span_id)
|
|
203
|
+
thread_id: typing.Final = threading.get_ident()
|
|
202
204
|
|
|
203
205
|
span.set_attribute(OTEL_PROFILE_ID_KEY, formatted_span_id)
|
|
204
206
|
pyroscope.add_thread_tag(thread_id, PYROSCOPE_SPAN_ID_KEY, formatted_span_id)
|
|
@@ -206,7 +208,7 @@ class PyroscopeSpanProcessor(SpanProcessor):
|
|
|
206
208
|
|
|
207
209
|
def on_end(self, span: ReadableSpan) -> None:
|
|
208
210
|
if _is_root_span(span):
|
|
209
|
-
thread_id = threading.get_ident()
|
|
211
|
+
thread_id: typing.Final = threading.get_ident()
|
|
210
212
|
pyroscope.remove_thread_tag(thread_id, PYROSCOPE_SPAN_ID_KEY, format_span_id(span.context.span_id))
|
|
211
213
|
pyroscope.remove_thread_tag(thread_id, PYROSCOPE_SPAN_NAME_KEY, span.name)
|
|
212
214
|
|
|
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.1 → microbootstrap-1.2.2}/microbootstrap/instruments/health_checks_instrument.py
RENAMED
|
File without changes
|
|
File without changes
|
{microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/logging_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/prometheus_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/pyroscope_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/sentry_instrument.py
RENAMED
|
File without changes
|
{microbootstrap-1.2.1 → microbootstrap-1.2.2}/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
|