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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: otel-utils
3
- Version: 0.1.20
3
+ Version: 0.1.21
4
4
  Summary: Utilidades simplificadas para instrumentación con OpenTelemetry
5
5
  License: Proprietary
6
6
  Author: Harold Portocarrero
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "otel-utils"
3
- version = "0.1.20"
3
+ version = "0.1.21"
4
4
  description = "Utilidades simplificadas para instrumentación con OpenTelemetry"
5
5
  authors = ["Harold Portocarrero <harold@getcometa.com>"]
6
6
  readme = "README.md"
@@ -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, "logger": record.name,
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