otel-utils 0.1.20__tar.gz → 0.1.21__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.
Potentially problematic release.
This version of otel-utils might be problematic. Click here for more details.
- {otel_utils-0.1.20 → otel_utils-0.1.21}/PKG-INFO +1 -1
- {otel_utils-0.1.20 → otel_utils-0.1.21}/pyproject.toml +1 -1
- {otel_utils-0.1.20 → otel_utils-0.1.21}/src/otel_utils/logging.py +5 -3
- {otel_utils-0.1.20 → otel_utils-0.1.21}/README.md +0 -0
- {otel_utils-0.1.20 → otel_utils-0.1.21}/src/otel_utils/__init__.py +0 -0
- {otel_utils-0.1.20 → otel_utils-0.1.21}/src/otel_utils/configurator.py +0 -0
- {otel_utils-0.1.20 → otel_utils-0.1.21}/src/otel_utils/metrics.py +0 -0
- {otel_utils-0.1.20 → otel_utils-0.1.21}/src/otel_utils/tracing.py +0 -0
|
@@ -8,9 +8,8 @@ from opentelemetry import trace
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class JsonFormatter(logging.Formatter):
|
|
11
|
-
|
|
12
11
|
def format(self, record):
|
|
13
|
-
log_record = {"timestamp": datetime.utcnow().isoformat(), "level": record.levelname, "
|
|
12
|
+
log_record = {"timestamp": datetime.utcnow().isoformat(), "level": record.levelname, "service": record.name,
|
|
14
13
|
"message": record.getMessage()}
|
|
15
14
|
|
|
16
15
|
ignored_attrs = {
|
|
@@ -18,7 +17,8 @@ class JsonFormatter(logging.Formatter):
|
|
|
18
17
|
'levelno', 'pathname', 'filename', 'module', 'stack_info',
|
|
19
18
|
'lineno', 'funcName', 'created', 'msecs', 'relativeCreated',
|
|
20
19
|
'name', 'thread', 'threadName', 'processName', 'process',
|
|
21
|
-
'levelname', 'getMessage'
|
|
20
|
+
'levelname', 'getMessage',
|
|
21
|
+
'otelTraceID', 'otelSpanID', 'otelTraceSampled', 'otelServiceName'
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if hasattr(record, "otelTraceID"):
|
|
@@ -30,6 +30,8 @@ class JsonFormatter(logging.Formatter):
|
|
|
30
30
|
if key not in ignored_attrs and not key.startswith('_'):
|
|
31
31
|
if key == 'context' and value:
|
|
32
32
|
log_record[key] = value
|
|
33
|
+
elif key == 'service_name' and 'service' in log_record and log_record['service'] == value:
|
|
34
|
+
pass
|
|
33
35
|
elif value is not None and value != '':
|
|
34
36
|
log_record[key] = value
|
|
35
37
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|