omnata-plugin-runtime 0.7.0a184__py3-none-any.whl → 0.8.0a186__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- omnata_plugin_runtime/logging.py +27 -1
- omnata_plugin_runtime/plugin_entrypoints.py +1 -1
- {omnata_plugin_runtime-0.7.0a184.dist-info → omnata_plugin_runtime-0.8.0a186.dist-info}/METADATA +5 -1
- {omnata_plugin_runtime-0.7.0a184.dist-info → omnata_plugin_runtime-0.8.0a186.dist-info}/RECORD +6 -6
- {omnata_plugin_runtime-0.7.0a184.dist-info → omnata_plugin_runtime-0.8.0a186.dist-info}/LICENSE +0 -0
- {omnata_plugin_runtime-0.7.0a184.dist-info → omnata_plugin_runtime-0.8.0a186.dist-info}/WHEEL +0 -0
omnata_plugin_runtime/logging.py
CHANGED
@@ -4,12 +4,38 @@ Custom logging functionality for Omnata
|
|
4
4
|
import logging
|
5
5
|
import logging.handlers
|
6
6
|
import traceback
|
7
|
-
from logging import Logger
|
7
|
+
from logging import Logger, getLogger
|
8
8
|
from typing import Dict, List, Optional
|
9
9
|
from snowflake.snowpark import Session
|
10
10
|
from pydantic import ValidationError
|
11
|
+
from opentelemetry import trace
|
11
12
|
|
12
13
|
|
14
|
+
class CustomLoggerAdapter(logging.LoggerAdapter):
|
15
|
+
"""
|
16
|
+
A logger adapter which attaches current trace and span IDs to log messages, so that they can be correlated to traces.
|
17
|
+
Also offers the ability to add static extras.
|
18
|
+
"""
|
19
|
+
def __init__(self, logger:logging.Logger, extra):
|
20
|
+
super(CustomLoggerAdapter, self).__init__(logger, extra)
|
21
|
+
self.extra_extras = {}
|
22
|
+
|
23
|
+
def add_extra(self, key, value):
|
24
|
+
self.extra_extras[key] = value
|
25
|
+
|
26
|
+
def process(self, msg, kwargs):
|
27
|
+
extra = kwargs.get("extra", {})
|
28
|
+
current_span = trace.get_current_span()
|
29
|
+
context = current_span.get_span_context() if current_span is not None else None
|
30
|
+
if context is not None:
|
31
|
+
extra["trace_id"] = format(context.trace_id, 'x') # format as hex string to be consistent with Snowflake's handler
|
32
|
+
extra["span_id"] = format(context.span_id, 'x')
|
33
|
+
extra.update(self.extra_extras)
|
34
|
+
kwargs["extra"] = extra
|
35
|
+
return msg, kwargs
|
36
|
+
|
37
|
+
logger = CustomLoggerAdapter(getLogger("omnata_plugin"), {})
|
38
|
+
|
13
39
|
def log_exception(exception: Exception, logger_instance: Logger):
|
14
40
|
"""
|
15
41
|
Logs an exception to a logger
|
@@ -395,7 +395,7 @@ class PluginEntrypoint:
|
|
395
395
|
def connection_form(self,connectivity_option: str):
|
396
396
|
connectivity_option = TypeAdapter(ConnectivityOption).validate_python(connectivity_option)
|
397
397
|
logger.info("Entered connection_form method")
|
398
|
-
if self._plugin_instance.connection_form.
|
398
|
+
if self._plugin_instance.connection_form.__code__.co_argcount==1:
|
399
399
|
form: List[ConnectionMethod] = self._plugin_instance.connection_form()
|
400
400
|
else:
|
401
401
|
form: List[ConnectionMethod] = self._plugin_instance.connection_form(connectivity_option)
|
{omnata_plugin_runtime-0.7.0a184.dist-info → omnata_plugin_runtime-0.8.0a186.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: omnata-plugin-runtime
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.8.0a186
|
4
4
|
Summary: Classes and common runtime components for building and running Omnata Plugins
|
5
5
|
Author: James Weakley
|
6
6
|
Author-email: james.weakley@omnata.com
|
@@ -19,9 +19,11 @@ Requires-Dist: idna (<=3.7)
|
|
19
19
|
Requires-Dist: jinja2 (>=3.1.2,<=3.1.4)
|
20
20
|
Requires-Dist: markupsafe (<=2.1.3)
|
21
21
|
Requires-Dist: numpy (<1.27.0)
|
22
|
+
Requires-Dist: opentelemetry-api (<=1.23.0)
|
22
23
|
Requires-Dist: packaging (<=24.1)
|
23
24
|
Requires-Dist: pandas (<=2.2.2)
|
24
25
|
Requires-Dist: platformdirs (<=3.10.0)
|
26
|
+
Requires-Dist: protobuf (<=4.25.3)
|
25
27
|
Requires-Dist: pyarrow (<=16.1.0)
|
26
28
|
Requires-Dist: pycparser (<=2.21)
|
27
29
|
Requires-Dist: pydantic (>=2,<=2.8.2)
|
@@ -34,10 +36,12 @@ Requires-Dist: requests (>=2,<=2.32.3)
|
|
34
36
|
Requires-Dist: setuptools (<=72.1.0)
|
35
37
|
Requires-Dist: snowflake-connector-python (>=3,<=3.12.0)
|
36
38
|
Requires-Dist: snowflake-snowpark-python (==1.23.0)
|
39
|
+
Requires-Dist: snowflake-telemetry-python (<=0.5.0)
|
37
40
|
Requires-Dist: tenacity (>=8,<=8.2.3)
|
38
41
|
Requires-Dist: tomlkit (<=0.11.1)
|
39
42
|
Requires-Dist: urllib3 (<=2.2.2)
|
40
43
|
Requires-Dist: wheel (<=0.43.0)
|
44
|
+
Requires-Dist: wrapt (<=1.14.1)
|
41
45
|
Description-Content-Type: text/markdown
|
42
46
|
|
43
47
|
# omnata-plugin-runtime
|
{omnata_plugin_runtime-0.7.0a184.dist-info → omnata_plugin_runtime-0.8.0a186.dist-info}/RECORD
RENAMED
@@ -2,11 +2,11 @@ omnata_plugin_runtime/__init__.py,sha256=MS9d1whnfT_B3-ThqZ7l63QeC_8OEKTuaYV5wTw
|
|
2
2
|
omnata_plugin_runtime/api.py,sha256=tVi4KLL0v5N3yz3Ie0kSyFemryu572gCbtSRfWN6wBU,6523
|
3
3
|
omnata_plugin_runtime/configuration.py,sha256=Yyz3trj7G6nh3JyEw6S5qlrXUfS_MB-vZgATcNdWzp0,38339
|
4
4
|
omnata_plugin_runtime/forms.py,sha256=ueodN2GIMS5N9fqebpY4uNGJnjEb9HcuaVQVfWH-cGg,19838
|
5
|
-
omnata_plugin_runtime/logging.py,sha256=
|
5
|
+
omnata_plugin_runtime/logging.py,sha256=u_Bo2v4jS3C_2E_Y8a7yfZZcIP-h5Mak_FPnFHUwFbU,4378
|
6
6
|
omnata_plugin_runtime/omnata_plugin.py,sha256=aggjb_CTTjhgqjS8CHPOm4ENU0jNcYoT6LC8yI1IeF4,130048
|
7
|
-
omnata_plugin_runtime/plugin_entrypoints.py,sha256=
|
7
|
+
omnata_plugin_runtime/plugin_entrypoints.py,sha256=spCatkTxRX0WAgX0wqZP_vUF4Z-uOF8SrASuO3HXT1o,28937
|
8
8
|
omnata_plugin_runtime/rate_limiting.py,sha256=JukA0l7x7Klqz2b54mR-poP7NRxpUHgWSGp6h0B8u6Q,25612
|
9
|
-
omnata_plugin_runtime-0.
|
10
|
-
omnata_plugin_runtime-0.
|
11
|
-
omnata_plugin_runtime-0.
|
12
|
-
omnata_plugin_runtime-0.
|
9
|
+
omnata_plugin_runtime-0.8.0a186.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
|
10
|
+
omnata_plugin_runtime-0.8.0a186.dist-info/METADATA,sha256=WKzsrVmekpQkDTx8mpKCEj67DG0FTtjFWqrJCbwEsXo,2148
|
11
|
+
omnata_plugin_runtime-0.8.0a186.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
12
|
+
omnata_plugin_runtime-0.8.0a186.dist-info/RECORD,,
|
{omnata_plugin_runtime-0.7.0a184.dist-info → omnata_plugin_runtime-0.8.0a186.dist-info}/LICENSE
RENAMED
File without changes
|
{omnata_plugin_runtime-0.7.0a184.dist-info → omnata_plugin_runtime-0.8.0a186.dist-info}/WHEEL
RENAMED
File without changes
|