genai-otel-instrument 0.1.1.dev0__tar.gz → 0.1.4.dev0__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.

Potentially problematic release.


This version of genai-otel-instrument might be problematic. Click here for more details.

Files changed (210) hide show
  1. genai_otel_instrument-0.1.4.dev0/.claude/settings.local.json +9 -0
  2. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/CHANGELOG.md +213 -1
  3. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/PKG-INFO +230 -10
  4. genai_otel_instrument-0.1.4.dev0/README.md +503 -0
  5. genai_otel_instrument-0.1.4.dev0/examples/demo/docker-compose.yml +120 -0
  6. genai_otel_instrument-0.1.4.dev0/examples/demo/grafana/dashboards/genai-metrics-dashboard.json +452 -0
  7. genai_otel_instrument-0.1.4.dev0/examples/demo/grafana/dashboards/genai-traces-dashboard.json +126 -0
  8. genai_otel_instrument-0.1.4.dev0/examples/demo/grafana/provisioning/datasources/jaeger.yml +11 -0
  9. genai_otel_instrument-0.1.4.dev0/examples/demo/grafana/provisioning/datasources/prometheus.yml +9 -0
  10. genai_otel_instrument-0.1.4.dev0/examples/demo/otel-collector-config.yml +43 -0
  11. genai_otel_instrument-0.1.4.dev0/examples/demo/prometheus.yml +23 -0
  12. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/__version__.py +3 -3
  13. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/auto_instrument.py +18 -1
  14. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/config.py +3 -0
  15. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/cost_calculator.py +136 -11
  16. genai_otel_instrument-0.1.4.dev0/genai_otel/cost_enrichment_processor.py +177 -0
  17. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/gpu_metrics.py +34 -0
  18. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/base.py +74 -42
  19. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/cohere_instrumentor.py +140 -0
  20. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/huggingface_instrumentor.py +222 -0
  21. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/mistralai_instrumentor.py +331 -0
  22. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/ollama_instrumentor.py +152 -0
  23. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/replicate_instrumentor.py +87 -0
  24. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/togetherai_instrumentor.py +146 -0
  25. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/vertexai_instrumentor.py +106 -0
  26. genai_otel_instrument-0.1.4.dev0/genai_otel/llm_pricing.json +869 -0
  27. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel_instrument.egg-info/PKG-INFO +230 -10
  28. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel_instrument.egg-info/SOURCES.txt +18 -11
  29. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/pyproject.toml +0 -2
  30. genai_otel_instrument-0.1.4.dev0/scripts/add_ollama_pricing.py +108 -0
  31. genai_otel_instrument-0.1.4.dev0/scripts/debug/test_litellm_instrumentation.py +97 -0
  32. genai_otel_instrument-0.1.4.dev0/scripts/debug/test_ollama_cost.py +84 -0
  33. genai_otel_instrument-0.1.4.dev0/scripts/debug/test_ollama_span_attributes.py +55 -0
  34. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_cohere_instrumentor.py +70 -28
  35. genai_otel_instrument-0.1.4.dev0/tests/instrumentors/test_huggingface_instrumentor.py +401 -0
  36. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_mistralai_instrumentor.py +46 -13
  37. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_ollama_instrumentor.py +79 -37
  38. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_replicate_instrumentor.py +19 -52
  39. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_togetherai_instrumentor.py +53 -59
  40. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_vertexai_instrumentor.py +56 -52
  41. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_auto_instrument.py +5 -3
  42. genai_otel_instrument-0.1.4.dev0/tests/test_cost_enrichment_processor.py +457 -0
  43. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_gpu_metrics.py +30 -9
  44. genai_otel_instrument-0.1.1.dev0/.claude/settings.local.json +0 -10
  45. genai_otel_instrument-0.1.1.dev0/README.md +0 -283
  46. genai_otel_instrument-0.1.1.dev0/baseline_tests.txt +0 -64
  47. genai_otel_instrument-0.1.1.dev0/combine_code.sh +0 -16
  48. genai_otel_instrument-0.1.1.dev0/combined_code_all.txt +0 -0
  49. genai_otel_instrument-0.1.1.dev0/examples/demo/docker-compose.yml +0 -39
  50. genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/cohere_instrumentor.py +0 -76
  51. genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/huggingface_instrumentor.py +0 -97
  52. genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/mistralai_instrumentor.py +0 -119
  53. genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/ollama_instrumentor.py +0 -83
  54. genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/replicate_instrumentor.py +0 -42
  55. genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/togetherai_instrumentor.py +0 -42
  56. genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/vertexai_instrumentor.py +0 -42
  57. genai_otel_instrument-0.1.1.dev0/genai_otel/llm_pricing.json +0 -589
  58. genai_otel_instrument-0.1.1.dev0/merge_project.sh +0 -101
  59. genai_otel_instrument-0.1.1.dev0/phase1_partial_tests.txt +0 -66
  60. genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_huggingface_instrumentor.py +0 -220
  61. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/.github/workflows/README.md +0 -0
  62. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/.github/workflows/pre-release-check.yml +0 -0
  63. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/.github/workflows/publish.yml +0 -0
  64. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/.github/workflows/test.yml +0 -0
  65. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/.gitignore +0 -0
  66. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/.gitignore +0 -0
  67. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/genai_otel_instrument.iml +0 -0
  68. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/inspectionProfiles/Project_Default.xml +0 -0
  69. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
  70. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/misc.xml +0 -0
  71. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/modules.xml +0 -0
  72. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/vcs.xml +0 -0
  73. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/.pylintrc +0 -0
  74. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/Contributing.md +0 -0
  75. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/LICENSE +0 -0
  76. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/MANIFEST.in +0 -0
  77. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/OTEL_SEMANTIC_COMPATIBILITY.md +0 -0
  78. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/OTEL_SEMANTIC_GAP_ANALYSIS_AND_IMPLEMENTATION_PLAN.md +0 -0
  79. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/PRE_RELEASE_CHECKLIST.md +0 -0
  80. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/TEST_COVERAGE_CHECKLIST.md +0 -0
  81. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/TROUBLESHOOTING.md +0 -0
  82. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/example_usage.py +0 -0
  83. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/README.md +0 -0
  84. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/anthropic/.env.example +0 -0
  85. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/anthropic/README.md +0 -0
  86. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/anthropic/example.py +0 -0
  87. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/aws_bedrock/.env.example +0 -0
  88. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/aws_bedrock/README.md +0 -0
  89. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/aws_bedrock/example.py +0 -0
  90. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/azure_openai/.env.example +0 -0
  91. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/azure_openai/README.md +0 -0
  92. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/azure_openai/example.py +0 -0
  93. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/cohere/.env.example +0 -0
  94. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/cohere/README.md +0 -0
  95. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/cohere/example.py +0 -0
  96. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/demo/.env.example +0 -0
  97. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/demo/Dockerfile +0 -0
  98. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/demo/README.md +0 -0
  99. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/demo/app.py +0 -0
  100. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/demo/requirements.txt +0 -0
  101. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/google_ai/.env.example +0 -0
  102. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/google_ai/README.md +0 -0
  103. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/google_ai/example.py +0 -0
  104. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/groq/.env.example +0 -0
  105. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/groq/README.md +0 -0
  106. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/groq/example.py +0 -0
  107. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/huggingface/.env.example +0 -0
  108. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/huggingface/README.md +0 -0
  109. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/huggingface/example.py +0 -0
  110. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/langchain/.env.example +0 -0
  111. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/langchain/README.md +0 -0
  112. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/langchain/example.py +0 -0
  113. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/litellm/example.py +0 -0
  114. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/llamaindex/.env.example +0 -0
  115. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/llamaindex/README.md +0 -0
  116. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/llamaindex/example.py +0 -0
  117. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/mistralai/.env.example +0 -0
  118. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/mistralai/README.md +0 -0
  119. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/mistralai/example.py +0 -0
  120. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/ollama/.env.example +0 -0
  121. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/ollama/README.md +0 -0
  122. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/ollama/example.py +0 -0
  123. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/openai/.env.example +0 -0
  124. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/openai/README.md +0 -0
  125. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/openai/example.py +0 -0
  126. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/replicate/.env.example +0 -0
  127. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/replicate/README.md +0 -0
  128. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/replicate/example.py +0 -0
  129. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/smolagents/example.py +0 -0
  130. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/togetherai/.env.example +0 -0
  131. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/togetherai/README.md +0 -0
  132. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/togetherai/example.py +0 -0
  133. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/vertexai/.env.example +0 -0
  134. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/vertexai/README.md +0 -0
  135. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/vertexai/example.py +0 -0
  136. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/__init__.py +0 -0
  137. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/cli.py +0 -0
  138. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/exceptions.py +0 -0
  139. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/__init__.py +0 -0
  140. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/anthropic_instrumentor.py +0 -0
  141. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/anyscale_instrumentor.py +0 -0
  142. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/aws_bedrock_instrumentor.py +0 -0
  143. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/azure_openai_instrumentor.py +0 -0
  144. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/google_ai_instrumentor.py +0 -0
  145. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/groq_instrumentor.py +0 -0
  146. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/langchain_instrumentor.py +0 -0
  147. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/llamaindex_instrumentor.py +0 -0
  148. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/openai_instrumentor.py +0 -0
  149. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/logging_config.py +0 -0
  150. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/__init__.py +0 -0
  151. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/api_instrumentor.py +0 -0
  152. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/base.py +0 -0
  153. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/database_instrumentor.py +0 -0
  154. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/kafka_instrumentor.py +0 -0
  155. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/manager.py +0 -0
  156. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/redis_instrumentor.py +0 -0
  157. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/vector_db_instrumentor.py +0 -0
  158. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/metrics.py +0 -0
  159. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/py.typed +0 -0
  160. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel_instrument.egg-info/dependency_links.txt +0 -0
  161. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel_instrument.egg-info/entry_points.txt +0 -0
  162. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel_instrument.egg-info/requires.txt +0 -0
  163. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel_instrument.egg-info/top_level.txt +0 -0
  164. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/openlit/semcov.py +0 -0
  165. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/requirements-dev.txt +0 -0
  166. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/requirements-testing.txt +0 -0
  167. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/requirements.txt +0 -0
  168. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/sample.env +0 -0
  169. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0/scripts/debug}/simple_test.py +0 -0
  170. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0/scripts/debug}/test_example_debug.py +0 -0
  171. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0/scripts/debug}/test_exporter_fix.py +0 -0
  172. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0/scripts/debug}/test_final.py +0 -0
  173. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0/scripts/debug}/test_gpu_debug.py +0 -0
  174. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0/scripts/debug}/test_gpu_metrics.py +0 -0
  175. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/scripts/fix_all_deps.sh +0 -0
  176. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/scripts/fix_instrumentors.py +0 -0
  177. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/scripts/test_installation.py +0 -0
  178. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/scripts/test_release.sh +0 -0
  179. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/setup.cfg +0 -0
  180. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/setup.py +0 -0
  181. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/__init__.py +0 -0
  182. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_anthropic_instrumentor.py +0 -0
  183. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_anyscale_instrumentor.py +0 -0
  184. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_aws_bedrock_instrumentor.py +0 -0
  185. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_azure_openai_instrumentor.py +0 -0
  186. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_base.py +0 -0
  187. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_google_ai_instrumentor.py +0 -0
  188. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_groq_instrumentor.py +0 -0
  189. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_langchain_instrumentor.py +0 -0
  190. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_litellm_instrumentor.py +0 -0
  191. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_llamaindex_instrumentor.py +0 -0
  192. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_mcp_instrumentor.py +0 -0
  193. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_openai_instrumentor.py +0 -0
  194. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_smolagents_instrumentor.py +0 -0
  195. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_api_instrumentor.py +0 -0
  196. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_database_instrumentor.py +0 -0
  197. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_kafka_instrumentor.py +0 -0
  198. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_manager.py +0 -0
  199. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_mcp_base.py +0 -0
  200. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_redis_instrumentor.py +0 -0
  201. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_vector_db_instrumentor.py +0 -0
  202. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_cli.py +0 -0
  203. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_config.py +0 -0
  204. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_cost_calculator.py +0 -0
  205. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_exceptions.py +0 -0
  206. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_init.py +0 -0
  207. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_logging_config.py +0 -0
  208. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_metrics.py +0 -0
  209. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_openai_instrumentor.py +0 -0
  210. {genai_otel_instrument-0.1.1.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_otel_setup.py +0 -0
@@ -0,0 +1,9 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+
5
+ ],
6
+ "deny": [],
7
+ "ask": []
8
+ }
9
+ }
@@ -6,6 +6,217 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ### Added
10
+
11
+ - **HuggingFace InferenceClient Instrumentation**
12
+ - Added full instrumentation support for HuggingFace Inference API via `InferenceClient`
13
+ - Enables observability for smolagents workflows using `InferenceClientModel`
14
+ - Wraps `InferenceClient.chat_completion()` and `InferenceClient.text_generation()` methods
15
+ - Creates child spans showing actual HuggingFace API calls under agent/tool spans
16
+ - Extracts model name, temperature, max_tokens, top_p from API calls
17
+ - Supports both object and dict response formats for token usage
18
+ - Handles streaming responses with `gen_ai.server.ttft` and `gen_ai.streaming.token_count`
19
+ - Cost tracking enabled via fallback estimation based on model parameter count
20
+ - Implementation in `genai_otel/instrumentors/huggingface_instrumentor.py:141-222`
21
+ - Added 10 comprehensive tests covering all InferenceClient functionality
22
+ - Coverage increased from 85% → 98% for HuggingFace instrumentor
23
+ - Resolves issue where only AGENT and TOOL spans were visible without LLM child spans
24
+
25
+ - **Fallback Cost Estimation for Local Models (Ollama & HuggingFace)**
26
+ - Added 36 Ollama models to `llm_pricing.json` with parameter-count-based pricing tiers
27
+ - Implemented intelligent fallback cost estimation for unknown local models in `CostCalculator`
28
+ - Automatically parses parameter count from model names (e.g., "360m", "7b", "70b")
29
+ - Supports both Ollama and HuggingFace model naming patterns:
30
+ - Explicit sizes: `llama3:7b`, `mistral-7b-v0.1`, `smollm2:360m`
31
+ - HuggingFace size indicators: `gpt2`, `gpt2-xl`, `bert-base`, `t5-xxl`, etc.
32
+ - Applies tiered pricing based on parameter count:
33
+ - Tiny (< 1B): $0.0001 / $0.0002 per 1k tokens
34
+ - Small (1-10B): $0.0003 / $0.0006
35
+ - Medium (10-20B): $0.0005 / $0.001
36
+ - Large (20-80B): $0.0008 / $0.0008
37
+ - XLarge (80B+): $0.0012 / $0.0012
38
+ - Acknowledges that local models are free but consume GPU power and electricity
39
+ - Provides synthetic cost estimates for carbon footprint and resource tracking
40
+ - Added `scripts/add_ollama_pricing.py` to update pricing database with new Ollama models
41
+ - Logs fallback pricing usage at INFO level for transparency
42
+
43
+ ### Improved
44
+
45
+ - **CostEnrichmentSpanProcessor Performance Optimization**
46
+ - Added early-exit logic to skip spans that already have cost attributes
47
+ - Checks for `gen_ai.usage.cost.total` presence before attempting enrichment
48
+ - Saves processing compute by avoiding redundant cost calculations
49
+ - Eliminates warning messages for spans enriched by instrumentors
50
+ - Benefits all instrumentors that set cost attributes directly (Mistral, OpenAI, Anthropic, etc.)
51
+ - Implementation in `genai_otel/cost_enrichment_processor.py:69-74`
52
+ - Added comprehensive test coverage for skip logic
53
+ - Coverage increased from 94% → 98% for CostEnrichmentSpanProcessor
54
+
55
+ ### Fixed
56
+
57
+ - **CRITICAL: Complete Rewrite of Mistral AI Instrumentor**
58
+ - **Root problem**: Original instrumentor used instance-level wrapping which didn't work reliably
59
+ - **Complete architectural rewrite** using class-level method wrapping with `wrapt.wrap_function_wrapper()`
60
+ - Now properly wraps `Chat.complete`, `Chat.stream`, and `Embeddings.create` at the class level
61
+ - All Mistral client instances now use instrumented methods automatically
62
+ - **Streaming support** with custom `_StreamWrapper` class:
63
+ - Iterates through streaming chunks and collects usage data
64
+ - Records TTFT (Time To First Token) metric
65
+ - Creates mock response objects for proper metrics recording
66
+ - **Proper error handling** with span exception recording
67
+ - **Cost tracking** now works correctly with BaseInstrumentor integration
68
+ - Fixed incorrect `_record_result_metrics()` signature usage
69
+ - Implementation in `genai_otel/instrumentors/mistralai_instrumentor.py` (180 lines, completely rewritten)
70
+ - All 5 Mistral tests passing with proper mocking
71
+ - Traces now collected with full details: model, tokens, costs, TTFT
72
+ - Resolves issue where no Mistral spans were being collected
73
+
74
+ - **CRITICAL: Fixed Missing Granular Cost Counter Class Variables**
75
+ - Fixed `AttributeError: 'OllamaInstrumentor' object has no attribute '_shared_prompt_cost_counter'`
76
+ - **Root cause**: Granular cost counters were created in initialization but not declared as class variables
77
+ - **Impact**: Test suite failed with 34 errors when running full suite (but passed individually)
78
+ - Added missing class variable declarations in `BaseInstrumentor`:
79
+ - `_shared_prompt_cost_counter`
80
+ - `_shared_completion_cost_counter`
81
+ - `_shared_reasoning_cost_counter`
82
+ - `_shared_cache_read_cost_counter`
83
+ - `_shared_cache_write_cost_counter`
84
+ - Created instance variable references in `__init__` for all granular counters
85
+ - Updated all references to use instance variables instead of `_shared_*` variables
86
+ - Implementation in `genai_otel/instrumentors/base.py:85-90, 106-111`
87
+ - All 424 tests now passing consistently
88
+ - Affects all instrumentors using granular cost tracking
89
+
90
+ - **CRITICAL: Fixed Cost Tracking Disabled by Wrong Variable Check**
91
+ - **Root cause**: Cost tracking checked `self._shared_cost_counter` which was always None
92
+ - Should have checked `self.config.enable_cost_tracking` flag only
93
+ - **Impact**: Cost attributes were never added to spans even when cost tracking was enabled
94
+ - Removed unnecessary `cost_counter` existence check
95
+ - Cost tracking now properly controlled by `GENAI_ENABLE_COST_TRACKING` environment variable
96
+ - Implementation in `genai_otel/instrumentors/base.py:384`
97
+ - Debug logging confirmed cost calculation working: "Calculating cost for model=smollm2:360m"
98
+ - Affects all instrumentors (Ollama, Mistral, OpenAI, Anthropic, etc.)
99
+
100
+ - **CRITICAL: Fixed Token and Cost Attributes Not Being Set on Spans**
101
+ - Fixed critical bug where `gen_ai.usage.prompt_tokens`, `gen_ai.usage.completion_tokens`, and all cost attributes were not being set on spans
102
+ - **Root causes:**
103
+ 1. Span attributes were only set if metric counters were available, but this check was too restrictive
104
+ 2. Used wrong variable name (`self._shared_cost_counter` instead of `self.cost_counter`) in cost tracking check
105
+ - **Impact**: Cost calculation completely failed - only `gen_ai.usage.total_tokens` was set
106
+ - **Fixed by:**
107
+ 1. Always setting span attributes regardless of metric availability
108
+ 2. Using correct instance variables (`self.cost_counter`, `self.token_counter`)
109
+ 3. Metrics recording is now optional, but span attributes are always set
110
+ 4. Cost attributes (`gen_ai.usage.cost.total`, `gen_ai.usage.cost.prompt`, `gen_ai.usage.cost.completion`) are now always added
111
+ - This ensures cost tracking works even if metrics initialization fails
112
+ - Affects all instrumentors (OpenAI, Anthropic, Ollama, etc.)
113
+
114
+ - **CRITICAL: Fixed 6 Instrumentors Missing `self._instrumented = True`**
115
+ - Ollama, Cohere, HuggingFace, Replicate, TogetherAI, and VertexAI instrumentors were completely broken
116
+ - No traces were being collected because `self._instrumented` flag was not set after wrapping functions
117
+ - The `create_span_wrapper()` checks this flag and skips instrumentation if False
118
+ - Added `self._instrumented = True` after successful wrapping in all 6 instrumentors
119
+ - All instrumentors now properly collect traces again
120
+
121
+ - **CRITICAL: CostEnrichmentSpanProcessor Now Working**
122
+ - Fixed critical bug where `CostEnrichmentSpanProcessor` was calling `calculate_cost()` (returns float) but treating it as a dict
123
+ - This caused all cost enrichment to silently fail with `TypeError: 'float' object is not subscriptable`
124
+ - Now correctly calls `calculate_granular_cost()` which returns a proper dict with `total`, `prompt`, `completion` keys
125
+ - Cost attributes (`gen_ai.usage.cost.total`, `gen_ai.usage.cost.prompt`, `gen_ai.usage.cost.completion`) will now be added to OpenInference spans (smolagents, litellm, mcp)
126
+ - Improved error logging from `logger.debug` to `logger.warning` with full exception info for easier debugging
127
+ - Added logging of successful cost enrichment at `INFO` level with span name, model, and token details
128
+ - All 415 tests passing, including 20 cost enrichment processor tests
129
+
130
+ - **Fixed OpenInference Instrumentor Loading Order**
131
+ - Corrected instrumentor initialization order to: smolagents → litellm → mcp
132
+ - This matches the correct order found in working implementations
133
+ - Ensures proper nested instrumentation and attribute capture
134
+
135
+ ## [0.1.3] - 2025-01-23
136
+
137
+ ### Added
138
+
139
+ - **Cost Enrichment for OpenInference Instrumentors**
140
+ - **CostEnrichmentSpanProcessor**: New custom SpanProcessor that automatically adds cost tracking to spans created by OpenInference instrumentors (smolagents, litellm, mcp)
141
+ - Extracts model name and token usage from existing span attributes
142
+ - Calculates costs using the existing CostCalculator with 145+ model pricing data
143
+ - Adds granular cost attributes: `gen_ai.usage.cost.total`, `gen_ai.usage.cost.prompt`, `gen_ai.usage.cost.completion`
144
+ - **Dual Semantic Convention Support**: Works with both OpenTelemetry GenAI and OpenInference conventions
145
+ - GenAI: `gen_ai.request.model`, `gen_ai.usage.{prompt_tokens,completion_tokens,input_tokens,output_tokens}`
146
+ - OpenInference: `llm.model_name`, `embedding.model_name`, `llm.token_count.{prompt,completion}`
147
+ - OpenInference span kinds: LLM, EMBEDDING, CHAIN, RETRIEVER, RERANKER, TOOL, AGENT
148
+ - Maps operation names to call types (chat, embedding, image, audio) automatically
149
+ - Gracefully handles missing data and errors without failing span processing
150
+ - Enabled by default when `GENAI_ENABLE_COST_TRACKING=true`
151
+ - Works alongside OpenInference's native instrumentation without modifying upstream code
152
+ - 100% test coverage with 20 comprehensive test cases (includes 5 OpenInference-specific tests)
153
+
154
+ - **Comprehensive Cost Tracking Enhancements**
155
+ - Added token usage extraction and cost calculation for **6 instrumentors**: Ollama, Cohere, Together AI, Vertex AI, HuggingFace, and Replicate
156
+ - Implemented `create_span_wrapper()` pattern across all instrumentors for consistent metrics recording
157
+ - Added `gen_ai.operation.name` attribute to all instrumentors for improved observability
158
+ - Total instrumentors with cost tracking increased from 8 to **11** (37.5% increase)
159
+
160
+ - **Pricing Data Expansion**
161
+ - Added pricing for **45+ new LLM models** from 3 major providers:
162
+ - **Groq**: 9 models (Llama 3.1/3.3/4, Qwen, GPT-OSS, Kimi-K2)
163
+ - **Cohere**: 5 models (Command R/R+/R7B, Command A, updated legacy pricing)
164
+ - **Together AI**: 30+ models (DeepSeek R1/V3, Qwen 2.5/3, Mistral variants, GLM-4.5)
165
+ - All pricing verified from official provider documentation (2025 rates)
166
+
167
+ - **Enhanced Instrumentor Implementations**
168
+ - **Ollama**: Extracts `prompt_eval_count` and `eval_count` from response (local model usage tracking)
169
+ - **Cohere**: Extracts from `meta.tokens` with `meta.billed_units` fallback
170
+ - **Together AI**: OpenAI-compatible format with dual API support (client + legacy Complete API)
171
+ - **Vertex AI**: Extracts `usage_metadata` with both snake_case and camelCase support
172
+ - **HuggingFace**: Documented as local/free execution (no API costs)
173
+ - **Replicate**: Documented as hardware-based pricing ($/second, not token-based)
174
+
175
+ ### Improved
176
+
177
+ - **Standardization & Code Quality**
178
+ - Standardized all instrumentors to use `BaseInstrumentor.create_span_wrapper()` pattern
179
+ - Improved error handling with consistent `fail_on_error` support across all instrumentors
180
+ - Enhanced documentation with comprehensive docstrings explaining pricing models
181
+ - Added proper logging at all error points for better debugging
182
+ - Thread-safe metrics initialization across all instrumentors
183
+
184
+ - **Test Coverage**
185
+ - All **415 tests passing** (100% test success rate)
186
+ - Increased overall code coverage to **89%**
187
+ - Individual instrumentor coverage: HuggingFace (98%), OpenAI (98%), Anthropic (95%), Groq (94%)
188
+ - Core modules at 100% coverage: config, metrics, logging, exceptions, __init__, cost_enrichment_processor
189
+ - Updated 40+ tests to match new `create_span_wrapper()` pattern
190
+ - Added 20 comprehensive tests for CostEnrichmentSpanProcessor (100% coverage)
191
+ - 15 tests for GenAI semantic conventions
192
+ - 5 tests for OpenInference semantic conventions
193
+
194
+ - **Documentation**
195
+ - Updated all instrumentor docstrings to explain token extraction logic
196
+ - Added comments documenting non-standard pricing models (hardware-based, local execution)
197
+ - Improved code comments for complex fallback logic
198
+
199
+ ## [0.1.2.dev0] - 2025-01-22
200
+
201
+ ### Added
202
+
203
+ - **GPU Power Consumption Metric**
204
+ - Added `gen_ai.gpu.power` observable gauge metric to track real-time GPU power consumption
205
+ - Metric reports power usage in Watts with `gpu_id` and `gpu_name` attributes
206
+ - Automatically collected alongside existing GPU metrics (utilization, memory, temperature)
207
+ - Implementation in `genai_otel/gpu_metrics.py:97-102, 195-220`
208
+ - Added test coverage in `tests/test_gpu_metrics.py:244-266`
209
+ - Completes the GPU metrics suite with 5 total metrics: utilization, memory, temperature, power, and CO2 emissions
210
+
211
+ ### Fixed
212
+
213
+ - **Test Fixes for HuggingFace and MistralAI Instrumentors**
214
+ - Fixed HuggingFace instrumentor tests (2 failures) - corrected tracer mocking to use `instrumentor.tracer.start_span()` instead of `config.tracer.start_as_current_span()`
215
+ - Fixed HuggingFace instrumentor tests - added `instrumentor.request_counter` mock for proper metrics assertion
216
+ - Fixed MistralAI instrumentor test - corrected wrapt module mocking by adding to `sys.modules` instead of invalid module-level patch
217
+ - All 395 tests now passing with zero failures
218
+ - Tests modified: `tests/instrumentors/test_huggingface_instrumentor.py`, `tests/instrumentors/test_mistralai_instrumentor.py`
219
+
9
220
  ## [0.1.0] - 2025-01-20
