genai-otel-instrument 0.1.2.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 (203) hide show
  1. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/CHANGELOG.md +193 -3
  2. {genai_otel_instrument-0.1.2.dev0/genai_otel_instrument.egg-info → genai_otel_instrument-0.1.4.dev0}/PKG-INFO +45 -8
  3. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/README.md +44 -7
  4. genai_otel_instrument-0.1.4.dev0/examples/demo/grafana/dashboards/genai-metrics-dashboard.json +452 -0
  5. genai_otel_instrument-0.1.4.dev0/examples/demo/grafana/dashboards/genai-traces-dashboard.json +126 -0
  6. genai_otel_instrument-0.1.4.dev0/examples/demo/grafana/provisioning/datasources/jaeger.yml +11 -0
  7. genai_otel_instrument-0.1.4.dev0/examples/demo/grafana/provisioning/datasources/prometheus.yml +9 -0
  8. genai_otel_instrument-0.1.4.dev0/examples/demo/otel-collector-config.yml +43 -0
  9. genai_otel_instrument-0.1.4.dev0/examples/demo/prometheus.yml +23 -0
  10. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/__version__.py +3 -3
  11. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/auto_instrument.py +18 -1
  12. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/config.py +3 -0
  13. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/cost_calculator.py +136 -11
  14. genai_otel_instrument-0.1.4.dev0/genai_otel/cost_enrichment_processor.py +177 -0
  15. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/base.py +74 -42
  16. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/cohere_instrumentor.py +140 -0
  17. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/huggingface_instrumentor.py +222 -0
  18. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/mistralai_instrumentor.py +331 -0
  19. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/ollama_instrumentor.py +152 -0
  20. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/replicate_instrumentor.py +87 -0
  21. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/togetherai_instrumentor.py +146 -0
  22. genai_otel_instrument-0.1.4.dev0/genai_otel/instrumentors/vertexai_instrumentor.py +106 -0
  23. genai_otel_instrument-0.1.4.dev0/genai_otel/llm_pricing.json +869 -0
  24. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0/genai_otel_instrument.egg-info}/PKG-INFO +45 -8
  25. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel_instrument.egg-info/SOURCES.txt +18 -1
  26. genai_otel_instrument-0.1.4.dev0/scripts/add_ollama_pricing.py +108 -0
  27. genai_otel_instrument-0.1.4.dev0/scripts/debug/simple_test.py +157 -0
  28. genai_otel_instrument-0.1.4.dev0/scripts/debug/test_example_debug.py +56 -0
  29. genai_otel_instrument-0.1.4.dev0/scripts/debug/test_exporter_fix.py +41 -0
  30. genai_otel_instrument-0.1.4.dev0/scripts/debug/test_final.py +41 -0
  31. genai_otel_instrument-0.1.4.dev0/scripts/debug/test_gpu_debug.py +22 -0
  32. genai_otel_instrument-0.1.4.dev0/scripts/debug/test_gpu_metrics.py +13 -0
  33. genai_otel_instrument-0.1.4.dev0/scripts/debug/test_litellm_instrumentation.py +97 -0
  34. genai_otel_instrument-0.1.4.dev0/scripts/debug/test_ollama_cost.py +84 -0
  35. genai_otel_instrument-0.1.4.dev0/scripts/debug/test_ollama_span_attributes.py +55 -0
  36. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_cohere_instrumentor.py +70 -28
  37. genai_otel_instrument-0.1.4.dev0/tests/instrumentors/test_huggingface_instrumentor.py +401 -0
  38. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_mistralai_instrumentor.py +38 -14
  39. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_ollama_instrumentor.py +79 -37
  40. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_replicate_instrumentor.py +19 -52
  41. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_togetherai_instrumentor.py +53 -59
  42. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_vertexai_instrumentor.py +56 -52
  43. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_auto_instrument.py +5 -3
  44. genai_otel_instrument-0.1.4.dev0/tests/test_cost_enrichment_processor.py +457 -0
  45. genai_otel_instrument-0.1.2.dev0/baseline_tests.txt +0 -64
  46. genai_otel_instrument-0.1.2.dev0/genai_otel/instrumentors/cohere_instrumentor.py +0 -76
  47. genai_otel_instrument-0.1.2.dev0/genai_otel/instrumentors/huggingface_instrumentor.py +0 -97
  48. genai_otel_instrument-0.1.2.dev0/genai_otel/instrumentors/mistralai_instrumentor.py +0 -119
  49. genai_otel_instrument-0.1.2.dev0/genai_otel/instrumentors/ollama_instrumentor.py +0 -83
  50. genai_otel_instrument-0.1.2.dev0/genai_otel/instrumentors/replicate_instrumentor.py +0 -42
  51. genai_otel_instrument-0.1.2.dev0/genai_otel/instrumentors/togetherai_instrumentor.py +0 -42
  52. genai_otel_instrument-0.1.2.dev0/genai_otel/instrumentors/vertexai_instrumentor.py +0 -42
  53. genai_otel_instrument-0.1.2.dev0/genai_otel/llm_pricing.json +0 -589
  54. genai_otel_instrument-0.1.2.dev0/tests/instrumentors/test_huggingface_instrumentor.py +0 -224
  55. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.claude/settings.local.json +0 -0
  56. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.github/workflows/README.md +0 -0
  57. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.github/workflows/pre-release-check.yml +0 -0
  58. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.github/workflows/publish.yml +0 -0
  59. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.github/workflows/test.yml +0 -0
  60. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.gitignore +0 -0
  61. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/.gitignore +0 -0
  62. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/genai_otel_instrument.iml +0 -0
  63. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/inspectionProfiles/Project_Default.xml +0 -0
  64. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
  65. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/misc.xml +0 -0
  66. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/modules.xml +0 -0
  67. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.idea/vcs.xml +0 -0
  68. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/.pylintrc +0 -0
  69. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/Contributing.md +0 -0
  70. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/LICENSE +0 -0
  71. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/MANIFEST.in +0 -0
  72. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/OTEL_SEMANTIC_COMPATIBILITY.md +0 -0
  73. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/OTEL_SEMANTIC_GAP_ANALYSIS_AND_IMPLEMENTATION_PLAN.md +0 -0
  74. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/PRE_RELEASE_CHECKLIST.md +0 -0
  75. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/TEST_COVERAGE_CHECKLIST.md +0 -0
  76. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/TROUBLESHOOTING.md +0 -0
  77. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/example_usage.py +0 -0
  78. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/README.md +0 -0
  79. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/anthropic/.env.example +0 -0
  80. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/anthropic/README.md +0 -0
  81. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/anthropic/example.py +0 -0
  82. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/aws_bedrock/.env.example +0 -0
  83. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/aws_bedrock/README.md +0 -0
  84. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/aws_bedrock/example.py +0 -0
  85. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/azure_openai/.env.example +0 -0
  86. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/azure_openai/README.md +0 -0
  87. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/azure_openai/example.py +0 -0
  88. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/cohere/.env.example +0 -0
  89. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/cohere/README.md +0 -0
  90. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/cohere/example.py +0 -0
  91. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/demo/.env.example +0 -0
  92. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/demo/Dockerfile +0 -0
  93. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/demo/README.md +0 -0
  94. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/demo/app.py +0 -0
  95. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/demo/docker-compose.yml +0 -0
  96. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/demo/requirements.txt +0 -0
  97. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/google_ai/.env.example +0 -0
  98. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/google_ai/README.md +0 -0
  99. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/google_ai/example.py +0 -0
  100. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/groq/.env.example +0 -0
  101. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/groq/README.md +0 -0
  102. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/groq/example.py +0 -0
  103. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/huggingface/.env.example +0 -0
  104. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/huggingface/README.md +0 -0
  105. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/huggingface/example.py +0 -0
  106. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/langchain/.env.example +0 -0
  107. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/langchain/README.md +0 -0
  108. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/langchain/example.py +0 -0
  109. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/litellm/example.py +0 -0
  110. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/llamaindex/.env.example +0 -0
  111. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/llamaindex/README.md +0 -0
  112. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/llamaindex/example.py +0 -0
  113. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/mistralai/.env.example +0 -0
  114. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/mistralai/README.md +0 -0
  115. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/mistralai/example.py +0 -0
  116. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/ollama/.env.example +0 -0
  117. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/ollama/README.md +0 -0
  118. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/ollama/example.py +0 -0
  119. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/openai/.env.example +0 -0
  120. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/openai/README.md +0 -0
  121. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/openai/example.py +0 -0
  122. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/replicate/.env.example +0 -0
  123. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/replicate/README.md +0 -0
  124. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/replicate/example.py +0 -0
  125. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/smolagents/example.py +0 -0
  126. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/togetherai/.env.example +0 -0
  127. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/togetherai/README.md +0 -0
  128. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/togetherai/example.py +0 -0
  129. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/vertexai/.env.example +0 -0
  130. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/vertexai/README.md +0 -0
  131. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/examples/vertexai/example.py +0 -0
  132. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/__init__.py +0 -0
  133. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/cli.py +0 -0
  134. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/exceptions.py +0 -0
  135. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/gpu_metrics.py +0 -0
  136. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/__init__.py +0 -0
  137. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/anthropic_instrumentor.py +0 -0
  138. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/anyscale_instrumentor.py +0 -0
  139. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/aws_bedrock_instrumentor.py +0 -0
  140. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/azure_openai_instrumentor.py +0 -0
  141. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/google_ai_instrumentor.py +0 -0
  142. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/groq_instrumentor.py +0 -0
  143. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/langchain_instrumentor.py +0 -0
  144. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/llamaindex_instrumentor.py +0 -0
  145. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/instrumentors/openai_instrumentor.py +0 -0
  146. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/logging_config.py +0 -0
  147. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/__init__.py +0 -0
  148. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/api_instrumentor.py +0 -0
  149. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/base.py +0 -0
  150. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/database_instrumentor.py +0 -0
  151. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/kafka_instrumentor.py +0 -0
  152. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/manager.py +0 -0
  153. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/redis_instrumentor.py +0 -0
  154. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/mcp_instrumentors/vector_db_instrumentor.py +0 -0
  155. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/metrics.py +0 -0
  156. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel/py.typed +0 -0
  157. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel_instrument.egg-info/dependency_links.txt +0 -0
  158. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel_instrument.egg-info/entry_points.txt +0 -0
  159. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel_instrument.egg-info/requires.txt +0 -0
  160. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/genai_otel_instrument.egg-info/top_level.txt +0 -0
  161. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/openlit/semcov.py +0 -0
  162. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/pyproject.toml +0 -0
  163. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/requirements-dev.txt +0 -0
  164. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/requirements-testing.txt +0 -0
  165. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/requirements.txt +0 -0
  166. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/sample.env +0 -0
  167. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/scripts/fix_all_deps.sh +0 -0
  168. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/scripts/fix_instrumentors.py +0 -0
  169. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/scripts/test_installation.py +0 -0
  170. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/scripts/test_release.sh +0 -0
  171. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/setup.cfg +0 -0
  172. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/setup.py +0 -0
  173. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/__init__.py +0 -0
  174. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_anthropic_instrumentor.py +0 -0
  175. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_anyscale_instrumentor.py +0 -0
  176. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_aws_bedrock_instrumentor.py +0 -0
  177. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_azure_openai_instrumentor.py +0 -0
  178. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_base.py +0 -0
  179. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_google_ai_instrumentor.py +0 -0
  180. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_groq_instrumentor.py +0 -0
  181. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_langchain_instrumentor.py +0 -0
  182. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_litellm_instrumentor.py +0 -0
  183. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_llamaindex_instrumentor.py +0 -0
  184. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_mcp_instrumentor.py +0 -0
  185. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_openai_instrumentor.py +0 -0
  186. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/instrumentors/test_smolagents_instrumentor.py +0 -0
  187. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_api_instrumentor.py +0 -0
  188. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_database_instrumentor.py +0 -0
  189. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_kafka_instrumentor.py +0 -0
  190. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_manager.py +0 -0
  191. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_mcp_base.py +0 -0
  192. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_redis_instrumentor.py +0 -0
  193. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/mcp_instrumentors/test_vector_db_instrumentor.py +0 -0
  194. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_cli.py +0 -0
  195. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_config.py +0 -0
  196. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_cost_calculator.py +0 -0
  197. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_exceptions.py +0 -0
  198. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_gpu_metrics.py +0 -0
  199. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_init.py +0 -0
  200. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_logging_config.py +0 -0
  201. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_metrics.py +0 -0
  202. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_openai_instrumentor.py +0 -0
  203. {genai_otel_instrument-0.1.2.dev0 → genai_otel_instrument-0.1.4.dev0}/tests/test_otel_setup.py +0 -0
