openinference-instrumentation 0.1.0__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.
- openinference_instrumentation-0.1.0/.gitignore +2 -0
- openinference_instrumentation-0.1.0/PKG-INFO +33 -0
- openinference_instrumentation-0.1.0/README.md +10 -0
- openinference_instrumentation-0.1.0/pyproject.toml +49 -0
- openinference_instrumentation-0.1.0/src/openinference/instrumentation/__init__.py +22 -0
- openinference_instrumentation-0.1.0/src/openinference/instrumentation/py.typed +0 -0
- openinference_instrumentation-0.1.0/src/openinference/instrumentation/version.py +1 -0
- openinference_instrumentation-0.1.0/tests/test_suppress_tracing.py +29 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: openinference-instrumentation
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: OpenInference instrumentation utilities
|
|
5
|
+
Project-URL: Homepage, https://github.com/Arize-ai/openinference/tree/main/python/openinference-instrumentation
|
|
6
|
+
Author-email: OpenInference Authors <oss@arize.com>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Requires-Python: <3.13,>=3.8
|
|
19
|
+
Requires-Dist: opentelemetry-api
|
|
20
|
+
Provides-Extra: test
|
|
21
|
+
Requires-Dist: opentelemetry-sdk; extra == 'test'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# OpenInference Mistral AI Instrumentation
|
|
25
|
+
[](https://pypi.python.org/pypi/openinference-instrumentation-mistralai)
|
|
26
|
+
|
|
27
|
+
Utility functions for OpenInference instrumentation.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```shell
|
|
32
|
+
pip install openinference-instrumentation
|
|
33
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# OpenInference Mistral AI Instrumentation
|
|
2
|
+
[](https://pypi.python.org/pypi/openinference-instrumentation-mistralai)
|
|
3
|
+
|
|
4
|
+
Utility functions for OpenInference instrumentation.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```shell
|
|
9
|
+
pip install openinference-instrumentation
|
|
10
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "openinference-instrumentation"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "OpenInference instrumentation utilities"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
requires-python = ">=3.8, <3.13"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "OpenInference Authors", email = "oss@arize.com" },
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 5 - Production/Stable",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: Apache Software License",
|
|
19
|
+
"Programming Language :: Python",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.8",
|
|
22
|
+
"Programming Language :: Python :: 3.9",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"opentelemetry-api",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
test = [
|
|
33
|
+
"opentelemetry-sdk",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/Arize-ai/openinference/tree/main/python/openinference-instrumentation"
|
|
38
|
+
|
|
39
|
+
[tool.hatch.version]
|
|
40
|
+
path = "src/openinference/instrumentation/version.py"
|
|
41
|
+
|
|
42
|
+
[tool.hatch.build.targets.sdist]
|
|
43
|
+
include = [
|
|
44
|
+
"/src",
|
|
45
|
+
"/tests",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.targets.wheel]
|
|
49
|
+
packages = ["src/openinference"]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import contextlib
|
|
2
|
+
from typing import Iterator
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@contextlib.contextmanager
|
|
6
|
+
def suppress_tracing() -> Iterator[None]:
|
|
7
|
+
"""
|
|
8
|
+
Context manager to pause OpenTelemetry instrumentation.
|
|
9
|
+
|
|
10
|
+
Examples:
|
|
11
|
+
with suppress_tracing():
|
|
12
|
+
# No tracing will occur within this block
|
|
13
|
+
...
|
|
14
|
+
"""
|
|
15
|
+
try:
|
|
16
|
+
from opentelemetry.context import _SUPPRESS_INSTRUMENTATION_KEY, attach, detach, set_value
|
|
17
|
+
except ImportError:
|
|
18
|
+
yield
|
|
19
|
+
return
|
|
20
|
+
token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, True))
|
|
21
|
+
yield
|
|
22
|
+
detach(token)
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from typing import Iterator
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from openinference.instrumentation import suppress_tracing
|
|
5
|
+
from opentelemetry.context import (
|
|
6
|
+
_SUPPRESS_INSTRUMENTATION_KEY,
|
|
7
|
+
attach,
|
|
8
|
+
detach,
|
|
9
|
+
get_value,
|
|
10
|
+
set_value,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_suppress_tracing(obj: object) -> None:
|
|
15
|
+
with suppress_tracing():
|
|
16
|
+
assert get_value(_SUPPRESS_INSTRUMENTATION_KEY) is True
|
|
17
|
+
assert get_value(_SUPPRESS_INSTRUMENTATION_KEY) is obj
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@pytest.fixture(autouse=True)
|
|
21
|
+
def instrument(obj: object) -> Iterator[None]:
|
|
22
|
+
token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, obj))
|
|
23
|
+
yield
|
|
24
|
+
detach(token)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@pytest.fixture
|
|
28
|
+
def obj() -> object:
|
|
29
|
+
return object()
|