warpzone-sdk 15.0.0.dev7__py3-none-any.whl → 15.0.0.dev8__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
|
@@ -1,50 +1,12 @@
|
|
|
1
1
|
import inspect
|
|
2
|
-
import threading
|
|
3
2
|
from contextlib import contextmanager
|
|
4
3
|
from typing import Callable
|
|
5
4
|
|
|
6
5
|
import azure.functions as func
|
|
7
|
-
from azure.monitor.opentelemetry import configure_azure_monitor
|
|
8
|
-
from opentelemetry import trace
|
|
9
6
|
|
|
10
7
|
from warpzone.function.types import SingleArgumentCallable
|
|
11
8
|
from warpzone.monitor import traces
|
|
12
9
|
|
|
13
|
-
# Thread-safe lazy initialization of Azure Monitor
|
|
14
|
-
_azure_monitor_configured = False
|
|
15
|
-
_azure_monitor_lock = threading.Lock()
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def _ensure_azure_monitor_configured():
|
|
19
|
-
"""Ensure Azure Monitor is configured exactly once, thread-safely."""
|
|
20
|
-
global _azure_monitor_configured
|
|
21
|
-
if _azure_monitor_configured:
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
with _azure_monitor_lock:
|
|
25
|
-
# Double-check after acquiring lock
|
|
26
|
-
if _azure_monitor_configured:
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
# Disable OpenTelemetry logging instrumentation - let Azure Functions
|
|
30
|
-
# handle log correlation via its native thread-local storage mechanism.
|
|
31
|
-
# This prevents conflicts between OpenTelemetry's context-based correlation
|
|
32
|
-
# and Azure Functions' invocation_id-based correlation which can cause
|
|
33
|
-
# logs to leak between concurrent function invocations.
|
|
34
|
-
configure_azure_monitor(
|
|
35
|
-
disable_logging=True,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
# Apply trace filtering to suppress all Azure SDK traces except Service Bus
|
|
39
|
-
tracer_provider = trace.get_tracer_provider()
|
|
40
|
-
if hasattr(tracer_provider, "_active_span_processor"):
|
|
41
|
-
original_processor = tracer_provider._active_span_processor
|
|
42
|
-
filtered_processor = traces.AzureSDKTraceFilter(original_processor)
|
|
43
|
-
tracer_provider._active_span_processor = filtered_processor
|
|
44
|
-
|
|
45
|
-
_azure_monitor_configured = True
|
|
46
|
-
|
|
47
|
-
|
|
48
10
|
SUBJECT_IDENTIFIER = "<Subject>"
|
|
49
11
|
|
|
50
12
|
|
|
@@ -74,8 +36,6 @@ def monitor(main: SingleArgumentCallable) -> Callable:
|
|
|
74
36
|
- return value
|
|
75
37
|
description: return value of original function
|
|
76
38
|
"""
|
|
77
|
-
# Ensure Azure Monitor is configured before any function runs
|
|
78
|
-
_ensure_azure_monitor_configured()
|
|
79
39
|
|
|
80
40
|
async def wrapper_async(arg, context: func.Context):
|
|
81
41
|
with run_in_trace_context(context):
|
|
@@ -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.dev8
|
|
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=w-fLxLjzbG-PIpI-mjPykdJSBmIvexpsHT3eIstkVnE,1528
|
|
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.dev8.dist-info/METADATA,sha256=bx1ixSa38k391uygOjfZcfAAxCcwNaEebLdUfvD0ojo,7398
|
|
56
|
+
warpzone_sdk-15.0.0.dev8.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
|
|
57
|
+
warpzone_sdk-15.0.0.dev8.dist-info/RECORD,,
|
|
File without changes
|