10
221
 
11
222
  **First Beta Release** 🎉
@@ -251,5 +462,6 @@ This is the first public release of genai-otel-instrument, a comprehensive OpenT
251
462
  - Fixed tests for base/redis and auto instrument (a701603)
252
463
  - Updated `test_auto_instrument.py` assertions to match new OTLP exporter configuration (exporters now read endpoint from environment variables instead of direct parameters)
253
464
 
254
- [Unreleased]: https://github.com/Mandark-droid/genai_otel_instrument/compare/v0.1.0...HEAD
465
+ [Unreleased]: https://github.com/Mandark-droid/genai_otel_instrument/compare/v0.1.2.dev0...HEAD
466
+ [0.1.2.dev0]: https://github.com/Mandark-droid/genai_otel_instrument/compare/v0.1.0...v0.1.2.dev0
255
467
  [0.1.0]: https://github.com/Mandark-droid/genai_otel_instrument/releases/tag/v0.1.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: genai-otel-instrument
3
- Version: 0.1.1.dev0
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
@@ -180,6 +180,26 @@ Dynamic: license-file
180
180
 
181
181
  # GenAI OpenTelemetry Auto-Instrumentation
182
182
 
183
+ [![PyPI version](https://badge.fury.io/py/genai-otel-instrument.svg)](https://badge.fury.io/py/genai-otel-instrument)
184
+ [![Python Versions](https://img.shields.io/pypi/pyversions/genai-otel-instrument.svg)](https://pypi.org/project/genai-otel-instrument/)
185
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
186
+ [![Downloads](https://static.pepy.tech/badge/genai-otel-instrument)](https://pepy.tech/project/genai-otel-instrument)
187
+ [![Downloads/Month](https://static.pepy.tech/badge/genai-otel-instrument/month)](https://pepy.tech/project/genai-otel-instrument)
188
+
189
+ [![GitHub Stars](https://img.shields.io/github/stars/Mandark-droid/genai_otel_instrument?style=social)](https://github.com/Mandark-droid/genai_otel_instrument)
190
+ [![GitHub Forks](https://img.shields.io/github/forks/Mandark-droid/genai_otel_instrument?style=social)](https://github.com/Mandark-droid/genai_otel_instrument)
191
+ [![GitHub Issues](https://img.shields.io/github/issues/Mandark-droid/genai_otel_instrument)](https://github.com/Mandark-droid/genai_otel_instrument/issues)
192
+ [![GitHub Pull Requests](https://img.shields.io/github/issues-pr/Mandark-droid/genai_otel_instrument)](https://github.com/Mandark-droid/genai_otel_instrument/pulls)
193
+
194
+ [![Code Coverage](https://img.shields.io/badge/coverage-90%25-brightgreen.svg)](https://github.com/Mandark-droid/genai_otel_instrument)
195
+ [![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
196
+ [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
197
+ [![Type Checked: mypy](https://img.shields.io/badge/type%20checked-mypy-blue.svg)](http://mypy-lang.org/)
198
+
199
+ [![OpenTelemetry](https://img.shields.io/badge/OpenTelemetry-1.20%2B-blueviolet)](https://opentelemetry.io/)
200
+ [![Semantic Conventions](https://img.shields.io/badge/OTel%20Semconv-GenAI%20v1.28-orange)](https://opentelemetry.io/docs/specs/semconv/gen-ai/)
201
+ [![CI/CD](https://img.shields.io/badge/CI%2FCD-GitHub%20Actions-2088FF?logo=github-actions&logoColor=white)](https://github.com/Mandark-droid/genai_otel_instrument/actions)
202
+
183
203
  Production-ready OpenTelemetry instrumentation for GenAI/LLM applications with zero-code setup.
184
204
 
185
205
  ## Features
@@ -188,7 +208,7 @@ Production-ready OpenTelemetry instrumentation for GenAI/LLM applications with z
188
208
  🤖 **15+ LLM Providers** - OpenAI, Anthropic, Google, AWS, Azure, and more
189
209
  🔧 **MCP Tool Support** - Auto-instrument databases, APIs, caches, vector DBs
190
210
  💰 **Cost Tracking** - Automatic cost calculation per request
191
- 🎮 **GPU Metrics** - Real-time GPU utilization, memory, temperature
211
+ 🎮 **GPU Metrics** - Real-time GPU utilization, memory, temperature, power
192
212
  📊 **Complete Observability** - Traces, metrics, and rich span attributes
193
213
  ➕ **Service Instance ID & Environment** - Identify your services and environments
194
214
  ⏱️ **Configurable Exporter Timeout** - Set timeout for OTLP exporter
@@ -235,9 +255,9 @@ For a more comprehensive demonstration of various LLM providers and MCP tools, r
235
255
  ## What Gets Instrumented?
236
256
 
237
257
  ### LLM Providers (Auto-detected)
238
- - OpenAI, Anthropic, Google AI, AWS Bedrock, Azure OpenAI
239
- - Cohere, Mistral AI, Together AI, Groq, Ollama
240
- - Vertex AI, Replicate, Anyscale, HuggingFace
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
241
261
 
242
262
  ### Frameworks
243
263
  - LangChain (chains, agents, tools)
@@ -251,15 +271,52 @@ For a more comprehensive demonstration of various LLM providers and MCP tools, r
251
271
  - **APIs**: HTTP/REST requests (requests, httpx)
252
272
 
253
273
  ### OpenInference (Optional - Python 3.10+ only)
254
- - Smolagents
255
- - MCP
256
- - 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.)
257
284
 
258
285
  **Note:** OpenInference instrumentors require Python >= 3.10. Install with:
259
286
  ```bash
260
287
  pip install genai-otel-instrument[openinference]
261
288
  ```
262
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
+
263
320
  ## Collected Telemetry
264
321
 
265
322
  ### Traces
@@ -268,7 +325,7 @@ Every LLM call, database query, API request, and vector search is traced with fu
268
325
  ### Metrics
269
326
 
270
327
  **GenAI Metrics:**
271
- - `gen_ai.requests` - Request counts by provider/model
328
+ - `gen_ai.requests` - Request counts by provider and model
272
329
  - `gen_ai.client.token.usage` - Token usage (prompt/completion)
273
330
  - `gen_ai.client.operation.duration` - Request latency histogram (optimized buckets for LLM workloads)
274
331
  - `gen_ai.usage.cost` - Total estimated costs in USD
@@ -278,7 +335,7 @@ Every LLM call, database query, API request, and vector search is traced with fu
278
335
  - `gen_ai.usage.cost.cache_read` - Cache read cost (Anthropic)
279
336
  - `gen_ai.usage.cost.cache_write` - Cache write cost (Anthropic)
280
337
  - `gen_ai.client.errors` - Error counts by operation and type
281
- - `gen_ai.gpu.*` - GPU utilization, memory, temperature (ObservableGauges)
338
+ - `gen_ai.gpu.*` - GPU utilization, memory, temperature, power (ObservableGauges)
282
339
  - `gen_ai.co2.emissions` - CO2 emissions tracking (opt-in)
283
340
  - `gen_ai.server.ttft` - Time to First Token for streaming responses (histogram, 1ms-10s buckets)
284
341
  - `gen_ai.server.tbt` - Time Between Tokens for streaming responses (histogram, 10ms-2.5s buckets)
@@ -459,5 +516,168 @@ genai-otel-instrument/
459
516
  └── (other mcp files)
460
517
  ```
461
518
 
519
+ ## Roadmap
520
+
521
+ ### Next Release (v0.2.0) - Q1 2026
522
+
523
+ We're planning significant enhancements for the next major release, focusing on evaluation metrics and safety guardrails alongside completing OpenTelemetry semantic convention compliance.
524
+
525
+ #### 🎯 Evaluation & Monitoring
526
+
527
+ **LLM Output Quality Metrics**
528
+ - **Bias Detection** - Automatically detect and measure bias in LLM responses
529
+ - Gender, racial, political, and cultural bias detection
530
+ - Bias score metrics with configurable thresholds
531
+ - Integration with fairness libraries (e.g., Fairlearn, AIF360)
532
+
533
+ - **Toxicity Detection** - Monitor and alert on toxic or harmful content
534
+ - Perspective API integration for toxicity scoring
535
+ - Custom toxicity models support
536
+ - Real-time toxicity metrics and alerts
537
+ - Configurable severity levels
538
+
539
+ - **Hallucination Detection** - Track factual accuracy and groundedness
540
+ - Fact-checking against provided context
541
+ - Citation validation for RAG applications
542
+ - Confidence scoring for generated claims
543
+ - Hallucination rate metrics by model and use case
544
+
545
+ **Implementation:**
546
+ ```python
547
+ import genai_otel
548
+
549
+ # Enable evaluation metrics
550
+ genai_otel.instrument(
551
+ enable_bias_detection=True,
552
+ enable_toxicity_detection=True,
553
+ enable_hallucination_detection=True,
554
+
555
+ # Configure thresholds
556
+ bias_threshold=0.7,
557
+ toxicity_threshold=0.5,
558
+ hallucination_threshold=0.8
559
+ )
560
+ ```
561
+
562
+ **Metrics Added:**
563
+ - `gen_ai.eval.bias_score` - Bias detection scores (histogram)
564
+ - `gen_ai.eval.toxicity_score` - Toxicity scores (histogram)
565
+ - `gen_ai.eval.hallucination_score` - Hallucination probability (histogram)
566
+ - `gen_ai.eval.violations` - Count of threshold violations by type
567
+
568
+ #### 🛡️ Safety Guardrails
569
+
570
+ **Input/Output Filtering**
571
+ - **Prompt Injection Detection** - Protect against prompt injection attacks
572
+ - Pattern-based detection (jailbreaking attempts)
573
+ - ML-based classifier for sophisticated attacks
574
+ - Real-time blocking with configurable policies
575
+ - Attack attempt metrics and logging
576
+
577
+ - **Restricted Topics** - Block sensitive or inappropriate topics
578
+ - Configurable topic blacklists (legal, medical, financial advice)
579
+ - Industry-specific content filters
580
+ - Topic detection with confidence scoring
581
+ - Custom topic definition support
582
+
583
+ - **Sensitive Information Protection** - Prevent PII leakage
584
+ - PII detection (emails, phone numbers, SSN, credit cards)
585
+ - Automatic redaction or blocking
586
+ - Compliance mode (GDPR, HIPAA, PCI-DSS)
587
+ - Data leak prevention metrics
588
+
589
+ **Implementation:**
590
+ ```python
591
+ import genai_otel
592
+
593
+ # Configure guardrails
594
+ genai_otel.instrument(
595
+ enable_prompt_injection_detection=True,
596
+ enable_restricted_topics=True,
597
+ enable_sensitive_info_detection=True,
598
+
599
+ # Custom configuration
600
+ restricted_topics=["medical_advice", "legal_advice", "financial_advice"],
601
+ pii_detection_mode="block", # or "redact", "warn"
602
+
603
+ # Callbacks for custom handling
604
+ on_guardrail_violation=my_violation_handler
605
+ )
606
+ ```
607
+
608
+ **Metrics Added:**
609
+ - `gen_ai.guardrail.prompt_injection_detected` - Injection attempts blocked
610
+ - `gen_ai.guardrail.restricted_topic_blocked` - Restricted topic violations
611
+ - `gen_ai.guardrail.pii_detected` - PII detection events
612
+ - `gen_ai.guardrail.violations` - Total guardrail violations by type
613
+
614
+ **Span Attributes:**
615
+ - `gen_ai.guardrail.violation_type` - Type of violation detected
616
+ - `gen_ai.guardrail.violation_severity` - Severity level (low, medium, high, critical)
617
+ - `gen_ai.guardrail.blocked` - Whether request was blocked (boolean)
618
+ - `gen_ai.eval.bias_categories` - Detected bias types (array)
619
+ - `gen_ai.eval.toxicity_categories` - Toxicity categories (array)
620
+
621
+ #### 📊 Enhanced OpenTelemetry Compliance
622
+
623
+ Completing remaining items from [OTEL_SEMANTIC_GAP_ANALYSIS_AND_IMPLEMENTATION_PLAN.md](OTEL_SEMANTIC_GAP_ANALYSIS_AND_IMPLEMENTATION_PLAN.md):
624
+
625
+ **Phase 4: Optional Enhancements**
626
+ - ✅ Session & User Tracking - Track sessions and users across requests
627
+ ```python
628
+ genai_otel.instrument(
629
+ session_id_extractor=lambda ctx: ctx.get("session_id"),
630
+ user_id_extractor=lambda ctx: ctx.get("user_id")
631
+ )
632
+ ```
633
+
634
+ - ✅ RAG/Embedding Attributes - Enhanced observability for retrieval-augmented generation
635
+ - `embedding.model_name` - Embedding model used
636
+ - `embedding.vector_dimensions` - Vector dimensions
637
+ - `retrieval.documents.{i}.document.id` - Retrieved document IDs
638
+ - `retrieval.documents.{i}.document.score` - Relevance scores
639
+ - `retrieval.documents.{i}.document.content` - Document content (truncated)
640
+
641
+ - ✅ Agent Workflow Tracking - Better support for agentic workflows
642
+ - `agent.name` - Agent identifier
643
+ - `agent.iteration` - Current iteration number
644
+ - `agent.action` - Action taken
645
+ - `agent.observation` - Observation received
646
+
647
+ #### 🔄 Migration Support
648
+
649
+ **Backward Compatibility:**
650
+ - All new features are opt-in via configuration
651
+ - Existing instrumentation continues to work unchanged
652
+ - Gradual migration path for new semantic conventions
653
+
654
+ **Version Support:**
655
+ - Python 3.9+ (evaluation features require 3.10+)
656
+ - OpenTelemetry SDK 1.20.0+
657
+ - Backward compatible with existing dashboards
658
+
659
+ ### Future Releases
660
+
661
+ **v0.3.0 - Advanced Analytics**
662
+ - Custom metric aggregations
663
+ - Cost optimization recommendations
664
+ - Automated performance regression detection
665
+ - A/B testing support for prompts
666
+
667
+ **v0.4.0 - Enterprise Features**
668
+ - Multi-tenancy support
669
+ - Role-based access control for telemetry
670
+ - Advanced compliance reporting
671
+ - SLA monitoring and alerting
672
+
673
+ **Community Feedback**
674
+
675
+ We welcome feedback on our roadmap! Please:
676
+ - Open issues for feature requests
677
+ - Join discussions on prioritization
678
+ - Share your use cases and requirements
679
+
680
+ See [Contributing.md](Contributing.md) for how to get involved.
681
+
462
682
  ## License
463
683
  Apache-2.0 license