warpzone-sdk 15.0.0.dev7__tar.gz → 15.0.0.dev8__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.
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/PKG-INFO +1 -1
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/pyproject.toml +1 -1
- warpzone_sdk-15.0.0.dev8/warpzone/function/monitor.py +53 -0
- warpzone_sdk-15.0.0.dev7/warpzone/function/monitor.py +0 -93
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/README.md +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/blobstorage/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/blobstorage/client.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/db/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/db/client.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/deltastorage/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/deltastorage/data_types.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/deltastorage/generated_columns.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/deltastorage/lock_client.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/deltastorage/schema.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/deltastorage/slicing.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/deltastorage/store.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/deltastorage/table.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/enums/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/enums/topicenum.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/checks.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/functionize.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/integrations.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/process.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/processors/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/processors/dependencies.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/processors/outputs.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/processors/triggers.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/signature.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/types.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/healthchecks/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/healthchecks/model.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/monitor/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/monitor/logs.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/monitor/traces.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/servicebus/data/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/servicebus/data/client.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/servicebus/events/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/servicebus/events/client.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/servicebus/events/triggers.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/db/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/db/base_client.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/db/client.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/db/table_config.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/tables/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/tables/client.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/tables/entities.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/tables/helpers.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/testing/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/testing/assertions.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/testing/data.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/testing/matchers.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tools/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tools/copy.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/transform/__init__.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/transform/data.py +0 -0
- {warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/transform/schema.py +0 -0
|
@@ -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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "warpzone-sdk"
|
|
3
|
-
version = "15.0.0.
|
|
3
|
+
version = "15.0.0.dev8"
|
|
4
4
|
description = "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
|
authors = [{ name = "Team Enigma", email = "enigma@energinet.dk" }]
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import inspect
|
|
2
|
+
from contextlib import contextmanager
|
|
3
|
+
from typing import Callable
|
|
4
|
+
|
|
5
|
+
import azure.functions as func
|
|
6
|
+
|
|
7
|
+
from warpzone.function.types import SingleArgumentCallable
|
|
8
|
+
from warpzone.monitor import traces
|
|
9
|
+
|
|
10
|
+
SUBJECT_IDENTIFIER = "<Subject>"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@contextmanager
|
|
14
|
+
def run_in_trace_context(context: func.Context):
|
|
15
|
+
trace_context = context.trace_context
|
|
16
|
+
span_name = context.function_name or "azure_function"
|
|
17
|
+
with traces.set_trace_context(trace_context.trace_parent, span_name=span_name):
|
|
18
|
+
yield
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def monitor(main: SingleArgumentCallable) -> Callable:
|
|
22
|
+
"""Wrap Azure function with logging and tracing
|
|
23
|
+
configured for monitoring in App Insights.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
f (SingleArgumentCallable): Azure function to be wrapped
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
Callable: Azure function with
|
|
30
|
+
- argument
|
|
31
|
+
name: "arg"
|
|
32
|
+
description: argument of the original function
|
|
33
|
+
- argument
|
|
34
|
+
name: "context"
|
|
35
|
+
description: Azure function context
|
|
36
|
+
- return value
|
|
37
|
+
description: return value of original function
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
async def wrapper_async(arg, context: func.Context):
|
|
41
|
+
with run_in_trace_context(context):
|
|
42
|
+
result = await main(arg)
|
|
43
|
+
return result
|
|
44
|
+
|
|
45
|
+
def wrapper(arg, context: func.Context):
|
|
46
|
+
with run_in_trace_context(context):
|
|
47
|
+
result = main(arg)
|
|
48
|
+
return result
|
|
49
|
+
|
|
50
|
+
if inspect.iscoroutinefunction(main):
|
|
51
|
+
return wrapper_async
|
|
52
|
+
else:
|
|
53
|
+
return wrapper
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import inspect
|
|
2
|
-
import threading
|
|
3
|
-
from contextlib import contextmanager
|
|
4
|
-
from typing import Callable
|
|
5
|
-
|
|
6
|
-
import azure.functions as func
|
|
7
|
-
from azure.monitor.opentelemetry import configure_azure_monitor
|
|
8
|
-
from opentelemetry import trace
|
|
9
|
-
|
|
10
|
-
from warpzone.function.types import SingleArgumentCallable
|
|
11
|
-
from warpzone.monitor import traces
|
|
12
|
-
|
|
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
|
-
SUBJECT_IDENTIFIER = "<Subject>"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
@contextmanager
|
|
52
|
-
def run_in_trace_context(context: func.Context):
|
|
53
|
-
trace_context = context.trace_context
|
|
54
|
-
span_name = context.function_name or "azure_function"
|
|
55
|
-
with traces.set_trace_context(trace_context.trace_parent, span_name=span_name):
|
|
56
|
-
yield
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def monitor(main: SingleArgumentCallable) -> Callable:
|
|
60
|
-
"""Wrap Azure function with logging and tracing
|
|
61
|
-
configured for monitoring in App Insights.
|
|
62
|
-
|
|
63
|
-
Args:
|
|
64
|
-
f (SingleArgumentCallable): Azure function to be wrapped
|
|
65
|
-
|
|
66
|
-
Returns:
|
|
67
|
-
Callable: Azure function with
|
|
68
|
-
- argument
|
|
69
|
-
name: "arg"
|
|
70
|
-
description: argument of the original function
|
|
71
|
-
- argument
|
|
72
|
-
name: "context"
|
|
73
|
-
description: Azure function context
|
|
74
|
-
- return value
|
|
75
|
-
description: return value of original function
|
|
76
|
-
"""
|
|
77
|
-
# Ensure Azure Monitor is configured before any function runs
|
|
78
|
-
_ensure_azure_monitor_configured()
|
|
79
|
-
|
|
80
|
-
async def wrapper_async(arg, context: func.Context):
|
|
81
|
-
with run_in_trace_context(context):
|
|
82
|
-
result = await main(arg)
|
|
83
|
-
return result
|
|
84
|
-
|
|
85
|
-
def wrapper(arg, context: func.Context):
|
|
86
|
-
with run_in_trace_context(context):
|
|
87
|
-
result = main(arg)
|
|
88
|
-
return result
|
|
89
|
-
|
|
90
|
-
if inspect.iscoroutinefunction(main):
|
|
91
|
-
return wrapper_async
|
|
92
|
-
else:
|
|
93
|
-
return wrapper
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/deltastorage/generated_columns.py
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/processors/__init__.py
RENAMED
|
File without changes
|
{warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/processors/dependencies.py
RENAMED
|
File without changes
|
{warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/processors/outputs.py
RENAMED
|
File without changes
|
{warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/function/processors/triggers.py
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
|
{warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/servicebus/events/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/servicebus/events/triggers.py
RENAMED
|
File without changes
|
|
File without changes
|
{warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/db/base_client.py
RENAMED
|
File without changes
|
|
File without changes
|
{warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/db/table_config.py
RENAMED
|
File without changes
|
{warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/tables/__init__.py
RENAMED
|
File without changes
|
{warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/tables/client.py
RENAMED
|
File without changes
|
{warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/tables/entities.py
RENAMED
|
File without changes
|
{warpzone_sdk-15.0.0.dev7 → warpzone_sdk-15.0.0.dev8}/warpzone/tablestorage/tables/helpers.py
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
|