sincpro-framework 3.2.0__tar.gz → 3.2.1__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 (42) hide show
  1. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/PKG-INFO +2 -2
  2. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/pyproject.toml +4 -2
  3. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/tracing/provider.py +24 -1
  4. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/use_bus.py +4 -2
  5. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/LICENSE.md +0 -0
  6. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/README.md +0 -0
  7. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/__init__.py +0 -0
  8. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/bus.py +0 -0
  9. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/bus.pyi +0 -0
  10. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/conf/sincpro_framework_conf.yml +0 -0
  11. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/context/__init__.py +0 -0
  12. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/context/framework_context.py +0 -0
  13. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/context/framework_context.pyi +0 -0
  14. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/context/mixin.py +0 -0
  15. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/ddd/__init__.py +0 -0
  16. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/ddd/value_object.py +0 -0
  17. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/error_handler.py +0 -0
  18. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/exceptions.py +0 -0
  19. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/generate_documentation/__init__.py +0 -0
  20. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/generate_documentation/domain/__init__.py +0 -0
  21. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/generate_documentation/domain/extractor.py +0 -0
  22. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/generate_documentation/domain/models.py +0 -0
  23. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/generate_documentation/infrastructure/__init__.py +0 -0
  24. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/generate_documentation/infrastructure/framework_docs_extractor.py +0 -0
  25. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/generate_documentation/infrastructure/json_schema_generator.py +0 -0
  26. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/generate_documentation/infrastructure/mkdocs_markdown_generator.py +0 -0
  27. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/generate_documentation/infrastructure/mkdocs_yaml_generator.py +0 -0
  28. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/generate_documentation/infrastructure/sincpro_introspector.py +0 -0
  29. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/generate_documentation/infrastructure/static_site_generator.py +0 -0
  30. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/generate_documentation/service.py +0 -0
  31. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/generate_documentation/sincpro_framework_ai_guide.json +0 -0
  32. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/ioc.py +0 -0
  33. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/middleware.py +0 -0
  34. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/py.typed +0 -0
  35. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/sincpro_abstractions.py +0 -0
  36. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/sincpro_abstractions.pyi +0 -0
  37. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/sincpro_conf.py +0 -0
  38. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/sincpro_logger.py +0 -0
  39. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/tracing/__init__.py +0 -0
  40. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/tracing/instrumentation.py +0 -0
  41. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/tracing/span_context.py +0 -0
  42. {sincpro_framework-3.2.0 → sincpro_framework-3.2.1}/sincpro_framework/use_bus.pyi +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sincpro-framework
3
- Version: 3.2.0
3
+ Version: 3.2.1
4
4
  Summary: Sincpro framework to use DDD, Clean architecture, Hexagonal architecture
5
5
  License: MIT
6
6
  License-File: LICENSE.md
@@ -20,7 +20,7 @@ Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.20) ; extra == "opent
20
20
  Requires-Dist: opentelemetry-sdk (>=1.20) ; extra == "opentelemetry"
21
21
  Requires-Dist: pydantic (>=2.12.5,<3.0.0)
22
22
  Requires-Dist: pyyaml (>=6.0.1)
23
- Requires-Dist: sincpro-log (>=1.0.1,<2.0.0)
23
+ Requires-Dist: sincpro-log (>=1.1.1,<2.0.0)
24
24
  Description-Content-Type: text/markdown
25
25
 
26
26
  # 🚀 Sincpro Framework: Application Layer Framework within Hexagonal Architecture
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "sincpro-framework"
3
- version = "3.2.0"
3
+ version = "3.2.1"
4
4
  description = "Sincpro framework to use DDD, Clean architecture, Hexagonal architecture"
5
5
  authors = ["Gutierrez Andres <andru1236@gmail.com>"]
6
6
  readme = "README.md"
@@ -17,7 +17,7 @@ python = "^3.12"
17
17
  dependency-injector = "^4.48.3"
