monocle-apptrace 0.5.0b1__tar.gz → 0.5.1__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 monocle-apptrace might be problematic. Click here for more details.

Files changed (160) hide show
  1. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/CHANGELOG.md +49 -1
  2. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/PKG-INFO +15 -10
  3. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/pyproject.toml +16 -11
  4. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/exporters/file_exporter.py +2 -1
  5. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/common/__init__.py +7 -5
  6. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/common/constants.py +180 -0
  7. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/common/instrumentor.py +1 -6
  8. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/common/method_wrappers.py +10 -125
  9. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/common/scope_wrapper.py +126 -0
  10. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/common/span_handler.py +32 -8
  11. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/common/utils.py +34 -3
  12. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/common/wrapper.py +415 -0
  13. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/common/wrapper_method.py +9 -1
  14. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/a2a/entities/inference.py +3 -1
  15. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/adk/_helper.py +206 -0
  16. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/adk/entities/agent.py +111 -0
  17. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/adk/entities/tool.py +59 -0
  18. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/adk/methods.py +31 -0
  19. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/agents/_helper.py +225 -0
  20. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/agents/agents_processor.py +174 -0
  21. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/agents/entities/inference.py +196 -0
  22. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/agents/methods.py +55 -0
  23. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/aiohttp/entities/http.py +2 -1
  24. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/anthropic/_helper.py +183 -0
  25. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/anthropic/entities/inference.py +6 -1
  26. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/azfunc/entities/http.py +2 -1
  27. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/azureaiinference/entities/inference.py +2 -1
  28. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/botocore/entities/inference.py +2 -1
  29. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/fastapi/entities/http.py +2 -1
  30. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/fastapi/methods.py +23 -0
  31. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/finish_types.py +79 -1
  32. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/flask/entities/http.py +2 -1
  33. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/gemini/entities/inference.py +7 -3
  34. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/gemini/entities/retrieval.py +2 -1
  35. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/gemini/methods.py +8 -1
  36. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/haystack/_helper.py +64 -0
  37. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/haystack/entities/inference.py +12 -1
  38. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/haystack/entities/retrieval.py +2 -1
  39. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/lambdafunc/entities/http.py +2 -1
  40. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/langchain/_helper.py +18 -0
  41. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/langchain/entities/inference.py +6 -1
  42. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/langchain/entities/retrieval.py +2 -1
  43. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/langgraph/_helper.py +6 -0
  44. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/langgraph/entities/inference.py +10 -5
  45. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/langgraph/langgraph_processor.py +11 -4
  46. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/langgraph/methods.py +42 -0
  47. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/litellm/_helper.py +89 -0
  48. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/litellm/entities/inference.py +109 -0
  49. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/litellm/methods.py +19 -0
  50. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/llamaindex/entities/agent.py +9 -4
  51. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/llamaindex/entities/inference.py +2 -1
  52. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/llamaindex/entities/retrieval.py +2 -1
  53. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/llamaindex/llamaindex_processor.py +14 -3
  54. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/llamaindex/methods.py +1 -1
  55. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/mcp/_helper.py +2 -1
  56. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/mcp/entities/inference.py +3 -1
  57. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/mcp/mcp_processor.py +0 -5
  58. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/mcp/methods.py +1 -1
  59. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/openai/__init__.py +0 -0
  60. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/openai/_helper.py +110 -5
  61. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/openai/entities/__init__.py +0 -0
  62. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/openai/entities/inference.py +59 -13
  63. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/requests/entities/http.py +2 -1
  64. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/teamsai/__init__.py +0 -0
  65. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/teamsai/_helper.py +12 -1
  66. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/teamsai/entities/__init__.py +0 -0
  67. monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/teamsai/entities/inference/__init__.py +0 -0
  68. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/teamsai/entities/inference/teamsai_output_processor.py +12 -1
  69. monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/common/constants.py +0 -89
  70. monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/common/wrapper.py +0 -248
  71. monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/anthropic/_helper.py +0 -106
  72. monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/fastapi/methods.py +0 -23
  73. monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/langgraph/methods.py +0 -38
  74. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/.gitignore +0 -0
  75. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/CODEOWNERS.md +0 -0
  76. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/CODE_OF_CONDUCT.md +0 -0
  77. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/CONTRIBUTING.md +0 -0
  78. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/COPYRIGHT.template +0 -0
  79. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/LICENSE +0 -0
  80. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/MAINTAINER.md +0 -0
  81. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/Monocle_User_Guide.md +0 -0
  82. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/Monocle_committer_guide.md +0 -0
  83. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/Monocle_contributor_guide.md +0 -0
  84. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/NOTICE +0 -0
  85. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/README.md +0 -0
  86. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/SECURITY.md +0 -0
  87. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/README.md +0 -0
  88. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/__init__.py +0 -0
  89. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/__main__.py +0 -0
  90. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/exporters/aws/s3_exporter.py +0 -0
  91. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/exporters/aws/s3_exporter_opendal.py +0 -0
  92. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/exporters/azure/blob_exporter.py +0 -0
  93. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/exporters/azure/blob_exporter_opendal.py +0 -0
  94. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/exporters/base_exporter.py +0 -0
  95. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/exporters/exporter_processor.py +0 -0
  96. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/exporters/monocle_exporters.py +0 -0
  97. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/exporters/okahu/okahu_exporter.py +0 -0
  98. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/__init__.py +0 -0
  99. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/common/tracing.md +0 -0
  100. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/__init__.py +0 -0
  101. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/a2a/__init__.py +0 -0
  102. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/a2a/_helper.py +0 -0
  103. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/a2a/entities/__init__.py +0 -0
  104. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/a2a/methods.py +0 -0
  105. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/aiohttp → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/adk}/__init__.py +0 -0
  106. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/anthropic → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/agents}/__init__.py +0 -0
  107. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/anthropic → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/agents}/entities/__init__.py +0 -0
  108. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/botocore → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/aiohttp}/__init__.py +0 -0
  109. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/aiohttp/_helper.py +0 -0
  110. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/aiohttp/methods.py +0 -0
  111. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/botocore/entities → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/anthropic}/__init__.py +0 -0
  112. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/fastapi → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/anthropic/entities}/__init__.py +0 -0
  113. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/anthropic/methods.py +0 -0
  114. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/azfunc/_helper.py +0 -0
  115. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/azfunc/methods.py +0 -0
  116. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/azfunc/wrapper.py +0 -0
  117. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/azureaiinference/__init__.py +0 -0
  118. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/azureaiinference/_helper.py +0 -0
  119. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/azureaiinference/methods.py +0 -0
  120. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/fastapi/entities → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/botocore}/__init__.py +0 -0
  121. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/botocore/_helper.py +0 -0
  122. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/flask → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/botocore/entities}/__init__.py +0 -0
  123. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/botocore/handlers/botocore_span_handler.py +0 -0
  124. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/botocore/methods.py +0 -0
  125. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/gemini → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/fastapi}/__init__.py +0 -0
  126. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/fastapi/_helper.py +0 -0
  127. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/gemini → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/fastapi}/entities/__init__.py +0 -0
  128. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/haystack → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/flask}/__init__.py +0 -0
  129. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/flask/_helper.py +0 -0
  130. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/flask/methods.py +0 -0
  131. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/haystack/entities → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/gemini}/__init__.py +0 -0
  132. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/gemini/_helper.py +0 -0
  133. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/langchain → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/gemini/entities}/__init__.py +0 -0
  134. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/langchain/entities → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/haystack}/__init__.py +0 -0
  135. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/langgraph → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/haystack/entities}/__init__.py +0 -0
  136. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/haystack/methods.py +0 -0
  137. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/lambdafunc/_helper.py +0 -0
  138. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/lambdafunc/methods.py +0 -0
  139. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/lambdafunc/wrapper.py +0 -0
  140. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/langgraph/entities → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/langchain}/__init__.py +0 -0
  141. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/llamaindex → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/langchain/entities}/__init__.py +0 -0
  142. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/langchain/methods.py +0 -0
  143. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/llamaindex/entities → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/langgraph}/__init__.py +0 -0
  144. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/mcp → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/langgraph/entities}/__init__.py +0 -0
  145. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/mcp/entities → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/litellm}/__init__.py +0 -0
  146. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/openai → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/litellm/entities}/__init__.py +0 -0
  147. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/openai/entities → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/llamaindex}/__init__.py +0 -0
  148. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/llamaindex/_helper.py +0 -0
  149. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/teamsai → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/llamaindex/entities}/__init__.py +0 -0
  150. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/teamsai/entities → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/mcp}/__init__.py +0 -0
  151. {monocle_apptrace-0.5.0b1/src/monocle_apptrace/instrumentation/metamodel/teamsai/entities/inference → monocle_apptrace-0.5.1/src/monocle_apptrace/instrumentation/metamodel/mcp/entities}/__init__.py +0 -0
  152. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/openai/entities/retrieval.py +0 -0
  153. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/openai/methods.py +0 -0
  154. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/requests/__init__.py +0 -0
  155. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/requests/_helper.py +0 -0
  156. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/requests/methods.py +0 -0
  157. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/teamsai/entities/inference/actionplanner_output_processor.py +0 -0
  158. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/teamsai/methods.py +0 -0
  159. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/src/monocle_apptrace/instrumentation/metamodel/teamsai/sample.json +0 -0
  160. {monocle_apptrace-0.5.0b1 → monocle_apptrace-0.5.1}/tox.ini +0 -0
