otel-utils 1.1.5__py3-none-any.whl → 1.1.6__py3-none-any.whl

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.

Potentially problematic release.


This version of otel-utils might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: otel-utils
3
- Version: 1.1.5
3
+ Version: 1.1.6
4
4
  Summary: Utilidades simplificadas para instrumentación con OpenTelemetry
5
5
  License: Proprietary
6
6
  Author: Harold Portocarrero
@@ -58,7 +58,6 @@ config = OtelConfig(
58
58
  metric_export_interval_ms=30000, # Metrics export interval
59
59
  log_level=logging.INFO, # Logging level
60
60
  enable_console_logging=True, # Enable console logging
61
- json_logging=True, # Use JSON format for logs (default: True)
62
61
  additional_resources={ # Optional additional resources
63
62
  "deployment.region": "us-east-1",
64
63
  "team.name": "backend"
@@ -74,21 +73,16 @@ from otel_utils import Tracer
74
73
 
75
74
  tracer = Tracer("my-service")
76
75
 
77
- # Using the decorator (auto-handles errors and status)
76
+ # Using the decorator
78
77
  @tracer.trace("my_operation")
79
78
  async def my_function():
80
79
  # Your code here
81
80
  pass
82
81
 
83
- # Using the context manager for custom spans
82
+ # Using the context manager
84
83
  with tracer.create_span("my_operation") as span:
85
84
  span.set_attribute("key", "value")
86
85
  # Your code here
87
-
88
- # Using start_as_current_span for context propagation
89
- with tracer.start_as_current_span("parent_span") as span:
90
- # Operations here will be associated with parent_span
91
- pass
92
86
  ```
93
87
 
94
88
  ### Metrics
@@ -101,38 +95,21 @@ metrics = Metrics("my-service")
101
95
  counter = metrics.get_counter("requests_total")
102
96
  counter.add(1, {"endpoint": "/api/v1/resource"})
103
97
 
104
- # Histogram for latencies using a context manager
105
- with metrics.measure_duration("request_duration", attributes={"method": "GET"}):
98
+ # Histogram for latencies
99
+ with metrics.measure_duration("request_duration"):
106
100
  # Your code here
107
101
  pass
108
-
109
- # Asynchronous metrics (Observable Gauge)
110
- def get_system_load():
111
- return 0.5 # Calculated value
112
-
113
- metrics.observe_async(
114
- name="system_load",
115
- description="Current system load",
116
- callback=get_system_load
117
- )
118
102
  ```
119
103
 
120
104
  ### Structured Logging
121
- The library provides a `StructuredLogger` that outputs logs in JSON format (when `json_logging` is enabled) and automatically includes tracing context.
122
-
123
105
  ```python
124
106
  from otel_utils import StructuredLogger
125
107
 
126
- logger = StructuredLogger("my-service", environment="production")
108
+ logger = StructuredLogger("my-service")
127
109
 
128
- # Using operation_context to auto-log start/end/errors
129
- with logger.operation_context("process_order", order_id="123", customer_type="vip"):
110
+ with logger.operation_context("process_order", order_id="123"):
130
111
  logger.info("Starting processing")
131
- # If an exception is raised here, it will be logged with status="failed"
132
- # and the error message will be included in the JSON log.
133
-
134
- # Manual logging with extra context
135
- logger.info("Event occurred", action="login", user="user123")
112
+ # Your code here
136
113
  ```
137
114
 
138
115
  ## OpenTelemetry Collector Integration
@@ -3,6 +3,6 @@ otel_utils/configurator.py,sha256=oq6OMt366xnWV5Qz-eu529MV4yks4Lclm_i2nzPGYR4,74
3
3
  otel_utils/logging.py,sha256=vWV60xD9_5Av7Y5q75Sp2wq4XrcHxC3XW16ETlDTw0c,5979
4
4
  otel_utils/metrics.py,sha256=vSe1vIPX88ws8qcP1anGvxMSbmp5owmdBgccnuq9tzo,4115
5
5
  otel_utils/tracing.py,sha256=PtowQ7MvYld_xJlVAV4pBQuDBQIqPeP1FQPrzgZx9_Q,2625
6
- otel_utils-1.1.5.dist-info/METADATA,sha256=9OroADBSi8Qr31i03_Su1QJVdeN1CLxStKNq8NeBvOg,6391
7
- otel_utils-1.1.5.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
8
- otel_utils-1.1.5.dist-info/RECORD,,
6
+ otel_utils-1.1.6.dist-info/METADATA,sha256=Jl5obMOPTTy2P9aDu38YaL-pQcOKKNNTp7YeaK6qp-8,5329
7
+ otel_utils-1.1.6.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
8
+ otel_utils-1.1.6.dist-info/RECORD,,