genai-otel-instrument 0.1.2.dev0__py3-none-any.whl → 0.1.4.dev0__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.
Potentially problematic release.
This version of genai-otel-instrument might be problematic. Click here for more details.
- genai_otel/__version__.py +2 -2
- genai_otel/auto_instrument.py +18 -1
- genai_otel/config.py +3 -0
- genai_otel/cost_calculator.py +136 -11
- genai_otel/cost_enrichment_processor.py +177 -0
- genai_otel/instrumentors/base.py +74 -42
- genai_otel/instrumentors/cohere_instrumentor.py +80 -16
- genai_otel/instrumentors/huggingface_instrumentor.py +138 -13
- genai_otel/instrumentors/mistralai_instrumentor.py +249 -37
- genai_otel/instrumentors/ollama_instrumentor.py +104 -35
- genai_otel/instrumentors/replicate_instrumentor.py +59 -14
- genai_otel/instrumentors/togetherai_instrumentor.py +120 -16
- genai_otel/instrumentors/vertexai_instrumentor.py +79 -15
- genai_otel/llm_pricing.json +866 -586
- {genai_otel_instrument-0.1.2.dev0.dist-info → genai_otel_instrument-0.1.4.dev0.dist-info}/METADATA +45 -8
- {genai_otel_instrument-0.1.2.dev0.dist-info → genai_otel_instrument-0.1.4.dev0.dist-info}/RECORD +20 -19
- {genai_otel_instrument-0.1.2.dev0.dist-info → genai_otel_instrument-0.1.4.dev0.dist-info}/WHEEL +0 -0
- {genai_otel_instrument-0.1.2.dev0.dist-info → genai_otel_instrument-0.1.4.dev0.dist-info}/entry_points.txt +0 -0
- {genai_otel_instrument-0.1.2.dev0.dist-info → genai_otel_instrument-0.1.4.dev0.dist-info}/licenses/LICENSE +0 -0
- {genai_otel_instrument-0.1.2.dev0.dist-info → genai_otel_instrument-0.1.4.dev0.dist-info}/top_level.txt +0 -0
{genai_otel_instrument-0.1.2.dev0.dist-info → genai_otel_instrument-0.1.4.dev0.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: genai-otel-instrument
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4.dev0
|
|
4
4
|
Summary: Comprehensive OpenTelemetry auto-instrumentation for LLM/GenAI applications
|
|
5
5
|
Author-email: Kshitij Thakkar <kshitijthakkar@rocketmail.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -191,7 +191,7 @@ Dynamic: license-file
|
|
|
191
191
|
[](https://github.com/Mandark-droid/genai_otel_instrument/issues)
|
|
192
192
|
[](https://github.com/Mandark-droid/genai_otel_instrument/pulls)
|
|
193
193
|
|
|
194
|
-
[](https://github.com/Mandark-droid/genai_otel_instrument)
|
|
195
195
|
[](https://github.com/psf/black)
|
|
196
196
|
[](https://pycqa.github.io/isort/)
|
|
197
197
|
[](http://mypy-lang.org/)
|
|
@@ -255,9 +255,9 @@ For a more comprehensive demonstration of various LLM providers and MCP tools, r
|
|
|
255
255
|
## What Gets Instrumented?
|
|
256
256
|
|
|
257
257
|
### LLM Providers (Auto-detected)
|
|
258
|
-
- OpenAI, Anthropic, Google AI, AWS Bedrock, Azure OpenAI
|
|
259
|
-
-
|
|
260
|
-
-
|
|
258
|
+
- **With Full Cost Tracking**: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure OpenAI, Cohere, Mistral AI, Together AI, Groq, Ollama, Vertex AI
|
|
259
|
+
- **Hardware/Local Pricing**: Replicate (hardware-based $/second), HuggingFace (local execution, free)
|
|
260
|
+
- **Other Providers**: Anyscale
|
|
261
261
|
|
|
262
262
|
### Frameworks
|
|
263
263
|
- LangChain (chains, agents, tools)
|
|
@@ -271,15 +271,52 @@ For a more comprehensive demonstration of various LLM providers and MCP tools, r
|
|
|
271
271
|
- **APIs**: HTTP/REST requests (requests, httpx)
|
|
272
272
|
|
|
273
273
|
### OpenInference (Optional - Python 3.10+ only)
|
|
274
|
-
- Smolagents
|
|
275
|
-
- MCP
|
|
276
|
-
- LiteLLM
|
|
274
|
+
- Smolagents - HuggingFace smolagents framework tracing
|
|
275
|
+
- MCP - Model Context Protocol instrumentation
|
|
276
|
+
- LiteLLM - Multi-provider LLM proxy
|
|
277
|
+
|
|
278
|
+
**Cost Enrichment:** OpenInference instrumentors are automatically enriched with cost tracking! When cost tracking is enabled (`GENAI_ENABLE_COST_TRACKING=true`), a custom `CostEnrichmentSpanProcessor` extracts model and token usage from OpenInference spans and adds cost attributes (`gen_ai.usage.cost.total`, `gen_ai.usage.cost.prompt`, `gen_ai.usage.cost.completion`) using our comprehensive pricing database of 145+ models.
|
|
279
|
+
|
|
280
|
+
The processor supports OpenInference semantic conventions:
|
|
281
|
+
- Model: `llm.model_name`, `embedding.model_name`
|
|
282
|
+
- Tokens: `llm.token_count.prompt`, `llm.token_count.completion`
|
|
283
|
+
- Operations: `openinference.span.kind` (LLM, EMBEDDING, CHAIN, RETRIEVER, etc.)
|
|
277
284
|
|
|
278
285
|
**Note:** OpenInference instrumentors require Python >= 3.10. Install with:
|
|
279
286
|
```bash
|
|
280
287
|
pip install genai-otel-instrument[openinference]
|
|
281
288
|
```
|
|
282
289
|
|
|
290
|
+
## Cost Tracking Coverage
|
|
291
|
+
|
|
292
|
+
The library includes comprehensive cost tracking with pricing data for **145+ models** across **11 providers**:
|
|
293
|
+
|
|
294
|
+
### Providers with Full Token-Based Cost Tracking
|
|
295
|
+
- **OpenAI**: GPT-4o, GPT-4 Turbo, GPT-3.5 Turbo, o1/o3 series, embeddings, audio, vision (35+ models)
|
|
296
|
+
- **Anthropic**: Claude 3.5 Sonnet/Opus/Haiku, Claude 3 series (10+ models)
|
|
297
|
+
- **Google AI**: Gemini 1.5/2.0 Pro/Flash, PaLM 2 (12+ models)
|
|
298
|
+
- **AWS Bedrock**: Amazon Titan, Claude, Llama, Mistral models (20+ models)
|
|
299
|
+
- **Azure OpenAI**: Same as OpenAI with Azure-specific pricing
|
|
300
|
+
- **Cohere**: Command R/R+, Command Light, Embed v3/v2 (8+ models)
|
|
301
|
+
- **Mistral AI**: Mistral Large/Medium/Small, Mixtral, embeddings (8+ models)
|
|
302
|
+
- **Together AI**: DeepSeek-R1, Llama 3.x, Qwen, Mixtral (25+ models)
|
|
303
|
+
- **Groq**: Llama 3.x series, Mixtral, Gemma models (15+ models)
|
|
304
|
+
- **Ollama**: Local models with token tracking (pricing via cost estimation)
|
|
305
|
+
- **Vertex AI**: Gemini models via Google Cloud with usage metadata extraction
|
|
306
|
+
|
|
307
|
+
### Special Pricing Models
|
|
308
|
+
- **Replicate**: Hardware-based pricing ($/second of GPU/CPU time) - not token-based
|
|
309
|
+
- **HuggingFace Transformers**: Local execution - no API costs
|
|
310
|
+
|
|
311
|
+
### Pricing Features
|
|
312
|
+
- **Differential Pricing**: Separate rates for prompt tokens vs. completion tokens
|
|
313
|
+
- **Reasoning Tokens**: Special pricing for OpenAI o1/o3 reasoning tokens
|
|
314
|
+
- **Cache Pricing**: Anthropic prompt caching costs (read/write)
|
|
315
|
+
- **Granular Cost Metrics**: Per-request cost breakdown by token type
|
|
316
|
+
- **Auto-Updated Pricing**: Pricing data maintained in `llm_pricing.json`
|
|
317
|
+
|
|
318
|
+
**Coverage Statistics**: As of v0.1.3, 89% test coverage with 415 passing tests, including comprehensive cost calculation validation and cost enrichment processor tests (supporting both GenAI and OpenInference semantic conventions).
|
|
319
|
+
|
|
283
320
|
## Collected Telemetry
|
|
284
321
|
|
|
285
322
|
### Traces
|
{genai_otel_instrument-0.1.2.dev0.dist-info → genai_otel_instrument-0.1.4.dev0.dist-info}/RECORD
RENAMED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
genai_otel/__init__.py,sha256=OWgm1dihRkwBQU8fUPnVhE5XCZeF5f15UyH4w6LqGZU,4469
|
|
2
|
-
genai_otel/__version__.py,sha256=
|
|
3
|
-
genai_otel/auto_instrument.py,sha256=
|
|
2
|
+
genai_otel/__version__.py,sha256=tXTq07HZiURpZCu7BgCUswwpzaUPCRD2c6IN9cDtmRo,751
|
|
3
|
+
genai_otel/auto_instrument.py,sha256=NF0Bo_sFMynSmXNh5KFxdsJQPKuPE2NI_bel1i-CtxU,16260
|
|
4
4
|
genai_otel/cli.py,sha256=mbhaTU0WIAkvPKdIing-guIxPDjEKQftChWQUtPFzkY,3170
|
|
5
|
-
genai_otel/config.py,sha256=
|
|
6
|
-
genai_otel/cost_calculator.py,sha256=
|
|
5
|
+
genai_otel/config.py,sha256=hVdvUd1B1aPPUom6PHVi57BoNu-skZvzqLxy2H4mRXQ,6851
|
|
6
|
+
genai_otel/cost_calculator.py,sha256=g5yL9fcOXVXR_zd-d0mU4C2FRV_X47mM0aies6YGaak,15293
|
|
7
|
+
genai_otel/cost_enrichment_processor.py,sha256=iVpJYkDrtlQOm0vMXXYuwctd-p9tgi3NOmTIM3U1xBo,7314
|
|
7
8
|
genai_otel/exceptions.py,sha256=gIRvbI7c4V-M-PG9jS0o4ESRwHUWCm6DVihjfyJI1yg,429
|
|
8
9
|
genai_otel/gpu_metrics.py,sha256=gHqV17mJ59VscilR_Bcd1ccBDdDiUs5w0bE1hNk7NqI,11168
|
|
9
|
-
genai_otel/llm_pricing.json,sha256=
|
|
10
|
+
genai_otel/llm_pricing.json,sha256=ySmIN-tAbAdyYnOWNlyvxX-NB5nUzwq4aIDKefE7ALQ,21692
|
|
10
11
|
genai_otel/logging_config.py,sha256=XSBeslTqeHUBBadKJV2W8JFIOXorEVZ6W0xqNKjiPlA,1463
|
|
11
12
|
genai_otel/metrics.py,sha256=Vngwtc1MAMAE7JVpbT_KfiCQ5TdIAKIs_0oztjJdDTg,2671
|
|
12
13
|
genai_otel/py.typed,sha256=oe-lun16QtsTO6qa3gicjgj_F4jU7LSKCnBYLr6P5Yk,88
|
|
@@ -15,19 +16,19 @@ genai_otel/instrumentors/anthropic_instrumentor.py,sha256=3koeXSJccALdZiRibavwQt
|
|
|
15
16
|
genai_otel/instrumentors/anyscale_instrumentor.py,sha256=WUcQVDK8W76gkrAT_TLgzFd7NY42Rn6x0irT7VV2bbI,774
|
|
16
17
|
genai_otel/instrumentors/aws_bedrock_instrumentor.py,sha256=W469XxNVsb6eDjerk3SkjZFZEOIzH_HkBkmqqSCRBhU,3670
|
|
17
18
|
genai_otel/instrumentors/azure_openai_instrumentor.py,sha256=HumsAAtW9YzbcyBCrIGhE5KvZ6-mxSbsEoI_W0JU7xg,2428
|
|
18
|
-
genai_otel/instrumentors/base.py,sha256=
|
|
19
|
-
genai_otel/instrumentors/cohere_instrumentor.py,sha256=
|
|
19
|
+
genai_otel/instrumentors/base.py,sha256=dNsJfhKgrZO8dLdEb45roh4WcwrTfFWyCNhhmWDcPnE,26187
|
|
20
|
+
genai_otel/instrumentors/cohere_instrumentor.py,sha256=SRi2CRA1XUbup_UdE6OEgSxqlyUfVXaiVy-ULXvLZGM,5214
|
|
20
21
|
genai_otel/instrumentors/google_ai_instrumentor.py,sha256=ExNo0_OxfCxaRpuUXYU8UZ-ClQRHRLUvf7-kMC6zdc8,2984
|
|
21
22
|
genai_otel/instrumentors/groq_instrumentor.py,sha256=bCm7IDmDyvg0-XuzcCSO5xf9QvDlQGwb7bdQ_ooS6QI,3398
|
|
22
|
-
genai_otel/instrumentors/huggingface_instrumentor.py,sha256=
|
|
23
|
+
genai_otel/instrumentors/huggingface_instrumentor.py,sha256=QiOGC09KY6fdmHHHXHidVDcZikDPC3tI63scmJ0wW9I,9136
|
|
23
24
|
genai_otel/instrumentors/langchain_instrumentor.py,sha256=1Y_zGBQcUNrh877k146XOW4wLBXBkNtbyuEkORXFIyQ,2760
|
|
24
25
|
genai_otel/instrumentors/llamaindex_instrumentor.py,sha256=zZ1J7W4yQo1Ur6Y5y0UXpDdEx9oDnmsqNIin5Jrv9os,1206
|
|
25
|
-
genai_otel/instrumentors/mistralai_instrumentor.py,sha256=
|
|
26
|
-
genai_otel/instrumentors/ollama_instrumentor.py,sha256=
|
|
26
|
+
genai_otel/instrumentors/mistralai_instrumentor.py,sha256=OU8O81wdBLTEwnkMfDQpk0oBisSpUukXlm4JYdnfEg0,12789
|
|
27
|
+
genai_otel/instrumentors/ollama_instrumentor.py,sha256=lv45qf8Cqe_HmF7BIMojZcBFK8AA13uUrCVOKAFhN0k,5286
|
|
27
28
|
genai_otel/instrumentors/openai_instrumentor.py,sha256=0q2vml2oWnTRzfVTEP0_njfxqZS8b3Qek-apeecXvvs,9263
|
|
28
|
-
genai_otel/instrumentors/replicate_instrumentor.py,sha256
|
|
29
|
-
genai_otel/instrumentors/togetherai_instrumentor.py,sha256
|
|
30
|
-
genai_otel/instrumentors/vertexai_instrumentor.py,sha256=
|
|
29
|
+
genai_otel/instrumentors/replicate_instrumentor.py,sha256=-G_Tj0VkAfg-cOKvnk4G56eJiADjyIgv6xEgyAWlFdw,3028
|
|
30
|
+
genai_otel/instrumentors/togetherai_instrumentor.py,sha256=--r0YhCBIrpgyFiUwwc1LFTPoxAAXXV4lOAD66laqEY,5414
|
|
31
|
+
genai_otel/instrumentors/vertexai_instrumentor.py,sha256=F0-z0YXANHqccTT3SHbr7ggj3l4ebI_WwubIkPYPa68,4058
|
|
31
32
|
genai_otel/mcp_instrumentors/__init__.py,sha256=0yVx5bwFxCmI72BORDKLgkn0t5h_xRXvtjUskVE60eo,512
|
|
32
33
|
genai_otel/mcp_instrumentors/api_instrumentor.py,sha256=tAogtajeq4zjaM4-05XYSOzD3ig2mXX9_xFyGHL4auQ,5690
|
|
33
34
|
genai_otel/mcp_instrumentors/base.py,sha256=oF_GyGZPEDS-NapIYzM_-TV1KYJeVlXXFzxzs9sMsqU,4044
|
|
@@ -36,9 +37,9 @@ genai_otel/mcp_instrumentors/kafka_instrumentor.py,sha256=QJYJC1rvo_zZAIaw-cp_Ic
|
|
|
36
37
|
genai_otel/mcp_instrumentors/manager.py,sha256=1Pj5lkEOL8Yq1Oeud4ZExN6k6NLIVtTzKnFLNiFdJvw,5895
|
|
37
38
|
genai_otel/mcp_instrumentors/redis_instrumentor.py,sha256=KUbs0dMyfMzU4T0SS8u43I5fvr09lcBBM92I3KCsYUw,943
|
|
38
39
|
genai_otel/mcp_instrumentors/vector_db_instrumentor.py,sha256=2vhnk4PGpfYKr-XlRbnCIOap4BPKHOn--fh-ai2YXlM,9994
|
|
39
|
-
genai_otel_instrument-0.1.
|
|
40
|
-
genai_otel_instrument-0.1.
|
|
41
|
-
genai_otel_instrument-0.1.
|
|
42
|
-
genai_otel_instrument-0.1.
|
|
43
|
-
genai_otel_instrument-0.1.
|
|
44
|
-
genai_otel_instrument-0.1.
|
|
40
|
+
genai_otel_instrument-0.1.4.dev0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
41
|
+
genai_otel_instrument-0.1.4.dev0.dist-info/METADATA,sha256=jY6ORZ3rNiaqaygHDhgZE3t4cYEzdRb4k26GY18B29I,30063
|
|
42
|
+
genai_otel_instrument-0.1.4.dev0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
43
|
+
genai_otel_instrument-0.1.4.dev0.dist-info/entry_points.txt,sha256=E9UqoHA_fq69yNGAY3SRYf5HH94sZT5DiDueiU1v0KM,57
|
|
44
|
+
genai_otel_instrument-0.1.4.dev0.dist-info/top_level.txt,sha256=cvCm8PUwvYUSQKruk-x6S-_YuDyhOBk8gD910XICcbg,11
|
|
45
|
+
genai_otel_instrument-0.1.4.dev0.dist-info/RECORD,,
|
{genai_otel_instrument-0.1.2.dev0.dist-info → genai_otel_instrument-0.1.4.dev0.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|