@@ -1,6 +1,17 @@
1
+ ## Version 0.5.1 (2025-08-25)
1
2
 
2
- ## Version 0.5.0b1 (2025-08-04)
3
+ - Support injecting synthetic spans and use that for adding delegation span in Google ADK ([#257](https://github.com/monocle2ai/monocle/pull/257))
4
+ - Added monocle subtypes ([#256](https://github.com/monocle2ai/monocle/pull/256))
5
+ - OpenAI agents request span ([#255](https://github.com/monocle2ai/monocle/pull/255))
6
+ - Set scopes for agent request and invocation plus minor fixes ([#253](https://github.com/monocle2ai/monocle/pull/253))
3
7
 
8
+ ## Version 0.5.0 (2025-08-05)
9
+
10
+ - Fix missing inference span in google ADK ([#249](https://github.com/monocle2ai/monocle/pull/249))
11
+ - Added openai agents instrumentation ([#248](https://github.com/monocle2ai/monocle/pull/248))
12
+ - Google Agent development kit meta mode ([#247](https://github.com/monocle2ai/monocle/pull/247))
13
+ - Add Support for LiteLLM OpenAI and AzureOpenAI ([#246](https://github.com/monocle2ai/monocle/pull/246))
14
+ - Added inference subtype for langgrap, openai and anthropic ([#245](https://github.com/monocle2ai/monocle/pull/245))
4
15
  - Add support for teams finish type, move finish types to metadata section ([#240](https://github.com/monocle2ai/monocle/pull/240))
5
16
  - Fix integration tests ([#239](https://github.com/monocle2ai/monocle/pull/239))
6
17
  - Add function_name attribute for Azure function ([#238](https://github.com/monocle2ai/monocle/pull/238))
@@ -139,3 +150,40 @@
139
150
  ## 0.0.1 (Jul 17, 2024)
140
151
 
141
152
  - First monocle release
153
+
154
+ - Add support for teams finish type, move finish types to metadata section ([#240](https://github.com/monocle2ai/monocle/pull/240))
155
+ - Fix integration tests ([#239](https://github.com/monocle2ai/monocle/pull/239))
156
+ - Add function_name attribute for Azure function ([#238](https://github.com/monocle2ai/monocle/pull/238))
157
+ - Added MCP and A2A ([#237](https://github.com/monocle2ai/monocle/pull/237))
158
+ - Add Metamodel for Lambda Func ([#236](https://github.com/monocle2ai/monocle/pull/236))
159
+ - Allow llm SDKs as workflow types ([#234](https://github.com/monocle2ai/monocle/pull/234))
160
+ - Add Sample Span for VertexAI ([#233](https://github.com/monocle2ai/monocle/pull/233))
161
+ - Add Haystack Gemini sample ([#232](https://github.com/monocle2ai/monocle/pull/232))
162
+ - Add Llama Index Gemini sample ([#231](https://github.com/monocle2ai/monocle/pull/231))
163
+ - Add workflow span name to all spans ([#230](https://github.com/monocle2ai/monocle/pull/230))
164
+ - Add Langchain Gemini sample ([#229](https://github.com/monocle2ai/monocle/pull/229))
165
+ - Add Embeddings Span in Gemini Metamodel ([#228](https://github.com/monocle2ai/monocle/pull/228))
166
+ - Agent metamodel updates for LangGraph ([#227](https://github.com/monocle2ai/monocle/pull/227))
167
+ - Add fastapi metamodel with fastapi tracid propogation testcase ([#226](https://github.com/monocle2ai/monocle/pull/226))
168
+
169
+
170
+ - Fix missing inference span in google ADK ([#249](https://github.com/monocle2ai/monocle/pull/249))
171
+ - Added openai agents instrumentation ([#248](https://github.com/monocle2ai/monocle/pull/248))
172
+ - Google Agent development kit meta mode ([#247](https://github.com/monocle2ai/monocle/pull/247))
173
+ - Add Support for LiteLLM OpenAI and AzureOpenAI ([#246](https://github.com/monocle2ai/monocle/pull/246))
174
+ - Added inference subtype for langgrap, openai and anthropic ([#245](https://github.com/monocle2ai/monocle/pull/245))
175
+ - Add support for teams finish type, move finish types to metadata section ([#240](https://github.com/monocle2ai/monocle/pull/240))
176
+ - Fix integration tests ([#239](https://github.com/monocle2ai/monocle/pull/239))
177
+ - Add function_name attribute for Azure function ([#238](https://github.com/monocle2ai/monocle/pull/238))
178
+ - Added MCP and A2A ([#237](https://github.com/monocle2ai/monocle/pull/237))
179
+ - Add Metamodel for Lambda Func ([#236](https://github.com/monocle2ai/monocle/pull/236))
180
+ - Allow llm SDKs as workflow types ([#234](https://github.com/monocle2ai/monocle/pull/234))
181
+ - Add Sample Span for VertexAI ([#233](https://github.com/monocle2ai/monocle/pull/233))
182
+ - Add Haystack Gemini sample ([#232](https://github.com/monocle2ai/monocle/pull/232))
183
+ - Add Llama Index Gemini sample ([#231](https://github.com/monocle2ai/monocle/pull/231))
184
+ - Add workflow span name to all spans ([#230](https://github.com/monocle2ai/monocle/pull/230))
185
+ - Add Langchain Gemini sample ([#229](https://github.com/monocle2ai/monocle/pull/229))
186
+ - Add Embeddings Span in Gemini Metamodel ([#228](https://github.com/monocle2ai/monocle/pull/228))
187
+ - Agent metamodel updates for LangGraph ([#227](https://github.com/monocle2ai/monocle/pull/227))
188
+ - Add fastapi metamodel with fastapi tracid propogation testcase ([#226](https://github.com/monocle2ai/monocle/pull/226))
189
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: monocle_apptrace
3
- Version: 0.5.0b1
3
+ Version: 0.5.1
4
4
  Summary: package with monocle genAI tracing
5
5
  Project-URL: Homepage, https://github.com/monocle2ai/monocle
6
6
  Project-URL: Issues, https://github.com/monocle2ai/monocle/issues
@@ -25,12 +25,14 @@ Requires-Dist: anthropic-haystack; extra == 'dev'
25
25
  Requires-Dist: anthropic==0.57.1; extra == 'dev'
26
26
  Requires-Dist: azure-storage-blob==12.22.0; extra == 'dev'
27
27
  Requires-Dist: boto3==1.37.24; extra == 'dev'
28
- Requires-Dist: chromadb==1.0.10; extra == 'dev'
28
+ Requires-Dist: chromadb==1.0.15; extra == 'dev'
29
29
  Requires-Dist: click==8.2.1; extra == 'dev'
30
30
  Requires-Dist: datasets==2.20.0; extra == 'dev'
31
31
  Requires-Dist: faiss-cpu==1.8.0; extra == 'dev'
32
- Requires-Dist: fastapi>=0.115.1; extra == 'dev'
32
+ Requires-Dist: fastapi>=0.115.0; extra == 'dev'
33
33
  Requires-Dist: flask; extra == 'dev'
34
+ Requires-Dist: google-adk==1.10.0; extra == 'dev'
35
+ Requires-Dist: google-generativeai==0.8.5; extra == 'dev'
34
36
  Requires-Dist: haystack-ai==2.3.0; extra == 'dev'
35
37
  Requires-Dist: httpx==0.28.1; extra == 'dev'
36
38
  Requires-Dist: instructorembedding==1.0.1; extra == 'dev'
@@ -46,16 +48,19 @@ Requires-Dist: langchain==0.3.25; extra == 'dev'
46
48
  Requires-Dist: langchainhub==0.1.21; extra == 'dev'
47
49
  Requires-Dist: langgraph-supervisor==0.0.28; extra == 'dev'
48
50
  Requires-Dist: langgraph==0.5.4; extra == 'dev'
49
- Requires-Dist: llama-index-embeddings-huggingface==0.5.4; extra == 'dev'
50
- Requires-Dist: llama-index-llms-anthropic==0.6.19; extra == 'dev'
51
- Requires-Dist: llama-index-llms-azure-openai==0.3.2; extra == 'dev'
52
- Requires-Dist: llama-index-llms-mistralai==0.4.0; extra == 'dev'
53
- Requires-Dist: llama-index-vector-stores-chroma==0.4.1; extra == 'dev'
54
- Requires-Dist: llama-index-vector-stores-opensearch==0.5.4; extra == 'dev'
55
- Requires-Dist: llama-index==0.12.37; extra == 'dev'
51
+ Requires-Dist: llama-index-embeddings-huggingface==0.6.0; extra == 'dev'
52
+ Requires-Dist: llama-index-llms-anthropic==0.8.1; extra == 'dev'
53
+ Requires-Dist: llama-index-llms-azure-openai==0.4.0; extra == 'dev'
54
+ Requires-Dist: llama-index-llms-mistralai==0.7.0; extra == 'dev'
55
+ Requires-Dist: llama-index-llms-openai==0.5.0; extra == 'dev'
56
+ Requires-Dist: llama-index-tools-mcp==0.3.0; extra == 'dev'
57
+ Requires-Dist: llama-index-vector-stores-chroma==0.5.0; extra == 'dev'
58
+ Requires-Dist: llama-index-vector-stores-opensearch==0.6.0; extra == 'dev'
59
+ Requires-Dist: llama-index==0.13.0; extra == 'dev'
56
60
  Requires-Dist: mcp==1.12.1; extra == 'dev'
57
61
  Requires-Dist: mistral-haystack==0.0.2; extra == 'dev'
58
62
  Requires-Dist: numpy==1.26.4; extra == 'dev'
63
+ Requires-Dist: openai-agents==0.2.6; extra == 'dev'
59
64
  Requires-Dist: opendal==0.45.14; extra == 'dev'
60
65
  Requires-Dist: opensearch-haystack==1.2.0; extra == 'dev'
61
66
  Requires-Dist: opentelemetry-instrumentation-flask; extra == 'dev'
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "monocle_apptrace"
7
- version = "0.5.0b1"
7
+ version = "0.5.1"
8
8
  authors = []
9
9
  description = "package with monocle genAI tracing"
10
10
  readme = "README.md"
@@ -52,23 +52,25 @@ dev = [
52
52
  'sentence-transformers==2.6.1',
53
53
  'faiss-cpu==1.8.0',
54
54
  'pytest==8.3.5',
55
- 'llama-index==0.12.37',
56
- 'llama-index-embeddings-huggingface==0.5.4',
57
- 'llama-index-vector-stores-chroma==0.4.1',
55
+ 'llama-index==0.13.0',
56
+ 'llama-index-llms-openai==0.5.0',
57
+ 'llama-index-tools-mcp==0.3.0',
58
+ 'llama-index-embeddings-huggingface==0.6.0',
59
+ 'llama-index-vector-stores-chroma==0.5.0',
58
60
  'parameterized==0.9.0',
59
- 'llama-index-llms-mistralai==0.4.0',
61
+ 'llama-index-llms-mistralai==0.7.0',
60
62
  'langchain-mistralai==0.2.10',
61
63
  'mistral-haystack==0.0.2',
62
64
  'langchain-aws==0.2.23',
63
65
  'azure-storage-blob==12.22.0', # this is for blob exporter
64
66
  'boto3==1.37.24', # this is for aws exporter
65
- 'llama-index-vector-stores-opensearch==0.5.4',
67
+ 'llama-index-vector-stores-opensearch==0.6.0',
66
68
  'haystack-ai==2.3.0',
67
- 'llama-index-llms-azure-openai==0.3.2',
69
+ 'llama-index-llms-azure-openai==0.4.0',
68
70
  'requests-aws4auth==1.2.3',
69
71
  'opensearch-haystack==1.2.0',
70
72
  'langchainhub==0.1.21',
71
- 'chromadb==1.0.10',
73
+ 'chromadb==1.0.15',
72
74
  'flask',
73
75
  'opentelemetry-instrumentation-flask',
74
76
  'langgraph==0.5.4',
@@ -77,18 +79,21 @@ dev = [
77
79
  'anthropic==0.57.1',
78
80
  'anthropic-haystack',
79
81
  'pytest-asyncio==0.26.0',
80
- 'llama-index-llms-anthropic==0.6.19',
82
+ 'llama-index-llms-anthropic==0.8.1',
81
83
  'langchain-anthropic==0.3.13',
82
84
  'langchain-mcp-adapters==0.1.8',
83
85
  'mcp==1.12.1',
84
- 'a2a-sdk==0.2.8',
86
+ 'a2a-sdk==0.2.8',
85
87
  'httpx==0.28.1',
86
- 'fastapi>=0.115.1',
88
+ 'fastapi>=0.115.0',
87
89
  'pydantic==2.11.7',
88
90
  'uvicorn==0.35.0',
89
91
  'click==8.2.1',
90
92
  'python-dotenv>=1.1.0',
91
93
  'langchain-google-genai==2.1.8',
94
+ 'google-adk==1.10.0',
95
+ 'google-generativeai==0.8.5',
96
+ 'openai-agents==0.2.6'
92
97
  ]
93
98
 
94
99
  azure = [
@@ -3,6 +3,7 @@
3
3
  from os import linesep, path
4
4
  from io import TextIOWrapper
5
5
  from datetime import datetime
6
+ import os
6
7
  from typing import Optional, Callable, Sequence, Dict, Tuple
7
8
  from opentelemetry.sdk.trace import ReadableSpan
8
9
  from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
@@ -32,7 +33,7 @@ class FileSpanExporter(SpanExporterBase):
32
33
  self.file_handles: Dict[int, Tuple[TextIOWrapper, str, datetime, bool]] = {}
33
34
  self.formatter = formatter
34
35
  self.service_name = service_name
35
- self.output_path = out_path
36
+ self.output_path = os.getenv("MONOCLE_TRACE_OUTPUT_PATH", out_path)
36
37
  self.file_prefix = file_prefix
37
38
  self.time_format = time_format
38
39
  self.task_processor = task_processor
@@ -2,16 +2,18 @@ from .instrumentor import (
2
2
  setup_monocle_telemetry,
3
3
  start_trace,
4
4
  stop_trace,
5
- start_scope,
6
- stop_scope,
7
5
  http_route_handler,
8
- monocle_trace_scope,
9
- amonocle_trace_scope,
10
- monocle_trace_scope_method,
11
6
  monocle_trace,
12
7
  amonocle_trace,
13
8
  monocle_trace_method,
14
9
  monocle_trace_http_route,
15
10
  is_valid_trace_id_uuid
16
11
  )
12
+ from .scope_wrapper import (
13
+ start_scope,
14
+ stop_scope,
15
+ monocle_trace_scope,
16
+ amonocle_trace_scope,
17
+ monocle_trace_scope_method
18
+ )
17
19
  from .utils import MonocleSpanException
@@ -0,0 +1,180 @@
1
+ # Azure environment constants
2
+ AZURE_ML_ENDPOINT_ENV_NAME = "AZUREML_ENTRY_SCRIPT"
3
+ AZURE_FUNCTION_WORKER_ENV_NAME = "FUNCTIONS_WORKER_RUNTIME"
4
+ AZURE_APP_SERVICE_ENV_NAME = "WEBSITE_SITE_NAME"
5
+ AWS_LAMBDA_ENV_NAME = "AWS_LAMBDA_RUNTIME_API"
6
+ GITHUB_CODESPACE_ENV_NAME = "CODESPACES"
7
+
8
+ AWS_LAMBDA_FUNCTION_IDENTIFIER_ENV_NAME = "AWS_LAMBDA_FUNCTION_NAME"
9
+ AZURE_FUNCTION_IDENTIFIER_ENV_NAME = "WEBSITE_SITE_NAME"
10
+ AZURE_APP_SERVICE_IDENTIFIER_ENV_NAME = "WEBSITE_DEPLOYMENT_ID"
11
+ GITHUB_CODESPACE_IDENTIFIER_ENV_NAME = "GITHUB_REPOSITORY"
12
+
13
+
14
+ # Azure naming reference can be found here
15
+ # https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-abbreviations
16
+ # https://docs.aws.amazon.com/resource-explorer/latest/userguide/supported-resource-types.html#services-lookoutmetrics
17
+ AZURE_FUNCTION_NAME = "azure_func"
18
+ AZURE_APP_SERVICE_NAME = "azure_webapp"
19
+ AZURE_ML_SERVICE_NAME = "azure_ml"
20
+ AWS_LAMBDA_SERVICE_NAME = "aws_lambda"
21
+ GITHUB_CODESPACE_SERVICE_NAME = "github_codespace"
22
+
23
+ # Env variables to identify infra service type
24
+ service_type_map = {
25
+ AZURE_ML_ENDPOINT_ENV_NAME: AZURE_ML_SERVICE_NAME,
26
+ AZURE_APP_SERVICE_ENV_NAME: AZURE_APP_SERVICE_NAME,
27
+ AZURE_FUNCTION_WORKER_ENV_NAME: AZURE_FUNCTION_NAME,
28
+ AWS_LAMBDA_ENV_NAME: AWS_LAMBDA_SERVICE_NAME,
29
+ GITHUB_CODESPACE_ENV_NAME: GITHUB_CODESPACE_SERVICE_NAME,
30
+ }
31
+
32
+ # Env variables to identify infra service name
33
+ service_name_map = {
34
+ AZURE_APP_SERVICE_NAME: AZURE_APP_SERVICE_IDENTIFIER_ENV_NAME,
35
+ AZURE_FUNCTION_NAME: AZURE_FUNCTION_IDENTIFIER_ENV_NAME,
36
+ AZURE_ML_SERVICE_NAME: AZURE_ML_ENDPOINT_ENV_NAME,
37
+ AWS_LAMBDA_SERVICE_NAME: AWS_LAMBDA_FUNCTION_IDENTIFIER_ENV_NAME,
38
+ GITHUB_CODESPACE_SERVICE_NAME: GITHUB_CODESPACE_IDENTIFIER_ENV_NAME,
39
+ }
40
+
41
+
42
+ llm_type_map = {
43
+ "sagemakerendpoint": "aws_sagemaker",
44
+ "azureopenai": "azure_openai",
45
+ "openai": "openai",
46
+ "chatopenai": "openai",
47
+ "azurechatopenai": "azure_openai",
48
+ "bedrock": "aws_bedrock",
49
+ "sagemakerllm": "aws_sagemaker",
50
+ "chatbedrock": "aws_bedrock",
51
+ "openaigenerator": "openai",
52
+ "bedrockruntime": "aws_bedrock",
53
+ "sagemakerruntime": "aws_sagemaker",
54
+ "anthropic": "anthropic",
55
+ "chatanthropic": "anthropic",
56
+ "anthropicchatgenerator": "anthropic",
57
+ "chatcompletionsclient": "azure_ai_inference",
58
+ "embeddingsclient": "azure_ai_inference",
59
+ "imageembeddingsclient": "azure_ai_inference",
60
+ "chatbedrockconverse": "aws_bedrock",
61
+ "googleaigeminichatgenerator": "gemini",
62
+ "gemini": "gemini",
63
+ "chatgooglegenerativeai": "gemini",
64
+ "azurechatcompletion": "azure_openai",
65
+ "openaichatcompletion": "openai",
66
+ }
67
+
68
+ MONOCLE_INSTRUMENTOR = "monocle_apptrace"
69
+ WORKFLOW_TYPE_KEY = "workflow_type"
70
+ DATA_INPUT_KEY = "data.input"
71
+ DATA_OUTPUT_KEY = "data.output"
72
+ PROMPT_INPUT_KEY = "data.input"
73
+ PROMPT_OUTPUT_KEY = "data.output"
74
+ QUERY = "input"
75
+ RESPONSE = "response"
76
+ SESSION_PROPERTIES_KEY = "session"
77
+ INFRA_SERVICE_KEY = "infra_service_name"
78
+ META_DATA = "metadata"
79
+ MONOCLE_SCOPE_NAME_PREFIX = "monocle.scope."
80
+ SCOPE_METHOD_LIST = "MONOCLE_SCOPE_METHODS"
81
+ SCOPE_METHOD_FILE = "monocle_scopes.json"
82
+ SCOPE_CONFIG_PATH = "MONOCLE_SCOPE_CONFIG_PATH"
83
+ TRACE_PROPOGATION_URLS = "MONOCLE_TRACE_PROPAGATATION_URLS"
84
+ WORKFLOW_TYPE_KEY = "monocle.workflow_type"
85
+ ADD_NEW_WORKFLOW = "monocle.add_new_workflow"
86
+ WORKFLOW_TYPE_GENERIC = "workflow.generic"
87
+ MONOCLE_SDK_VERSION = "monocle_apptrace.version"
88
+ MONOCLE_SDK_LANGUAGE = "monocle_apptrace.language"
89
+ MONOCLE_DETECTED_SPAN_ERROR = "monocle_apptrace.detected_span_error"
90
+ HTTP_SUCCESS_CODES = ("200", "201", "202", "204", "205", "206")
91
+ CHILD_ERROR_CODE = "child.error.code"
92
+
93
+ AGENT_PREFIX_KEY = "monocle.agent.prefix"
94
+
95
+ # agentic sub types
96
+ INFERENCE_AGENT_DELEGATION = "delegation"
97
+ INFERENCE_TOOL_CALL = "tool_call"
98
+ INFERENCE_TURN_END = "turn_end"
99
+
100
+ SCOPE_NAME = "scope_name"
101
+ AGENT_INVOCATION_SPAN_NAME = "agentic.invocation"
102
+ AGENT_REQUEST_SPAN_NAME = "agentic.request"
103
+
104
+ AGENTIC_SPANS = [AGENT_INVOCATION_SPAN_NAME, AGENT_REQUEST_SPAN_NAME]
105
+
106
+ # Span sub types
107
+
108
+ ## OPTIONAL right next to span.type, span.subtype:
109
+ ## subtype is one perspective , are non overlapping, limitations: only one classification scheme for subtypes
110
+ # 1 planning
111
+ SPAN_SUBTYPE_PLANNING = "planning"
112
+
113
+ # 2 routing and selection INFERENCE_TOOL_CALL, INFERENCE_AGENT_DELEGATION
114
+ SPAN_SUBTYPE_ROUTING = "routing"
115
+
116
+ # 3 content processing
117
+ SPAN_SUBTYPE_CONTENT_PROCESSING = "content_processing"
118
+
119
+ # 4 content generation
120
+ SPAN_SUBTYPE_CONTENT_GENERATION = "content_generation"
121
+
122
+ # 5 communication INFERENCE_TURN_END
123
+ SPAN_SUBTYPE_COMMUNICATION = "communication"
124
+
125
+ # 6 transformations , if structured output
126
+ SPAN_SUBTYPE_TRANSFORMATIONS = "transformations"
127
+
128
+ # 7 domain specific,
129
+ SPAN_SUBTYPE_DOMAIN_SPECIFIC = "domain_specific"
130
+
131
+ # 8 generic (we may skip this property)
132
+ SPAN_SUBTYPE_GENERIC = "generic"
133
+
134
+ class SPAN_TYPES:
135
+ GENERIC = "generic"
136
+ AGENTIC_DELEGATION = "agentic.delegation"
137
+ AGENTIC_TOOL_INVOCATION = "agentic.tool.invocation"
138
+ AGENTIC_INVOCATION = "agentic.invocation"
139
+ AGENTIC_MCP_INVOCATION = "agentic.mcp.invocation"
140
+ AGENTIC_REQUEST = "agentic.request"
141
+
142
+ # http.process
143
+ HTTP_PROCESS = "http.process"
144
+ HTTP_SEND = "http.send"
145
+
146
+ RETRIEVAL = "retrieval"
147
+ INFERENCE = "inference"
148
+ INFERENCE_FRAMEWORK = "inference.framework"
149
+
150
+
151
+ class SPAN_SUBTYPES:
152
+ PLANNING = SPAN_SUBTYPE_PLANNING
153
+ ROUTING = SPAN_SUBTYPE_ROUTING
154
+ CONTENT_PROCESSING = SPAN_SUBTYPE_CONTENT_PROCESSING
155
+ CONTENT_GENERATION = SPAN_SUBTYPE_CONTENT_GENERATION
156
+ COMMUNICATION = SPAN_SUBTYPE_COMMUNICATION
157
+ TRANSFORMATIONS = SPAN_SUBTYPE_TRANSFORMATIONS
158
+ DOMAIN_SPECIFIC = SPAN_SUBTYPE_DOMAIN_SPECIFIC
159
+ GENERIC = SPAN_SUBTYPE_GENERIC
160
+
161
+
162
+ MAP_ATTRIBUTES_TO_SPAN_SUBTYPE = {
163
+ # inference attributes
164
+ INFERENCE_AGENT_DELEGATION: SPAN_SUBTYPES.ROUTING,
165
+ INFERENCE_TOOL_CALL: SPAN_SUBTYPES.ROUTING,
166
+ INFERENCE_TURN_END: SPAN_SUBTYPES.COMMUNICATION,
167
+
168
+ # agentic span.types
169
+ SPAN_TYPES.AGENTIC_DELEGATION: SPAN_SUBTYPES.ROUTING,
170
+ SPAN_TYPES.AGENTIC_TOOL_INVOCATION: SPAN_SUBTYPES.ROUTING,
171
+ SPAN_TYPES.AGENTIC_INVOCATION: SPAN_SUBTYPES.ROUTING,
172
+ SPAN_TYPES.AGENTIC_MCP_INVOCATION: SPAN_SUBTYPES.ROUTING,
173
+
174
+ # MAYBE?
175
+ # agentic span.types
176
+ SPAN_TYPES.AGENTIC_REQUEST: SPAN_SUBTYPES.PLANNING,
177
+
178
+
179
+
180
+ }
@@ -235,17 +235,12 @@ def is_valid_trace_id_uuid(traceId: str) -> bool:
235
235
  return False
236
236
 
237
237
  from monocle_apptrace.instrumentation.common.method_wrappers import (
238
- monocle_trace_scope_method,
239
- amonocle_trace_scope,
240
238
  monocle_trace,
241
239
  amonocle_trace,
242
240
  monocle_trace_method,
243
241
  monocle_trace_http_route,
244
- start_scope,
245
- stop_scope,
246
242
  start_trace,
247
243
  stop_trace,
248
- http_route_handler,
249
- monocle_trace_scope,
244
+ http_route_handler
250
245
  )
251
246
 
@@ -5,14 +5,13 @@ from functools import wraps
5
5
  import inspect
6
6
  from opentelemetry.context import attach, get_current, detach
7
7
  from opentelemetry.sdk.trace import Span
8
- from opentelemetry.sdk.trace import Span
8
+ from opentelemetry.trace.span import INVALID_SPAN
9
9
  from opentelemetry.trace import get_tracer
10
- from opentelemetry.trace.propagation import set_span_in_context, _SPAN_KEY
11
10
  from contextlib import contextmanager, asynccontextmanager
12
11
  from monocle_apptrace.instrumentation.common.span_handler import SpanHandler
13
- from monocle_apptrace.instrumentation.common.wrapper import atask_wrapper, task_wrapper
12
+ from monocle_apptrace.instrumentation.common.wrapper import atask_wrapper, get_current_monocle_span, set_monocle_span_in_context, task_wrapper
14
13
  from monocle_apptrace.instrumentation.common.utils import (
15
- set_scope, remove_scope, http_route_handler, http_async_route_handler
14
+ http_route_handler, http_async_route_handler
16
15
  )
17
16
  from monocle_apptrace.instrumentation.common.constants import MONOCLE_INSTRUMENTOR
18
17
  from monocle_apptrace.instrumentation.common.instrumentor import get_tracer_provider
@@ -48,7 +47,7 @@ def start_trace(
48
47
  tracer = get_tracer(instrumenting_module_name= MONOCLE_INSTRUMENTOR, tracer_provider= get_tracer_provider())
49
48
  span_name = span_name or "custom_span"
50
49
  span = tracer.start_span(name=span_name)
51
- updated_span_context = set_span_in_context(span=span)
50
+ updated_span_context = set_monocle_span_in_context(span=span)
52
51
 
53
52
  # Set default monocle attributes
54
53
  SpanHandler.set_default_monocle_attributes(span)
@@ -57,7 +56,7 @@ def start_trace(
57
56
 
58
57
  # Set custom attributes and events using common method
59
58
  _setup_span_attributes_and_events(span, attributes, events)
60
-
59
+
61
60
  token = attach(updated_span_context)
62
61
  return token
63
62
  except Exception as e:
@@ -81,62 +80,16 @@ def stop_trace(
81
80
  None
82
81
  """
83
82
  try:
84
- _parent_span_context = get_current()
85
- if _parent_span_context is not None:
86
- parent_span: Span = _parent_span_context.get(_SPAN_KEY, None)
87
- if parent_span is not None:
88
- # Set final attributes and events using common method
89
- _setup_span_attributes_and_events(parent_span, final_attributes, final_events)
90
-
91
- parent_span.end()
83
+ parent_span = get_current_monocle_span()
84
+ if parent_span is not None and parent_span != INVALID_SPAN:
85
+ # Set final attributes and events using common method
86
+ _setup_span_attributes_and_events(parent_span, final_attributes, final_events)
87
+ parent_span.end()
92
88
  if token is not None:
93
89
  detach(token)
94
90
  except Exception as e:
95
91
  logger.warning(f"Failed to stop trace: {e}")
96
92
 
97
- def start_scope(
98
- scope_name: str,
99
- scope_value: Optional[str] = None
100
- ) -> object:
101
- """
102
- Start a new scope with the given name and optional value. If no value is provided, a random UUID will be generated.
103
- All the spans, across traces created after this call will have the scope attached until the scope is stopped.
104
-
105
- Args:
106
- scope_name: The name of the scope.
107
- scope_value: Optional value of the scope. If None, a random UUID will be generated.
108
-
109
- Returns:
110
- Token: A token representing the attached context for the scope. This token is to be used later to stop the current scope.
111
- """
112
- try:
113
- # Set the scope using existing utility
114
- token = set_scope(scope_name, scope_value)
115
- return token
116
- except Exception as e:
117
- logger.warning(f"Failed to start scope: {e}")
118
- return None
119
-
120
- def stop_scope(
121
- token: object
122
- ) -> None:
123
- """
124
- Stop the active scope. All the spans created after this will not have the scope attached.
125
-
126
- Args:
127
- token: The token that was returned when the scope was started.
128
-
129
- Returns:
130
- None
131
- """
132
- try:
133
- # Remove the scope
134
- remove_scope(token)
135
- except Exception as e:
136
- logger.warning(f"Failed to stop scope: {e}")
137
- return
138
-
139
-
140
93
  @contextmanager
141
94
  def monocle_trace(
142
95
  span_name: Optional[str] = None,
@@ -211,74 +164,6 @@ async def amonocle_trace(
211
164
  logger.warning(f"Failed in amonocle_trace: {e}")
212
165
  yield # Still yield to not break the context manager
213
166
 
214
- @contextmanager
215
- def monocle_trace_scope(
216
- scope_name: str,
217
- scope_value: Optional[str] = None
218
- ):
219
- """
220
- Context manager to start and stop a scope. All the spans, across traces created within the encapsulated code will have the scope attached.
221
-
222
- Args:
223
- scope_name: The name of the scope.
224
- scope_value: Optional value of the scope. If None, a random UUID will be generated.
225
- """
226
- token = start_scope(scope_name, scope_value)
227
- try:
228
- yield
229
- finally:
230
- stop_scope(token)
231
-
232
- @asynccontextmanager
233
- async def amonocle_trace_scope(
234
- scope_name: str,
235
- scope_value: Optional[str] = None
236
- ):
237
- """
238
- Async context manager to start and stop a scope. All the spans, across traces created within the encapsulated code will have the scope attached.
239
-
240
- Args:
241
- scope_name: The name of the scope.
242
- scope_value: Optional value of the scope. If None, a random UUID will be generated.
243
- """
244
- token = start_scope(scope_name, scope_value)
245
- try:
246
- yield
247
- finally:
248
- stop_scope(token)
249
-
250
- def monocle_trace_scope_method(
251
- scope_name: str,
252
- scope_value: Optional[str] = None
253
- ):
254
- """
255
- Decorator to start and stop a scope for a method. All the spans, across traces created in the method will have the scope attached.
256
-
257
- Args:
258
- scope_name: The name of the scope.
259
- scope_value: Optional value of the scope. If None, a random UUID will be generated.
260
- """
261
- def decorator(func):
262
- if inspect.iscoroutinefunction(func):
263
- @wraps(func)
264
- async def wrapper(*args, **kwargs):
265
- async with amonocle_trace_scope(
266
- scope_name, scope_value
267
- ):
268
- result = await func(*args, **kwargs)
269
- return result
270
- return wrapper
271
- else:
272
- @wraps(func)
273
- def wrapper(*args, **kwargs):
274
- with monocle_trace_scope(
275
- scope_name, scope_value
276
- ):
277
- result = func(*args, **kwargs)
278
- return result
279
- return wrapper
280
- return decorator
281
-
282
167
  def monocle_trace_method(
283
168
  span_name: Optional[str] = None
284
169
  ):