insightconnect-plugin-runtime 6.3.2__py3-none-any.whl → 6.3.4__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.
- insightconnect_plugin_runtime/telemetry.py +24 -3
- {insightconnect_plugin_runtime-6.3.2.dist-info → insightconnect_plugin_runtime-6.3.4.dist-info}/METADATA +4 -2
- {insightconnect_plugin_runtime-6.3.2.dist-info → insightconnect_plugin_runtime-6.3.4.dist-info}/RECORD +5 -5
- {insightconnect_plugin_runtime-6.3.2.dist-info → insightconnect_plugin_runtime-6.3.4.dist-info}/WHEEL +1 -1
- {insightconnect_plugin_runtime-6.3.2.dist-info → insightconnect_plugin_runtime-6.3.4.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import contextvars
|
|
2
|
+
from functools import wraps, partial
|
|
2
3
|
from typing import Any, Callable
|
|
3
|
-
from flask.app import Flask
|
|
4
4
|
|
|
5
|
+
from flask.app import Flask
|
|
5
6
|
from opentelemetry import trace
|
|
6
7
|
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
|
7
8
|
from opentelemetry.instrumentation.flask import FlaskInstrumentor
|
|
@@ -53,7 +54,7 @@ def auto_instrument(func: Callable) -> Callable:
|
|
|
53
54
|
:return:
|
|
54
55
|
"""
|
|
55
56
|
|
|
56
|
-
@
|
|
57
|
+
@wraps(func)
|
|
57
58
|
def wrapper(*args, **kwargs):
|
|
58
59
|
tracer = trace.get_tracer(__name__)
|
|
59
60
|
with tracer.start_as_current_span(func.__name__):
|
|
@@ -71,3 +72,23 @@ def create_post_fork(app_getter: Callable, plugin_getter: Callable, config_gette
|
|
|
71
72
|
init_tracing(app, plugin, endpoint)
|
|
72
73
|
|
|
73
74
|
return post_fork
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def with_context(context: contextvars.Context, function: Callable) -> Callable:
|
|
78
|
+
"""
|
|
79
|
+
Creates a wrapper function that executes the target function with the specified context.
|
|
80
|
+
|
|
81
|
+
:param context: The Context object to apply when executing the function
|
|
82
|
+
:type context: contextvars.Context
|
|
83
|
+
|
|
84
|
+
:param function: The function to wrap with the specified context
|
|
85
|
+
:type function: Callable
|
|
86
|
+
|
|
87
|
+
:return: A wrapper function that applies the context when called
|
|
88
|
+
:rtype: Callable
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
def _wrapper(context_: contextvars.Context, function_: Callable, *args, **kwargs):
|
|
92
|
+
return context_.copy().run(function_, *args, **kwargs)
|
|
93
|
+
|
|
94
|
+
return partial(_wrapper, context, function)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: insightconnect-plugin-runtime
|
|
3
|
-
Version: 6.3.
|
|
3
|
+
Version: 6.3.4
|
|
4
4
|
Summary: InsightConnect Plugin Runtime
|
|
5
5
|
Home-page: https://github.com/rapid7/komand-plugin-sdk-python
|
|
6
6
|
Author: Rapid7 Integrations Alliance
|
|
@@ -16,7 +16,7 @@ Requires-Dist: requests==2.32.3
|
|
|
16
16
|
Requires-Dist: python_jsonschema_objects==0.5.2
|
|
17
17
|
Requires-Dist: jsonschema==4.22.0
|
|
18
18
|
Requires-Dist: certifi==2024.12.14
|
|
19
|
-
Requires-Dist: Flask==3.1.
|
|
19
|
+
Requires-Dist: Flask==3.1.1
|
|
20
20
|
Requires-Dist: gunicorn==23.0.0
|
|
21
21
|
Requires-Dist: greenlet==3.1.1
|
|
22
22
|
Requires-Dist: gevent==24.11.1
|
|
@@ -224,6 +224,8 @@ contributed. Black is installed as a test dependency and the hook can be initial
|
|
|
224
224
|
after cloning this repository.
|
|
225
225
|
|
|
226
226
|
## Changelog
|
|
227
|
+
* 6.3.4 - Addressed vulnerabilities within the slim and non-slim Python images (bumping packages)
|
|
228
|
+
* 6.3.3 - Add helper func for tracing context to preserve parent span in threadpools
|
|
227
229
|
* 6.3.2 - Raise `APIException` from within the `response_handler` to easily access the status code within the plugin
|
|
228
230
|
* 6.3.1 - Improved filtering for `custom_config` parameters for plugin tasks
|
|
229
231
|
* 6.3.0 - Add Tracing Instrumentation
|
|
@@ -11,7 +11,7 @@ insightconnect_plugin_runtime/schema.py,sha256=6MVw5hqGATU1VLgwfOWfPsP3hy1OnsugC
|
|
|
11
11
|
insightconnect_plugin_runtime/server.py,sha256=DHooHBQa1M2z7aETTWK6u9B2jChi8vONzqK4n_c94f4,13138
|
|
12
12
|
insightconnect_plugin_runtime/step.py,sha256=KdERg-789-s99IEKN61DR08naz-YPxyinPT0C_T81C4,855
|
|
13
13
|
insightconnect_plugin_runtime/task.py,sha256=d-H1EAzVnmSdDEJtXyIK5JySprxpF9cetVoFGtWlHrg,123
|
|
14
|
-
insightconnect_plugin_runtime/telemetry.py,sha256=
|
|
14
|
+
insightconnect_plugin_runtime/telemetry.py,sha256=qJJ6N7hWhOQ-I40AJIAAZjdOvRmXMdJo0e3jwXQLOfs,3312
|
|
15
15
|
insightconnect_plugin_runtime/trigger.py,sha256=Zq3cy68N3QxAGbNZKCID6CZF05Zi7YD2sdy_qbedUY8,874
|
|
16
16
|
insightconnect_plugin_runtime/util.py,sha256=8cle29INhnshEcL2LWpaC0ZGqevjq8pW8TE0MFEiYYw,8475
|
|
17
17
|
insightconnect_plugin_runtime/variables.py,sha256=7FjJGnU7KUR7m9o-_tRq7Q3KiaB1Pp0Apj1NGgOwrJk,3056
|
|
@@ -79,7 +79,7 @@ tests/unit/test_server_spec.py,sha256=je97BaktgK0Fiz3AwFPkcmHzYtOJJNqJV_Fw5hrvqX
|
|
|
79
79
|
tests/unit/test_trigger.py,sha256=E53mAUoVyponWu_4IQZ0IC1gQ9lakBnTn_9vKN2IZfg,1692
|
|
80
80
|
tests/unit/test_variables.py,sha256=OUEOqGYZA3Nd5oKk5GVY3hcrWKHpZpxysBJcO_v5gzs,291
|
|
81
81
|
tests/unit/utils.py,sha256=hcY0A2H_DMgCDXUTvDtCXMdMvRjLQgTaGcTpATb8YG0,2236
|
|
82
|
-
insightconnect_plugin_runtime-6.3.
|
|
83
|
-
insightconnect_plugin_runtime-6.3.
|
|
84
|
-
insightconnect_plugin_runtime-6.3.
|
|
85
|
-
insightconnect_plugin_runtime-6.3.
|
|
82
|
+
insightconnect_plugin_runtime-6.3.4.dist-info/METADATA,sha256=5S-gdJ376YDQ9HoRZbaBE2D2mg8PdRGvRx52MsdIHoM,16602
|
|
83
|
+
insightconnect_plugin_runtime-6.3.4.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
84
|
+
insightconnect_plugin_runtime-6.3.4.dist-info/top_level.txt,sha256=AJtyJOpiFzHxsbHUICTcUKXyrGQ3tZxhrEHsPjJBvEA,36
|
|
85
|
+
insightconnect_plugin_runtime-6.3.4.dist-info/RECORD,,
|
|
File without changes
|