warpzone-sdk 15.0.0.dev2__py3-none-any.whl → 15.0.0.dev3__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.
warpzone/function/monitor.py
CHANGED
|
@@ -9,16 +9,26 @@ from opentelemetry import trace
|
|
|
9
9
|
from warpzone.function.types import SingleArgumentCallable
|
|
10
10
|
from warpzone.monitor import logs, traces
|
|
11
11
|
|
|
12
|
-
#
|
|
13
|
-
|
|
12
|
+
# Lazy initialization flag to ensure configure_azure_monitor is called only once
|
|
13
|
+
_monitor_configured = False
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _ensure_monitor_configured():
|
|
17
|
+
"""Configure Azure Monitor lazily on first use to ensure proper trace context."""
|
|
18
|
+
global _monitor_configured
|
|
19
|
+
if not _monitor_configured:
|
|
20
|
+
configure_azure_monitor()
|
|
21
|
+
|
|
22
|
+
# Apply trace filtering to suppress all Azure SDK traces except Service Bus
|
|
23
|
+
tracer_provider = trace.get_tracer_provider()
|
|
24
|
+
if hasattr(tracer_provider, "_active_span_processor"):
|
|
25
|
+
# Wrap the existing span processor with our filter
|
|
26
|
+
original_processor = tracer_provider._active_span_processor
|
|
27
|
+
filtered_processor = traces.AzureSDKTraceFilter(original_processor)
|
|
28
|
+
tracer_provider._active_span_processor = filtered_processor
|
|
29
|
+
|
|
30
|
+
_monitor_configured = True
|
|
14
31
|
|
|
15
|
-
# Apply trace filtering to suppress all Azure SDK traces except Service Bus
|
|
16
|
-
tracer_provider = trace.get_tracer_provider()
|
|
17
|
-
if hasattr(tracer_provider, "_active_span_processor"):
|
|
18
|
-
# Wrap the existing span processor with our filter
|
|
19
|
-
original_processor = tracer_provider._active_span_processor
|
|
20
|
-
filtered_processor = traces.AzureSDKTraceFilter(original_processor)
|
|
21
|
-
tracer_provider._active_span_processor = filtered_processor
|
|
22
32
|
|
|
23
33
|
SUBJECT_IDENTIFIER = "<Subject>"
|
|
24
34
|
|
|
@@ -55,11 +65,13 @@ def monitor(main: SingleArgumentCallable) -> Callable:
|
|
|
55
65
|
"""
|
|
56
66
|
|
|
57
67
|
async def wrapper_async(arg, context: func.Context):
|
|
68
|
+
_ensure_monitor_configured()
|
|
58
69
|
with run_in_trace_context(context):
|
|
59
70
|
result = await main(arg)
|
|
60
71
|
return result
|
|
61
72
|
|
|
62
73
|
def wrapper(arg, context: func.Context):
|
|
74
|
+
_ensure_monitor_configured()
|
|
63
75
|
with run_in_trace_context(context):
|
|
64
76
|
result = main(arg)
|
|
65
77
|
return result
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: warpzone-sdk
|
|
3
|
-
Version: 15.0.0.
|
|
3
|
+
Version: 15.0.0.dev3
|
|
4
4
|
Summary: The main objective of this package is to centralize logic used to interact with Azure Functions, Azure Service Bus and Azure Table Storage
|
|
5
5
|
Author: Team Enigma
|
|
6
6
|
Author-email: enigma@energinet.dk
|
|
@@ -17,7 +17,7 @@ warpzone/function/__init__.py,sha256=rJOZBpWsUgjMc7YtXMJ1rLGm45KB1AhDJ_Y2ISiSISc
|
|
|
17
17
|
warpzone/function/checks.py,sha256=B9YqThymf16ac_fVAYKilv20ru5v9nwXgHlbxYIaG98,1018
|
|
18
18
|
warpzone/function/functionize.py,sha256=bSV0QvwKbD9Vo3a_8cc1rgV2rzTdMMvidinyXItBfvs,2128
|
|
19
19
|
warpzone/function/integrations.py,sha256=sDt2BTx6a4mVc-33wTITP9XQVPustwj7rkX4urTyOqo,4018
|
|
20
|
-
warpzone/function/monitor.py,sha256=
|
|
20
|
+
warpzone/function/monitor.py,sha256=gGWoxrOTaXofds8FJwPwGf58q0XV19Xwj9VRzhr0GM8,2594
|
|
21
21
|
warpzone/function/process.py,sha256=nbUVywM8ChfUwuaqFisgaD98aNRgeZkK4g5sbtuBdRs,2339
|
|
22
22
|
warpzone/function/processors/__init__.py,sha256=DhIdSWLBcIeSO8IJdxPqGIhgwwnkDN6_Xqwy93BCLeA,46
|
|
23
23
|
warpzone/function/processors/dependencies.py,sha256=m17BwdKyQEvzCPxpQZpAW5l1uYRIHWmweDz3XJskmpA,1259
|
|
@@ -52,6 +52,6 @@ warpzone/tools/copy.py,sha256=5fddotMZkXZO8avzUbGOhvs0cp8mce95pNpy0oPVjnQ,2596
|
|
|
52
52
|
warpzone/transform/__init__.py,sha256=ruGa7tl-v4ndlWpULE1jSGU_a4_iRc3V6eyNr5xKP9E,27
|
|
53
53
|
warpzone/transform/data.py,sha256=Abb8PcrgMbbNCJkkIUdtrTHdlY0OfXid387qw1nDpFY,2362
|
|
54
54
|
warpzone/transform/schema.py,sha256=nbSQtDMvXkyqGKuwhuFCF0WsEDsaNyoPYpMKvbsKlv8,2423
|
|
55
|
-
warpzone_sdk-15.0.0.
|
|
56
|
-
warpzone_sdk-15.0.0.
|
|
57
|
-
warpzone_sdk-15.0.0.
|
|
55
|
+
warpzone_sdk-15.0.0.dev3.dist-info/METADATA,sha256=SbdclS53SblY02qVWfnpicAHmSQJXPqKIfz_gAxtaRM,7398
|
|
56
|
+
warpzone_sdk-15.0.0.dev3.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
|
|
57
|
+
warpzone_sdk-15.0.0.dev3.dist-info/RECORD,,
|
|
File without changes
|