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.
Files changed (34) hide show
  1. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/PKG-INFO +1 -1
  2. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/opentelemetry_instrument.py +9 -7
  3. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/pyproject.toml +1 -1
  4. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/README.md +0 -0
  5. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/__init__.py +0 -0
  6. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/bootstrappers/__init__.py +0 -0
  7. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/bootstrappers/base.py +0 -0
  8. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/bootstrappers/fastapi.py +0 -0
  9. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/bootstrappers/faststream.py +0 -0
  10. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/bootstrappers/litestar.py +0 -0
  11. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/config/__init__.py +0 -0
  12. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/config/fastapi.py +0 -0
  13. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/config/faststream.py +0 -0
  14. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/config/litestar.py +0 -0
  15. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/console_writer.py +0 -0
  16. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/exceptions.py +0 -0
  17. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/granian_server.py +0 -0
  18. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/helpers.py +0 -0
  19. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/__init__.py +0 -0
  20. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/base.py +0 -0
  21. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/cors_instrument.py +0 -0
  22. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/health_checks_instrument.py +0 -0
  23. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/instrument_box.py +0 -0
  24. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/logging_instrument.py +0 -0
  25. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/prometheus_instrument.py +0 -0
  26. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/pyroscope_instrument.py +0 -0
  27. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/sentry_instrument.py +0 -0
  28. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments/swagger_instrument.py +0 -0
  29. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/instruments_setupper.py +0 -0
  30. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/middlewares/__init__.py +0 -0
  31. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/middlewares/fastapi.py +0 -0
  32. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/middlewares/litestar.py +0 -0
  33. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/py.typed +0 -0
  34. {microbootstrap-1.2.1 → microbootstrap-1.2.2}/microbootstrap/settings.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: microbootstrap
3
- Version: 1.2.1
3
+ Version: 1.2.2
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
@@ -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"): # type: ignore[no-untyped-call]
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
- attributes = {
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
 
@@ -56,7 +56,7 @@ dependencies = [
56
56
  "opentelemetry-instrumentation-asgi>=0.46b0",
57
57
  "orjson>=3.10.18",
58
58
  ]
59
- version = "1.2.1"
59
+ version = "1.2.2"
60
60
  authors = [{ name = "community-of-python" }]
61
61
 
62
62
  [project.optional-dependencies]
File without changes