@@ -6,7 +6,197 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ## [0.1.1] - 2025-01-22
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
10
200
 
11
201
  ### Added
12
202
 
@@ -272,6 +462,6 @@ This is the first public release of genai-otel-instrument, a comprehensive OpenT
272
462
  - Fixed tests for base/redis and auto instrument (a701603)
273
463
  - Updated `test_auto_instrument.py` assertions to match new OTLP exporter configuration (exporters now read endpoint from environment variables instead of direct parameters)
274
464
 
275
- [Unreleased]: https://github.com/Mandark-droid/genai_otel_instrument/compare/v0.1.1...HEAD
276
- [0.1.1]: https://github.com/Mandark-droid/genai_otel_instrument/compare/v0.1.0...v0.1.1
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
277
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.2.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
@@ -191,7 +191,7 @@ Dynamic: license-file
191
191
  [![GitHub Issues](https://img.shields.io/github/issues/Mandark-droid/genai_otel_instrument)](https://github.com/Mandark-droid/genai_otel_instrument/issues)
192
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
193
 
194
- [![Code Coverage](https://img.shields.io/badge/coverage-95%25-brightgreen.svg)](https://github.com/Mandark-droid/genai_otel_instrument)
194
+ [![Code Coverage](https://img.shields.io/badge/coverage-90%25-brightgreen.svg)](https://github.com/Mandark-droid/genai_otel_instrument)
195
195
  [![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
196
196
  [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
197
197
  [![Type Checked: mypy](https://img.shields.io/badge/type%20checked-mypy-blue.svg)](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
- - Cohere, Mistral AI, Together AI, Groq, Ollama
260
- - 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
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
@@ -11,7 +11,7 @@
11
11
  [![GitHub Issues](https://img.shields.io/github/issues/Mandark-droid/genai_otel_instrument)](https://github.com/Mandark-droid/genai_otel_instrument/issues)
12
12
  [![GitHub Pull Requests](https://img.shields.io/github/issues-pr/Mandark-droid/genai_otel_instrument)](https://github.com/Mandark-droid/genai_otel_instrument/pulls)
13
13
 
14
- [![Code Coverage](https://img.shields.io/badge/coverage-95%25-brightgreen.svg)](https://github.com/Mandark-droid/genai_otel_instrument)
14
+ [![Code Coverage](https://img.shields.io/badge/coverage-90%25-brightgreen.svg)](https://github.com/Mandark-droid/genai_otel_instrument)
15
15
  [![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
16
16
  [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
17
17
  [![Type Checked: mypy](https://img.shields.io/badge/type%20checked-mypy-blue.svg)](http://mypy-lang.org/)
@@ -75,9 +75,9 @@ For a more comprehensive demonstration of various LLM providers and MCP tools, r
75
75
  ## What Gets Instrumented?
76
76
 
77
77
  ### LLM Providers (Auto-detected)
78
- - OpenAI, Anthropic, Google AI, AWS Bedrock, Azure OpenAI
79
- - Cohere, Mistral AI, Together AI, Groq, Ollama
80
- - Vertex AI, Replicate, Anyscale, HuggingFace
78
+ - **With Full Cost Tracking**: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure OpenAI, Cohere, Mistral AI, Together AI, Groq, Ollama, Vertex AI
79
+ - **Hardware/Local Pricing**: Replicate (hardware-based $/second), HuggingFace (local execution, free)
80
+ - **Other Providers**: Anyscale
81
81
 
82
82
  ### Frameworks
83
83
  - LangChain (chains, agents, tools)
@@ -91,15 +91,52 @@ For a more comprehensive demonstration of various LLM providers and MCP tools, r
91
91
  - **APIs**: HTTP/REST requests (requests, httpx)
92
92
 
93
93
  ### OpenInference (Optional - Python 3.10+ only)
94
- - Smolagents
95
- - MCP
96
- - LiteLLM
94
+ - Smolagents - HuggingFace smolagents framework tracing
95
+ - MCP - Model Context Protocol instrumentation
96
+ - LiteLLM - Multi-provider LLM proxy
97
+
98
+ **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.
99
+
100
+ The processor supports OpenInference semantic conventions:
101
+ - Model: `llm.model_name`, `embedding.model_name`
102
+ - Tokens: `llm.token_count.prompt`, `llm.token_count.completion`
103
+ - Operations: `openinference.span.kind` (LLM, EMBEDDING, CHAIN, RETRIEVER, etc.)
97
104
 
98
105
  **Note:** OpenInference instrumentors require Python >= 3.10. Install with:
99
106
  ```bash
100
107
  pip install genai-otel-instrument[openinference]
101
108
  ```
102
109
 
110
+ ## Cost Tracking Coverage
111
+
112
+ The library includes comprehensive cost tracking with pricing data for **145+ models** across **11 providers**:
113
+
114
+ ### Providers with Full Token-Based Cost Tracking
115
+ - **OpenAI**: GPT-4o, GPT-4 Turbo, GPT-3.5 Turbo, o1/o3 series, embeddings, audio, vision (35+ models)
116
+ - **Anthropic**: Claude 3.5 Sonnet/Opus/Haiku, Claude 3 series (10+ models)
117
+ - **Google AI**: Gemini 1.5/2.0 Pro/Flash, PaLM 2 (12+ models)
118
+ - **AWS Bedrock**: Amazon Titan, Claude, Llama, Mistral models (20+ models)
119
+ - **Azure OpenAI**: Same as OpenAI with Azure-specific pricing
120
+ - **Cohere**: Command R/R+, Command Light, Embed v3/v2 (8+ models)
121
+ - **Mistral AI**: Mistral Large/Medium/Small, Mixtral, embeddings (8+ models)
122
+ - **Together AI**: DeepSeek-R1, Llama 3.x, Qwen, Mixtral (25+ models)
123
+ - **Groq**: Llama 3.x series, Mixtral, Gemma models (15+ models)
124
+ - **Ollama**: Local models with token tracking (pricing via cost estimation)
125
+ - **Vertex AI**: Gemini models via Google Cloud with usage metadata extraction
126
+
127
+ ### Special Pricing Models
128
+ - **Replicate**: Hardware-based pricing ($/second of GPU/CPU time) - not token-based
129
+ - **HuggingFace Transformers**: Local execution - no API costs
130
+
131
+ ### Pricing Features
132
+ - **Differential Pricing**: Separate rates for prompt tokens vs. completion tokens
133
+ - **Reasoning Tokens**: Special pricing for OpenAI o1/o3 reasoning tokens
134
+ - **Cache Pricing**: Anthropic prompt caching costs (read/write)
135
+ - **Granular Cost Metrics**: Per-request cost breakdown by token type
136
+ - **Auto-Updated Pricing**: Pricing data maintained in `llm_pricing.json`
137
+
138
+ **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).
139
+
103
140
  ## Collected Telemetry
104
141
 
105
142
  ### Traces