otel-utils 0.2.1__py3-none-any.whl → 0.4.0__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.
otel_utils/logging.py
CHANGED
|
@@ -23,8 +23,10 @@ class JsonFormatter(logging.Formatter):
|
|
|
23
23
|
|
|
24
24
|
if hasattr(record, "otelTraceID"):
|
|
25
25
|
log_record["trace_id"] = getattr(record, "otelTraceID")
|
|
26
|
+
log_record["dd.trace_id"] = getattr(record, "otelTraceID")
|
|
26
27
|
if hasattr(record, "otelSpanID"):
|
|
27
28
|
log_record["span_id"] = getattr(record, "otelSpanID")
|
|
29
|
+
log_record["dd.span_id"] = getattr(record, "otelSpanID")
|
|
28
30
|
|
|
29
31
|
for key, value in record.__dict__.items():
|
|
30
32
|
if key not in ignored_attrs and not key.startswith('_'):
|
|
@@ -101,6 +103,8 @@ class StructuredLogger:
|
|
|
101
103
|
if trace_ctx and not hasattr(logging.getLogRecordFactory(), "otelTraceID"):
|
|
102
104
|
extra_data["trace_id"] = trace_ctx.get("trace_id")
|
|
103
105
|
extra_data["span_id"] = trace_ctx.get("span_id")
|
|
106
|
+
extra_data["dd.trace_id"] = trace_ctx.get("span_id")
|
|
107
|
+
extra_data["dd.span_id"] = trace_ctx.get("span_id")
|
|
104
108
|
|
|
105
109
|
self.logger.log(level, message, extra=extra_data)
|
|
106
110
|
|
|
@@ -111,7 +115,7 @@ class StructuredLogger:
|
|
|
111
115
|
self._log(logging.INFO, message, *args, **kwargs)
|
|
112
116
|
|
|
113
117
|
def warning(self, message: str, *args, **kwargs):
|
|
114
|
-
self._log(logging.
|
|
118
|
+
self._log(logging.WARNING, message, *args, **kwargs)
|
|
115
119
|
|
|
116
120
|
def error(self, message: str, *args, **kwargs):
|
|
117
121
|
self._log(logging.ERROR, message, *args, **kwargs)
|
|
@@ -147,4 +151,4 @@ class StructuredLogger:
|
|
|
147
151
|
error=str(e),
|
|
148
152
|
**context
|
|
149
153
|
)
|
|
150
|
-
raise
|
|
154
|
+
raise e
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
otel_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
otel_utils/configurator.py,sha256=WTA3cjpva0pXJL5PdOhygiODbqmWWhVIgLqL1leupcA,7525
|
|
3
|
-
otel_utils/logging.py,sha256=
|
|
3
|
+
otel_utils/logging.py,sha256=N7fb8DNvVJEHbqU_UyU1XR4S5rIEzE6tTL-A0zkJnec,5082
|
|
4
4
|
otel_utils/metrics.py,sha256=XD-t9V3peZJs97hN2hR2rwJKrcCJHqx2cldNOTCpzoA,3664
|
|
5
5
|
otel_utils/tracing.py,sha256=PtowQ7MvYld_xJlVAV4pBQuDBQIqPeP1FQPrzgZx9_Q,2625
|
|
6
|
-
otel_utils-0.
|
|
7
|
-
otel_utils-0.
|
|
8
|
-
otel_utils-0.
|
|
6
|
+
otel_utils-0.4.0.dist-info/METADATA,sha256=9Jnlno1_Jbqv-YhPe7Bjn2_KL45LVuXoSngA2gvQLw4,5278
|
|
7
|
+
otel_utils-0.4.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
8
|
+
otel_utils-0.4.0.dist-info/RECORD,,
|
|
File without changes
|