rebrandly-otel 0.1.19__tar.gz → 0.1.20__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 rebrandly-otel might be problematic. Click here for more details.
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/PKG-INFO +1 -1
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/rebrandly_otel.egg-info/PKG-INFO +1 -1
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/setup.py +1 -1
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/src/otel_utils.py +21 -1
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/src/rebrandly_otel.py +8 -0
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/LICENSE +0 -0
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/README.md +0 -0
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/rebrandly_otel.egg-info/SOURCES.txt +0 -0
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/rebrandly_otel.egg-info/dependency_links.txt +0 -0
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/rebrandly_otel.egg-info/top_level.txt +0 -0
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/setup.cfg +0 -0
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/src/__init__.py +0 -0
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/src/fastapi_support.py +0 -0
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/src/flask_support.py +0 -0
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/src/logs.py +0 -0
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/src/metrics.py +0 -0
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/src/traces.py +0 -0
- {rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/tests/test_usage.py +0 -0
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import os
|
|
5
5
|
import sys
|
|
6
6
|
import grpc
|
|
7
|
+
import json
|
|
7
8
|
|
|
8
9
|
from opentelemetry.sdk.resources import Resource
|
|
9
10
|
from opentelemetry.semconv.attributes import service_attributes
|
|
@@ -86,4 +87,23 @@ def get_millis_batch_time():
|
|
|
86
87
|
return int(os.environ.get('BATCH_EXPORT_TIME_MILLIS', 100))
|
|
87
88
|
except Exception as e:
|
|
88
89
|
print(f"[OTEL Utils] Warning: Invalid BATCH_EXPORT_TIME_MILLIS value, using default 5000ms: {e}")
|
|
89
|
-
return 5000
|
|
90
|
+
return 5000
|
|
91
|
+
|
|
92
|
+
def extract_event_from(message) -> str | None:
|
|
93
|
+
body = None
|
|
94
|
+
if 'body' in message:
|
|
95
|
+
body = message['body']
|
|
96
|
+
if 'Body' in message:
|
|
97
|
+
body = message['Body']
|
|
98
|
+
if 'Message' in message:
|
|
99
|
+
body = message['Message']
|
|
100
|
+
if 'Sns' in message and 'Message' in message['Sns']:
|
|
101
|
+
body = message['Sns']['Message']
|
|
102
|
+
if body is not None:
|
|
103
|
+
try:
|
|
104
|
+
jbody = json.loads(body)
|
|
105
|
+
if 'event' in jbody:
|
|
106
|
+
return jbody['event']
|
|
107
|
+
except:
|
|
108
|
+
pass
|
|
109
|
+
return None
|
|
@@ -12,6 +12,7 @@ from opentelemetry import baggage, propagate, context
|
|
|
12
12
|
from .traces import RebrandlyTracer
|
|
13
13
|
from .metrics import RebrandlyMeter
|
|
14
14
|
from .logs import RebrandlyLogger
|
|
15
|
+
from .otel_utils import extract_event_from
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
T = TypeVar('T')
|
|
@@ -262,6 +263,9 @@ class RebrandlyOTEL:
|
|
|
262
263
|
span_function = self.span
|
|
263
264
|
if record is not None and (('MessageAttributes' in record or 'messageAttributes' in record) or ('Sns' in record and 'MessageAttributes' in record['Sns'])):
|
|
264
265
|
span_function = self.aws_message_span
|
|
266
|
+
evt = extract_event_from(record)
|
|
267
|
+
if evt:
|
|
268
|
+
span_attributes['event.type'] = evt
|
|
265
269
|
|
|
266
270
|
with span_function(span_name, message=record, attributes=span_attributes, kind=kind) as span_context:
|
|
267
271
|
# Add processing start event with standardized name
|
|
@@ -487,6 +491,10 @@ class RebrandlyOTEL:
|
|
|
487
491
|
if 'awsRegion' in message:
|
|
488
492
|
combined_attributes['cloud.region'] = message['awsRegion']
|
|
489
493
|
|
|
494
|
+
evt = extract_event_from(message)
|
|
495
|
+
if evt:
|
|
496
|
+
combined_attributes['event.type'] = evt
|
|
497
|
+
|
|
490
498
|
|
|
491
499
|
# Use the tracer's start_span method directly to ensure it works
|
|
492
500
|
# This creates a child span of whatever is currently active
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rebrandly_otel-0.1.19 → rebrandly_otel-0.1.20}/rebrandly_otel.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|