aiqa-client 0.1.4__py3-none-any.whl → 0.1.5__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.
- aiqa/__init__.py +1 -1
- aiqa/tracing.py +4 -11
- {aiqa_client-0.1.4.dist-info → aiqa_client-0.1.5.dist-info}/METADATA +1 -1
- aiqa_client-0.1.5.dist-info/RECORD +9 -0
- aiqa_client-0.1.4.dist-info/RECORD +0 -9
- {aiqa_client-0.1.4.dist-info → aiqa_client-0.1.5.dist-info}/WHEEL +0 -0
- {aiqa_client-0.1.4.dist-info → aiqa_client-0.1.5.dist-info}/licenses/LICENSE +0 -0
- {aiqa_client-0.1.4.dist-info → aiqa_client-0.1.5.dist-info}/top_level.txt +0 -0
aiqa/__init__.py
CHANGED
aiqa/tracing.py
CHANGED
|
@@ -12,6 +12,7 @@ from functools import wraps
|
|
|
12
12
|
from opentelemetry import trace
|
|
13
13
|
from opentelemetry.sdk.trace import TracerProvider
|
|
14
14
|
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
15
|
+
from opentelemetry.sdk.trace.sampling import ALWAYS_ON
|
|
15
16
|
from opentelemetry.sdk.resources import Resource
|
|
16
17
|
from opentelemetry.semconv.resource import ResourceAttributes
|
|
17
18
|
from opentelemetry.trace import Status, StatusCode
|
|
@@ -24,12 +25,14 @@ logger = logging.getLogger(__name__)
|
|
|
24
25
|
exporter = AIQASpanExporter()
|
|
25
26
|
|
|
26
27
|
# Initialize OpenTelemetry
|
|
28
|
+
# Use ALWAYS_ON sampler to ensure all spans are recorded (important for FastAPI async contexts)
|
|
27
29
|
provider = TracerProvider(
|
|
28
30
|
resource=Resource.create(
|
|
29
31
|
{
|
|
30
32
|
ResourceAttributes.SERVICE_NAME: os.getenv("OTEL_SERVICE_NAME", "aiqa-service"),
|
|
31
33
|
}
|
|
32
|
-
)
|
|
34
|
+
),
|
|
35
|
+
sampler=ALWAYS_ON
|
|
33
36
|
)
|
|
34
37
|
|
|
35
38
|
provider.add_span_processor(BatchSpanProcessor(exporter))
|
|
@@ -185,12 +188,7 @@ def WithTracing(
|
|
|
185
188
|
del input_data[key]
|
|
186
189
|
|
|
187
190
|
# Use start_as_current_span to ensure span is recorded by BatchSpanProcessor
|
|
188
|
-
# This automatically manages context and ends the span when exiting
|
|
189
191
|
with tracer.start_as_current_span(fn_name) as span:
|
|
190
|
-
# Ensure span is recording
|
|
191
|
-
if not span.is_recording():
|
|
192
|
-
logger.warning(f"Span {fn_name} is not recording - tracing may not work")
|
|
193
|
-
|
|
194
192
|
if input_data is not None:
|
|
195
193
|
# Serialize for span attributes (OpenTelemetry only accepts primitives or JSON strings)
|
|
196
194
|
serialized_input = _serialize_for_span(input_data)
|
|
@@ -240,12 +238,7 @@ def WithTracing(
|
|
|
240
238
|
del input_data[key]
|
|
241
239
|
|
|
242
240
|
# Use start_as_current_span to ensure span is recorded by BatchSpanProcessor
|
|
243
|
-
# This automatically manages context and ends the span when exiting
|
|
244
241
|
with tracer.start_as_current_span(fn_name) as span:
|
|
245
|
-
# Ensure span is recording
|
|
246
|
-
if not span.is_recording():
|
|
247
|
-
logger.warning(f"Span {fn_name} is not recording - tracing may not work")
|
|
248
|
-
|
|
249
242
|
if input_data is not None:
|
|
250
243
|
# Serialize for span attributes (OpenTelemetry only accepts primitives or JSON strings)
|
|
251
244
|
serialized_input = _serialize_for_span(input_data)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
aiqa/__init__.py,sha256=VcLWbEnpYDxDw_cyIbIIoWsNitXrA6iurPgYI_3wM8A,470
|
|
2
|
+
aiqa/aiqa_exporter.py,sha256=vXyX6Q_iOjrDz3tCPOMXuBTQg7ocACdOOqzpkUqhy9g,19131
|
|
3
|
+
aiqa/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
aiqa/tracing.py,sha256=e88rA3ebyc_AS6t0xM60LoCvJKqe3BnLEFe2F5OiodM,12258
|
|
5
|
+
aiqa_client-0.1.5.dist-info/licenses/LICENSE,sha256=kIzkzLuzG0HHaWYm4F4W5FeJ1Yxut3Ec6bhLWyw798A,1062
|
|
6
|
+
aiqa_client-0.1.5.dist-info/METADATA,sha256=mbJ_qO5lYMrjsDOyVDU96ztc2j3XNVL_aL1W2bHQr3I,3772
|
|
7
|
+
aiqa_client-0.1.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
aiqa_client-0.1.5.dist-info/top_level.txt,sha256=nwcsuVVSuWu27iLxZd4n1evVzv1W6FVTrSnCXCc-NQs,5
|
|
9
|
+
aiqa_client-0.1.5.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
aiqa/__init__.py,sha256=MwDG0A3kszFsknTCxQ3l8lX1QB2soTMSMZ2YhI7FcYU,470
|
|
2
|
-
aiqa/aiqa_exporter.py,sha256=vXyX6Q_iOjrDz3tCPOMXuBTQg7ocACdOOqzpkUqhy9g,19131
|
|
3
|
-
aiqa/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
aiqa/tracing.py,sha256=Aq4VbX6czSO7LtIcA6tTXghtw9-upZ802g3DNylzoq8,12680
|
|
5
|
-
aiqa_client-0.1.4.dist-info/licenses/LICENSE,sha256=kIzkzLuzG0HHaWYm4F4W5FeJ1Yxut3Ec6bhLWyw798A,1062
|
|
6
|
-
aiqa_client-0.1.4.dist-info/METADATA,sha256=WU-tzSni5NhyJfUHdq4f0lX6JHOPW0VRGrtkW6XL7mo,3772
|
|
7
|
-
aiqa_client-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
-
aiqa_client-0.1.4.dist-info/top_level.txt,sha256=nwcsuVVSuWu27iLxZd4n1evVzv1W6FVTrSnCXCc-NQs,5
|
|
9
|
-
aiqa_client-0.1.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|