18
18
  pydantic = "^2.12.5"
19
19
  pyyaml = ">=6.0.1"
20
- sincpro-log = "^1.0.1"
20
+ sincpro-log = "^1.1.1"
21
21
  opentelemetry-api = {version = ">=1.20", optional = true}
22
22
  opentelemetry-sdk = {version = ">=1.20", optional = true}
23
23
  opentelemetry-exporter-otlp-proto-grpc = {version = ">=1.20", optional = true}
@@ -62,5 +62,7 @@ build-backend = "poetry.core.masonry.api"
62
62
  line-length = 94
63
63
 
64
64
  [tool.pyright]
65
+ venvPath = "."
66
+ venv = ".venv"
65
67
  reportInvalidTypeVarUse = "none"
66
68
  reportInvalidTypeForm = "none"
@@ -2,6 +2,8 @@
2
2
 
3
3
  from typing import Any
4
4
 
5
+ from sincpro_log.logger import LoggerProxy
6
+
5
7
  from ..sincpro_conf import settings
6
8
 
7
9
  # Private provider owned by sincpro. Kept separate from the global OTel provider
@@ -10,7 +12,23 @@ from ..sincpro_conf import settings
10
12
  _sincpro_provider: Any = None
11
13
 
12
14
 
13
- def setup_otlp_provider(service_name: str) -> None:
15
+ def _get_current_otel_context() -> dict:
16
+ """Return trace_id and span_id from the currently active OTel span, or {}."""
17
+ try:
18
+ from opentelemetry import trace
19
+
20
+ span_ctx = trace.get_current_span().get_span_context()
21
+ if span_ctx.is_valid:
22
+ return {
23
+ "trace_id": format(span_ctx.trace_id, "032x"),
24
+ "span_id": format(span_ctx.span_id, "016x"),
25
+ }
26
+ except Exception:
27
+ pass
28
+ return {}
29
+
30
+
31
+ def setup_otlp_provider(service_name: str, logger: LoggerProxy | None = None) -> None:
14
32
  """Configure a dedicated TracerProvider for this bounded context.
15
33
 
16
34
  Always creates a private TracerProvider with the given ``service_name`` —
@@ -70,6 +88,11 @@ def setup_otlp_provider(service_name: str) -> None:
70
88
  if current_type in ("ProxyTracerProvider", "NoOpTracerProvider"):
71
89
  trace.set_tracer_provider(provider)
72
90
 
91
+ # Wire OTel span context into the logger so every framework.logger.info(...)
92
+ # call automatically carries trace_id/span_id from the active span.
93
+ if logger is not None:
94
+ logger.set_getter_context(_get_current_otel_context)
95
+
73
96
 
74
97
  def get_framework_tracer(instrumentation_name: str) -> Any:
75
98
  """Return a Tracer from sincpro's private provider, or the global fallback.
@@ -130,7 +130,9 @@ class UseFramework(ContextMixin):
130
130
 
131
131
  # Configure OTLP provider if opentelemetry-sdk is installed and
132
132
  # OTEL_EXPORTER_OTLP_ENDPOINT is set. No-op otherwise.
133
- setup_otlp_provider(self._logger_name)
133
+ # When OTel is active, also wires the current span context into the logger
134
+ # so framework.logger.info(...) carries trace_id/span_id automatically.
135
+ setup_otlp_provider(self._logger_name, self.logger)
134
136
 
135
137
  def add_dependency(self, name, dep: Any):
136
138
  """
@@ -349,7 +351,7 @@ class UseFramework(ContextMixin):
349
351
 
350
352
  @property
351
353
  def logger(self) -> LoggerProxy:
352
- """Get bundle context logger"""
354
+ """Get the bundle context logger."""
353
355
  if not self._is_logger_configured:
354
356
  self._logger = create_logger(self._logger_name)
355
357
  self._is_logger_configured = True