omnata-plugin-runtime 0.8.0a195__py3-none-any.whl → 0.8.0a198__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,6 +48,7 @@ from snowflake.snowpark.functions import col
48
48
  from tenacity import Retrying, stop_after_attempt, wait_fixed, retry_if_exception_message
49
49
 
50
50
  from .logging import OmnataPluginLogHandler, logger, tracer
51
+ from opentelemetry import context
51
52
 
52
53
  from .api import (
53
54
  PluginMessage,
@@ -316,6 +317,8 @@ class SyncRequest(ABC):
316
317
  self._cancel_checking_task = None
317
318
  self._rate_limit_update_task = None
318
319
  self._last_stream_progress_update = None
320
+ # store the opentelemetry context so that it can be attached inside threads
321
+ self.opentelemetry_context = context.get_current()
319
322
 
320
323
  threading.excepthook = self.thread_exception_hook
321
324
  if self.development_mode is False:
@@ -387,6 +390,7 @@ class SyncRequest(ABC):
387
390
  """
388
391
  Designed to be run in a thread, this method polls the results every 20 seconds and sends them back to Snowflake.
389
392
  """
393
+ context.attach(self.opentelemetry_context)
390
394
  while not cancellation_token.is_set():
391
395
  logger.debug("apply results worker checking for results")
392
396
  self.apply_results_queue()
@@ -399,6 +403,7 @@ class SyncRequest(ABC):
399
403
  It also gives us the latest rate limit state from Snowflake, so that activity on other syncs/branches can
400
404
  impact rate limiting on this one.
401
405
  """
406
+ context.attach(self.opentelemetry_context)
402
407
  while not cancellation_token.is_set():
403
408
  try:
404
409
  self.apply_rate_limit_state()
@@ -408,6 +413,7 @@ class SyncRequest(ABC):
408
413
  logger.info("rate limit update worker exiting")
409
414
 
410
415
  def __cancel_checking_worker(self, cancellation_token:threading.Event):
416
+ context.attach(self.opentelemetry_context)
411
417
  """
412
418
  Designed to be run in a thread, this method checks to see if the sync run has been cancelled
413
419
  or if the deadline has been reached.
@@ -1637,6 +1643,8 @@ class OmnataPlugin(ABC):
1637
1643
  take care of various status updates and loading enqueued results.
1638
1644
  Only set this to True if you plan to do all of this yourself (e.g. in a Java stored proc)
1639
1645
  """
1646
+ # store the opentelemetry context so that it can be attached inside threads
1647
+ self.opentelemetry_context = context.get_current()
1640
1648
 
1641
1649
 
1642
1650
  @abstractmethod
@@ -1946,6 +1954,7 @@ def __managed_outbound_processing_worker(
1946
1954
  Consumes a fixed sized set of records by passing them to the wrapped function,
1947
1955
  while adhering to the defined API constraints.
1948
1956
  """
1957
+ context.attach(plugin_class_obj.opentelemetry_context)
1949
1958
  logger.debug(
1950
1959
  f"worker {worker_index} processing. Cancelled: {cancellation_token.is_set()}"
1951
1960
  )
@@ -2128,6 +2137,7 @@ def __managed_inbound_processing_worker(
2128
2137
  A worker thread for the managed_inbound_processing annotation.
2129
2138
  Passes single streams at a time to the wrapped function, adhering to concurrency constraints.
2130
2139
  """
2140
+ context.attach(plugin_class_obj.opentelemetry_context)
2131
2141
  while not cancellation_token.is_set():
2132
2142
  # Get our generator object out of the queue
2133
2143
  logger.debug(
@@ -15,13 +15,10 @@ import logging
15
15
  from pydantic import Field, root_validator, PrivateAttr, field_serializer
16
16
  from pydantic_core import to_jsonable_python
17
17
  from .configuration import SubscriptableBaseModel
18
- from .logging import logger
18
+ from .logging import logger, tracer
19
19
  import pytz
20
20
  from requests.adapters import HTTPAdapter
21
21
  from urllib3.util.retry import Retry
22
- from opentelemetry import trace
23
-
24
- tracer = trace.get_tracer(__name__)
25
22
 
26
23
  TimeUnitType = Literal["second", "minute", "hour", "day"]
27
24
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.8.0a195
3
+ Version: 0.8.0a198
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
@@ -3,10 +3,10 @@ omnata_plugin_runtime/api.py,sha256=tVi4KLL0v5N3yz3Ie0kSyFemryu572gCbtSRfWN6wBU,
3
3
  omnata_plugin_runtime/configuration.py,sha256=6JmgE4SL3F5cGlDYqt17A1vTFu6nB74yWgEpQ5qV9ho,38380
4
4
  omnata_plugin_runtime/forms.py,sha256=ueodN2GIMS5N9fqebpY4uNGJnjEb9HcuaVQVfWH-cGg,19838
5
5
  omnata_plugin_runtime/logging.py,sha256=WBuZt8lF9E5oFWM4KYQbE8dDJ_HctJ1pN3BHwU6rcd0,4461
6
- omnata_plugin_runtime/omnata_plugin.py,sha256=ZMoF5ef9GT0ri8nof_3JaJT4dTQ9oDRf22zw-5UryjI,130600
6
+ omnata_plugin_runtime/omnata_plugin.py,sha256=GAvFRnx02_beTuw1LhPgOBxS_cTJmjDXc4EwVk69ZY8,131191
7
7
  omnata_plugin_runtime/plugin_entrypoints.py,sha256=3nqIWOlUdNVkBu7YBqC73Gb5G_xvMUzmlZf838N0JSg,32728
8
- omnata_plugin_runtime/rate_limiting.py,sha256=6fn_h2vxcHbqqiW-OZ6FKfNYv_XlNvorsrCknVce2PA,25929
9
- omnata_plugin_runtime-0.8.0a195.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
10
- omnata_plugin_runtime-0.8.0a195.dist-info/METADATA,sha256=JW6TXPXIu60cr3BLAydTSegpjml5vFKFJQuRWZbmP8M,2148
11
- omnata_plugin_runtime-0.8.0a195.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
12
- omnata_plugin_runtime-0.8.0a195.dist-info/RECORD,,
8
+ omnata_plugin_runtime/rate_limiting.py,sha256=eOWVRYWiqPlVeYzmB1exVXfXbrcpmYb7vtTi9B-4zkQ,25868
9
+ omnata_plugin_runtime-0.8.0a198.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
10
+ omnata_plugin_runtime-0.8.0a198.dist-info/METADATA,sha256=tnVsgQAi4ZfgczB0MjUQD-Sbezcm3jxi4TfYO124OG8,2148
11
+ omnata_plugin_runtime-0.8.0a198.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
12
+ omnata_plugin_runtime-0.8.0a198.dist-info/RECORD,,