otel-neomundi 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.
- otel_neomundi-0.1.0/PKG-INFO +151 -0
- otel_neomundi-0.1.0/README.md +114 -0
- otel_neomundi-0.1.0/pyproject.toml +93 -0
- otel_neomundi-0.1.0/setup.cfg +4 -0
- otel_neomundi-0.1.0/src/otel_neomundi/__init__.py +53 -0
- otel_neomundi-0.1.0/src/otel_neomundi/processor.py +733 -0
- otel_neomundi-0.1.0/src/otel_neomundi/py.typed +0 -0
- otel_neomundi-0.1.0/src/otel_neomundi/version.py +1 -0
- otel_neomundi-0.1.0/src/otel_neomundi.egg-info/PKG-INFO +151 -0
- otel_neomundi-0.1.0/src/otel_neomundi.egg-info/SOURCES.txt +16 -0
- otel_neomundi-0.1.0/src/otel_neomundi.egg-info/dependency_links.txt +1 -0
- otel_neomundi-0.1.0/src/otel_neomundi.egg-info/requires.txt +18 -0
- otel_neomundi-0.1.0/src/otel_neomundi.egg-info/top_level.txt +1 -0
- otel_neomundi-0.1.0/tests/test_examples.py +55 -0
- otel_neomundi-0.1.0/tests/test_measured.py +204 -0
- otel_neomundi-0.1.0/tests/test_never_raises.py +136 -0
- otel_neomundi-0.1.0/tests/test_qualify.py +106 -0
- otel_neomundi-0.1.0/tests/test_refusals.py +214 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: otel-neomundi
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Measure model calls an application already traces with OpenTelemetry, with the NeoMundi measurement API
|
|
5
|
+
Author-email: Sebastien FAVRE <sebastien@neomundi.org>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/neomundi-io/neomundi-integrations/tree/main/integrations/otel
|
|
8
|
+
Project-URL: Repository, https://github.com/neomundi-io/neomundi-integrations
|
|
9
|
+
Project-URL: Documentation, https://github.com/neomundi-io/neomundi-integrations/tree/main/integrations/otel#readme
|
|
10
|
+
Project-URL: Changelog, https://github.com/neomundi-io/neomundi-integrations/blob/main/integrations/otel/CHANGELOG.md
|
|
11
|
+
Project-URL: Issues, https://github.com/neomundi-io/neomundi-integrations/issues
|
|
12
|
+
Keywords: opentelemetry,otel,genai,neomundi,ai-governance,llm-measurement,observability
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: opentelemetry-sdk<2.0,>=1.45.2
|
|
23
|
+
Requires-Dist: neomundi<3.0,>=2.1.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
26
|
+
Requires-Dist: openai>=1.26.0; extra == "dev"
|
|
27
|
+
Requires-Dist: opentelemetry-instrumentation-openai-v2==2.4b0; extra == "dev"
|
|
28
|
+
Requires-Dist: opentelemetry-util-genai<1.2,>=1.1b0; extra == "dev"
|
|
29
|
+
Provides-Extra: examples
|
|
30
|
+
Requires-Dist: openai>=1.26.0; extra == "examples"
|
|
31
|
+
Requires-Dist: opentelemetry-instrumentation-openai-v2==2.4b0; extra == "examples"
|
|
32
|
+
Requires-Dist: opentelemetry-util-genai<1.2,>=1.1b0; extra == "examples"
|
|
33
|
+
Provides-Extra: notebook
|
|
34
|
+
Requires-Dist: nbformat>=5.9; extra == "notebook"
|
|
35
|
+
Requires-Dist: nbclient>=0.9; extra == "notebook"
|
|
36
|
+
Requires-Dist: ipykernel>=6.29; extra == "notebook"
|
|
37
|
+
|
|
38
|
+
<div align="center">
|
|
39
|
+
|
|
40
|
+
[](README.md) · [](README_FR.md)
|
|
41
|
+
|
|
42
|
+
# OpenTelemetry × NeoMundi
|
|
43
|
+
|
|
44
|
+
**Measure the model calls your application already traces — one span processor next to your exporters, the latency your trace already observed, and the NeoMundi `request_id` written back into the same trace.**
|
|
45
|
+
|
|
46
|
+
**[Quickstart](#quickstart)** · **[What it refuses to do](#refusals)** · **[Notebook](notebooks/quickstart.ipynb)** · **[Limitations](LIMITATIONS.md)** · **[Cost](#what-it-costs)**
|
|
47
|
+
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
> **Evidence level: E1 — offline only.** No real measurement has been
|
|
53
|
+
> taken with this package: the window that built it had no NeoMundi
|
|
54
|
+
> service verification key. The suite drives the real `openai` client, the
|
|
55
|
+
> real contrib openai-v2 instrumentation and the real OpenTelemetry SDK
|
|
56
|
+
> through mock transports. See [LIMITATIONS.md §9](LIMITATIONS.md#9-evidence-level-e1-not-e2).
|
|
57
|
+
|
|
58
|
+
## What this is
|
|
59
|
+
|
|
60
|
+
`NeoMundiSpanProcessor` is an OpenTelemetry `SpanProcessor`. You add it to
|
|
61
|
+
the tracer provider your application already uses. Around a model call you
|
|
62
|
+
want measured, you open an interaction and declare the token count your
|
|
63
|
+
provider returned; the processor finds the GenAI span your instrumentation
|
|
64
|
+
produced inside it, takes its latency, model and trace identity, and
|
|
65
|
+
submits to NeoMundi's `POST /v1/govern` through the `neomundi` SDK. The
|
|
66
|
+
`request_id` is then set on a `neomundi.interaction` span in the **same
|
|
67
|
+
trace**, which your exporter ships to your backend.
|
|
68
|
+
|
|
69
|
+
## What it is not
|
|
70
|
+
|
|
71
|
+
- **Not a way to measure spans on their own.** A span's `gen_ai.usage.*` is written by an instrumentation, and we measured one that replaces the provider's count with an estimate while the span looks the same. A span's count is **never** submitted ([LIMITATIONS §1](LIMITATIONS.md#1-a-spans-token-count-is-never-measured--and-that-is-the-design)).
|
|
72
|
+
- **Not zero-touch.** One `with` block per measured call, to declare the count.
|
|
73
|
+
- **Not an instrumentation.** It reads the GenAI span of whichever instrumentation you run; it installs none.
|
|
74
|
+
- **Not a tracer, evaluator or truth checker.** Every submission is a billed measurement; NeoMundi verifies integrity and authenticity, not whether an answer was true.
|
|
75
|
+
|
|
76
|
+
## Install
|
|
77
|
+
|
|
78
|
+
Not on PyPI yet — `pip install otel-neomundi` does not work. Install from
|
|
79
|
+
the repository:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install 'git+https://github.com/neomundi-io/neomundi-integrations.git#subdirectory=integrations/otel'
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Python ≥ 3.11. Depends on `opentelemetry-sdk>=1.45.2,<2.0` and
|
|
86
|
+
`neomundi>=2.1.0,<3.0`. If you use the contrib openai-v2 instrumentation,
|
|
87
|
+
pin `opentelemetry-util-genai>=1.1b0,<1.2` — the latest release breaks its
|
|
88
|
+
import ([LIMITATIONS §6](LIMITATIONS.md#6-the-latest-contrib-instrumentation-does-not-import-as-pip-installs-it)).
|
|
89
|
+
|
|
90
|
+
## Quickstart
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
processor = NeoMundiSpanProcessor(
|
|
94
|
+
api_key=..., base_url="https://api.neomundi.io", tracer_provider=tracer_provider
|
|
95
|
+
)
|
|
96
|
+
tracer_provider.add_span_processor(processor) # next to your exporters
|
|
97
|
+
|
|
98
|
+
with processor.interaction() as interaction:
|
|
99
|
+
reply = client.chat.completions.create(model=..., messages=...)
|
|
100
|
+
# The count the PROVIDER returned -- or None if it returned none.
|
|
101
|
+
interaction.declare(token_count=reply.usage.total_tokens if reply.usage else None)
|
|
102
|
+
|
|
103
|
+
print(interaction.outcome.status, interaction.outcome.request_id)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Free first: `NeoMundiSpanProcessor(submit=False, tracer_provider=...)`
|
|
107
|
+
needs no key, opens no socket, and tells you which of your calls would be
|
|
108
|
+
measured. Runnable, offline: [`examples/01_offline_interaction.py`](examples/01_offline_interaction.py)
|
|
109
|
+
and the [notebook](notebooks/quickstart.ipynb).
|
|
110
|
+
|
|
111
|
+
## Refusals
|
|
112
|
+
|
|
113
|
+
Every interaction ends with an `Outcome` and an explicit status. Nothing is
|
|
114
|
+
submitted, and nothing is billed, when:
|
|
115
|
+
|
|
116
|
+
| Status | Why |
|
|
117
|
+
|---|---|
|
|
118
|
+
| `not_submitted_no_token_count` | nothing declared — **even if the span carries `gen_ai.usage.*`** |
|
|
119
|
+
| `not_submitted_invalid_token_count` | the declared count is not a positive integer |
|
|
120
|
+
| `not_submitted_no_genai_span` | no GenAI span inside the interaction, or the processor is on another provider |
|
|
121
|
+
| `not_submitted_ambiguous_spans` | several GenAI spans: which call is meant is not guessed |
|
|
122
|
+
| `not_submitted_unsupported_operation` | not chat / text completion / generate content, or no operation name |
|
|
123
|
+
| `not_submitted_application_error` | your block raised (re-raised unchanged), or the span status is `ERROR` |
|
|
124
|
+
| `not_submitted_no_latency` | the span has no usable start and end |
|
|
125
|
+
| `skipped_sampling` / `not_submitted_local_only` | `sample_rate` excluded it / `submit=False` |
|
|
126
|
+
| `not_submitted_transport_error` | the API was unreachable — your call was not affected |
|
|
127
|
+
|
|
128
|
+
No exception from this package reaches your application. Outcomes carry no
|
|
129
|
+
prompt, response or key — only lengths and identifiers.
|
|
130
|
+
[`examples/02_refusals.py`](examples/02_refusals.py) shows each one on a real span.
|
|
131
|
+
|
|
132
|
+
## What it costs
|
|
133
|
+
|
|
134
|
+
🔴 **Every submitted observation is a billed measurement** (0.030 CHF on
|
|
135
|
+
TIER_03). A span alone is never billed; only an interaction with a declared
|
|
136
|
+
count. `sample_rate` (default `1.0`) is deterministic in the trace id.
|
|
137
|
+
**Kill switch:** `processor.sample_rate = 0.0`, immediate.
|
|
138
|
+
|
|
139
|
+
## Honest status
|
|
140
|
+
|
|
141
|
+
| | |
|
|
142
|
+
|---|---|
|
|
143
|
+
| Offline test suite | 48 tests, green on Python 3.12 / Linux locally; CI runs 3.11–3.13 on Linux, macOS, Windows |
|
|
144
|
+
| Real execution | **none** — E1. 0 observations submitted, 0 re-read. `qualify.py` ready; dry run green against a scripted endpoint |
|
|
145
|
+
| Maturity | experimental |
|
|
146
|
+
|
|
147
|
+
Read [LIMITATIONS.md](LIMITATIONS.md) before drawing a conclusion from any score.
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
Apache-2.0. See [LICENSE](../../LICENSE).
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
[](README.md) · [](README_FR.md)
|
|
4
|
+
|
|
5
|
+
# OpenTelemetry × NeoMundi
|
|
6
|
+
|
|
7
|
+
**Measure the model calls your application already traces — one span processor next to your exporters, the latency your trace already observed, and the NeoMundi `request_id` written back into the same trace.**
|
|
8
|
+
|
|
9
|
+
**[Quickstart](#quickstart)** · **[What it refuses to do](#refusals)** · **[Notebook](notebooks/quickstart.ipynb)** · **[Limitations](LIMITATIONS.md)** · **[Cost](#what-it-costs)**
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
> **Evidence level: E1 — offline only.** No real measurement has been
|
|
16
|
+
> taken with this package: the window that built it had no NeoMundi
|
|
17
|
+
> service verification key. The suite drives the real `openai` client, the
|
|
18
|
+
> real contrib openai-v2 instrumentation and the real OpenTelemetry SDK
|
|
19
|
+
> through mock transports. See [LIMITATIONS.md §9](LIMITATIONS.md#9-evidence-level-e1-not-e2).
|
|
20
|
+
|
|
21
|
+
## What this is
|
|
22
|
+
|
|
23
|
+
`NeoMundiSpanProcessor` is an OpenTelemetry `SpanProcessor`. You add it to
|
|
24
|
+
the tracer provider your application already uses. Around a model call you
|
|
25
|
+
want measured, you open an interaction and declare the token count your
|
|
26
|
+
provider returned; the processor finds the GenAI span your instrumentation
|
|
27
|
+
produced inside it, takes its latency, model and trace identity, and
|
|
28
|
+
submits to NeoMundi's `POST /v1/govern` through the `neomundi` SDK. The
|
|
29
|
+
`request_id` is then set on a `neomundi.interaction` span in the **same
|
|
30
|
+
trace**, which your exporter ships to your backend.
|
|
31
|
+
|
|
32
|
+
## What it is not
|
|
33
|
+
|
|
34
|
+
- **Not a way to measure spans on their own.** A span's `gen_ai.usage.*` is written by an instrumentation, and we measured one that replaces the provider's count with an estimate while the span looks the same. A span's count is **never** submitted ([LIMITATIONS §1](LIMITATIONS.md#1-a-spans-token-count-is-never-measured--and-that-is-the-design)).
|
|
35
|
+
- **Not zero-touch.** One `with` block per measured call, to declare the count.
|
|
36
|
+
- **Not an instrumentation.** It reads the GenAI span of whichever instrumentation you run; it installs none.
|
|
37
|
+
- **Not a tracer, evaluator or truth checker.** Every submission is a billed measurement; NeoMundi verifies integrity and authenticity, not whether an answer was true.
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
Not on PyPI yet — `pip install otel-neomundi` does not work. Install from
|
|
42
|
+
the repository:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install 'git+https://github.com/neomundi-io/neomundi-integrations.git#subdirectory=integrations/otel'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Python ≥ 3.11. Depends on `opentelemetry-sdk>=1.45.2,<2.0` and
|
|
49
|
+
`neomundi>=2.1.0,<3.0`. If you use the contrib openai-v2 instrumentation,
|
|
50
|
+
pin `opentelemetry-util-genai>=1.1b0,<1.2` — the latest release breaks its
|
|
51
|
+
import ([LIMITATIONS §6](LIMITATIONS.md#6-the-latest-contrib-instrumentation-does-not-import-as-pip-installs-it)).
|
|
52
|
+
|
|
53
|
+
## Quickstart
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
processor = NeoMundiSpanProcessor(
|
|
57
|
+
api_key=..., base_url="https://api.neomundi.io", tracer_provider=tracer_provider
|
|
58
|
+
)
|
|
59
|
+
tracer_provider.add_span_processor(processor) # next to your exporters
|
|
60
|
+
|
|
61
|
+
with processor.interaction() as interaction:
|
|
62
|
+
reply = client.chat.completions.create(model=..., messages=...)
|
|
63
|
+
# The count the PROVIDER returned -- or None if it returned none.
|
|
64
|
+
interaction.declare(token_count=reply.usage.total_tokens if reply.usage else None)
|
|
65
|
+
|
|
66
|
+
print(interaction.outcome.status, interaction.outcome.request_id)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Free first: `NeoMundiSpanProcessor(submit=False, tracer_provider=...)`
|
|
70
|
+
needs no key, opens no socket, and tells you which of your calls would be
|
|
71
|
+
measured. Runnable, offline: [`examples/01_offline_interaction.py`](examples/01_offline_interaction.py)
|
|
72
|
+
and the [notebook](notebooks/quickstart.ipynb).
|
|
73
|
+
|
|
74
|
+
## Refusals
|
|
75
|
+
|
|
76
|
+
Every interaction ends with an `Outcome` and an explicit status. Nothing is
|
|
77
|
+
submitted, and nothing is billed, when:
|
|
78
|
+
|
|
79
|
+
| Status | Why |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `not_submitted_no_token_count` | nothing declared — **even if the span carries `gen_ai.usage.*`** |
|
|
82
|
+
| `not_submitted_invalid_token_count` | the declared count is not a positive integer |
|
|
83
|
+
| `not_submitted_no_genai_span` | no GenAI span inside the interaction, or the processor is on another provider |
|
|
84
|
+
| `not_submitted_ambiguous_spans` | several GenAI spans: which call is meant is not guessed |
|
|
85
|
+
| `not_submitted_unsupported_operation` | not chat / text completion / generate content, or no operation name |
|
|
86
|
+
| `not_submitted_application_error` | your block raised (re-raised unchanged), or the span status is `ERROR` |
|
|
87
|
+
| `not_submitted_no_latency` | the span has no usable start and end |
|
|
88
|
+
| `skipped_sampling` / `not_submitted_local_only` | `sample_rate` excluded it / `submit=False` |
|
|
89
|
+
| `not_submitted_transport_error` | the API was unreachable — your call was not affected |
|
|
90
|
+
|
|
91
|
+
No exception from this package reaches your application. Outcomes carry no
|
|
92
|
+
prompt, response or key — only lengths and identifiers.
|
|
93
|
+
[`examples/02_refusals.py`](examples/02_refusals.py) shows each one on a real span.
|
|
94
|
+
|
|
95
|
+
## What it costs
|
|
96
|
+
|
|
97
|
+
🔴 **Every submitted observation is a billed measurement** (0.030 CHF on
|
|
98
|
+
TIER_03). A span alone is never billed; only an interaction with a declared
|
|
99
|
+
count. `sample_rate` (default `1.0`) is deterministic in the trace id.
|
|
100
|
+
**Kill switch:** `processor.sample_rate = 0.0`, immediate.
|
|
101
|
+
|
|
102
|
+
## Honest status
|
|
103
|
+
|
|
104
|
+
| | |
|
|
105
|
+
|---|---|
|
|
106
|
+
| Offline test suite | 48 tests, green on Python 3.12 / Linux locally; CI runs 3.11–3.13 on Linux, macOS, Windows |
|
|
107
|
+
| Real execution | **none** — E1. 0 observations submitted, 0 re-read. `qualify.py` ready; dry run green against a scripted endpoint |
|
|
108
|
+
| Maturity | experimental |
|
|
109
|
+
|
|
110
|
+
Read [LIMITATIONS.md](LIMITATIONS.md) before drawing a conclusion from any score.
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
Apache-2.0. See [LICENSE](../../LICENSE).
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "otel-neomundi"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Measure model calls an application already traces with OpenTelemetry, with the NeoMundi measurement API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
authors = [{ name = "Sebastien FAVRE", email = "sebastien@neomundi.org" }]
|
|
12
|
+
# The library floor. OpenTelemetry itself accepts 3.10.
|
|
13
|
+
requires-python = ">=3.11"
|
|
14
|
+
keywords = ["opentelemetry", "otel", "genai", "neomundi", "ai-governance", "llm-measurement", "observability"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Typing :: Typed",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
# Two dependencies: the measurement client and the SDK's SpanProcessor.
|
|
26
|
+
#
|
|
27
|
+
# No instrumentation is required: the processor reads the GenAI span of
|
|
28
|
+
# whichever instrumentation the application already runs. `opentelemetry-sdk`
|
|
29
|
+
# is floored at 1.45.2 because the span surface this relies on
|
|
30
|
+
# (`ReadableSpan`, `Span.parent`, attributes visible in `on_start`) was
|
|
31
|
+
# introspected on that release.
|
|
32
|
+
dependencies = [
|
|
33
|
+
"opentelemetry-sdk>=1.45.2,<2.0",
|
|
34
|
+
"neomundi>=2.1.0,<3.0",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
# The suite drives a REAL instrumentation (contrib openai-v2) around the
|
|
39
|
+
# real `openai` client, on `httpx.MockTransport`: no socket.
|
|
40
|
+
#
|
|
41
|
+
# `opentelemetry-util-genai` is capped below 1.2 on purpose: openai-v2 2.4b0
|
|
42
|
+
# declares it unbounded, but 1.2b0 and 1.3b0 removed a module it imports
|
|
43
|
+
# (`opentelemetry.util.genai.instruments`) and the import fails. Measured on
|
|
44
|
+
# 2026-11-26, LIMITATIONS.md §6.
|
|
45
|
+
dev = [
|
|
46
|
+
"pytest>=8.0",
|
|
47
|
+
"openai>=1.26.0",
|
|
48
|
+
"opentelemetry-instrumentation-openai-v2==2.4b0",
|
|
49
|
+
"opentelemetry-util-genai>=1.1b0,<1.2",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
# The examples drive the same instrumented client, offline.
|
|
53
|
+
examples = [
|
|
54
|
+
"openai>=1.26.0",
|
|
55
|
+
"opentelemetry-instrumentation-openai-v2==2.4b0",
|
|
56
|
+
"opentelemetry-util-genai>=1.1b0,<1.2",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
notebook = [
|
|
60
|
+
"nbformat>=5.9",
|
|
61
|
+
"nbclient>=0.9",
|
|
62
|
+
"ipykernel>=6.29",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[project.urls]
|
|
66
|
+
Homepage = "https://github.com/neomundi-io/neomundi-integrations/tree/main/integrations/otel"
|
|
67
|
+
Repository = "https://github.com/neomundi-io/neomundi-integrations"
|
|
68
|
+
Documentation = "https://github.com/neomundi-io/neomundi-integrations/tree/main/integrations/otel#readme"
|
|
69
|
+
Changelog = "https://github.com/neomundi-io/neomundi-integrations/blob/main/integrations/otel/CHANGELOG.md"
|
|
70
|
+
Issues = "https://github.com/neomundi-io/neomundi-integrations/issues"
|
|
71
|
+
|
|
72
|
+
[tool.setuptools.packages.find]
|
|
73
|
+
where = ["src"]
|
|
74
|
+
|
|
75
|
+
[tool.setuptools.package-data]
|
|
76
|
+
otel_neomundi = ["py.typed"]
|
|
77
|
+
|
|
78
|
+
[tool.pytest.ini_options]
|
|
79
|
+
testpaths = ["tests"]
|
|
80
|
+
python_files = ["test_*.py"]
|
|
81
|
+
addopts = "-q"
|
|
82
|
+
pythonpath = ["src", "tests"]
|
|
83
|
+
|
|
84
|
+
[tool.ruff]
|
|
85
|
+
line-length = 100
|
|
86
|
+
target-version = "py311"
|
|
87
|
+
|
|
88
|
+
[tool.ruff.lint]
|
|
89
|
+
select = ["E", "F", "W", "I", "B", "UP"]
|
|
90
|
+
ignore = ["E501"]
|
|
91
|
+
|
|
92
|
+
[tool.ruff.lint.per-file-ignores]
|
|
93
|
+
"src/otel_neomundi/__init__.py" = ["E402"]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Measure model calls an application already traces with OpenTelemetry.
|
|
2
|
+
|
|
3
|
+
One span processor, added next to the exporters the application already
|
|
4
|
+
runs. A span's token count is **never** submitted: it is written by an
|
|
5
|
+
instrumentation, not by the provider, and a span cannot prove where it came
|
|
6
|
+
from. The caller declares the provider's count; the span supplies the
|
|
7
|
+
latency it observed, the model and the trace identity, and the NeoMundi
|
|
8
|
+
``request_id`` is written back into the same trace.
|
|
9
|
+
|
|
10
|
+
See ``LIMITATIONS.md`` before drawing conclusions from a score.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from .processor import (
|
|
14
|
+
INTERACTION_SPAN_NAME,
|
|
15
|
+
NOT_SUBMITTED_AMBIGUOUS_SPANS,
|
|
16
|
+
NOT_SUBMITTED_APPLICATION_ERROR,
|
|
17
|
+
NOT_SUBMITTED_INTERNAL_ERROR,
|
|
18
|
+
NOT_SUBMITTED_INVALID_TOKEN_COUNT,
|
|
19
|
+
NOT_SUBMITTED_LOCAL_ONLY,
|
|
20
|
+
NOT_SUBMITTED_NO_GENAI_SPAN,
|
|
21
|
+
NOT_SUBMITTED_NO_LATENCY,
|
|
22
|
+
NOT_SUBMITTED_NO_TOKEN_COUNT,
|
|
23
|
+
NOT_SUBMITTED_TRANSPORT_ERROR,
|
|
24
|
+
NOT_SUBMITTED_UNSUPPORTED_OPERATION,
|
|
25
|
+
OUTCOMES,
|
|
26
|
+
SKIPPED_SAMPLING,
|
|
27
|
+
SUBMITTED,
|
|
28
|
+
Interaction,
|
|
29
|
+
NeoMundiSpanProcessor,
|
|
30
|
+
Outcome,
|
|
31
|
+
)
|
|
32
|
+
from .version import __version__
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
"__version__",
|
|
36
|
+
"NeoMundiSpanProcessor",
|
|
37
|
+
"Interaction",
|
|
38
|
+
"Outcome",
|
|
39
|
+
"OUTCOMES",
|
|
40
|
+
"SUBMITTED",
|
|
41
|
+
"SKIPPED_SAMPLING",
|
|
42
|
+
"NOT_SUBMITTED_LOCAL_ONLY",
|
|
43
|
+
"NOT_SUBMITTED_NO_TOKEN_COUNT",
|
|
44
|
+
"NOT_SUBMITTED_INVALID_TOKEN_COUNT",
|
|
45
|
+
"NOT_SUBMITTED_NO_GENAI_SPAN",
|
|
46
|
+
"NOT_SUBMITTED_AMBIGUOUS_SPANS",
|
|
47
|
+
"NOT_SUBMITTED_UNSUPPORTED_OPERATION",
|
|
48
|
+
"NOT_SUBMITTED_NO_LATENCY",
|
|
49
|
+
"NOT_SUBMITTED_APPLICATION_ERROR",
|
|
50
|
+
"NOT_SUBMITTED_TRANSPORT_ERROR",
|
|
51
|
+
"NOT_SUBMITTED_INTERNAL_ERROR",
|
|
52
|
+
"INTERACTION_SPAN_NAME",
|
|
53
|
+
]
|