monocle-apptrace 0.3.1__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of monocle-apptrace might be problematic. Click here for more details.

Files changed (102) hide show
  1. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/.gitignore +2 -1
  2. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/CHANGELOG.md +23 -1
  3. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/PKG-INFO +22 -18
  4. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/pyproject.toml +22 -18
  5. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/exporters/aws/s3_exporter.py +3 -1
  6. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/exporters/azure/blob_exporter.py +2 -2
  7. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/exporters/base_exporter.py +10 -4
  8. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/exporters/file_exporter.py +19 -4
  9. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/exporters/monocle_exporters.py +3 -3
  10. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/exporters/okahu/okahu_exporter.py +5 -2
  11. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/common/constants.py +9 -5
  12. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/common/instrumentor.py +24 -13
  13. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/common/span_handler.py +79 -38
  14. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/common/utils.py +90 -54
  15. monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/common/wrapper.py +247 -0
  16. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/common/wrapper_method.py +13 -6
  17. monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/aiohttp/_helper.py +66 -0
  18. monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/aiohttp/entities/http.py +51 -0
  19. monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/aiohttp/methods.py +13 -0
  20. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/flask/_helper.py +8 -3
  21. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/flask/entities/http.py +0 -1
  22. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/haystack/_helper.py +17 -4
  23. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/haystack/entities/inference.py +1 -1
  24. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/haystack/methods.py +8 -1
  25. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/langchain/entities/inference.py +1 -1
  26. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/llamaindex/_helper.py +13 -9
  27. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/llamaindex/entities/inference.py +1 -1
  28. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/llamaindex/methods.py +14 -0
  29. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/openai/_helper.py +26 -5
  30. monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/openai/entities/inference.py +229 -0
  31. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/openai/methods.py +6 -6
  32. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/requests/_helper.py +1 -1
  33. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/teamsai/_helper.py +55 -5
  34. monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/teamsai/entities/inference/__init__.py +0 -0
  35. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/teamsai/entities/inference/actionplanner_output_processor.py +13 -33
  36. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/teamsai/entities/inference/teamsai_output_processor.py +24 -20
  37. monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/teamsai/methods.py +72 -0
  38. monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/common/wrapper.py +0 -94
  39. monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/openai/entities/inference.py +0 -71
  40. monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/teamsai/methods.py +0 -26
  41. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/CODEOWNERS.md +0 -0
  42. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/CODE_OF_CONDUCT.md +0 -0
  43. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/CONTRIBUTING.md +0 -0
  44. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/COPYRIGHT.template +0 -0
  45. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/LICENSE +0 -0
  46. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/MAINTAINER.md +0 -0
  47. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/Monocle_User_Guide.md +0 -0
  48. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/Monocle_committer_guide.md +0 -0
  49. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/Monocle_contributor_guide.md +0 -0
  50. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/NOTICE +0 -0
  51. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/README.md +0 -0
  52. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/SECURITY.md +0 -0
  53. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/README.md +0 -0
  54. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/__init__.py +0 -0
  55. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/__main__.py +0 -0
  56. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/exporters/aws/s3_exporter_opendal.py +0 -0
  57. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/exporters/azure/blob_exporter_opendal.py +0 -0
  58. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/exporters/exporter_processor.py +0 -0
  59. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/__init__.py +0 -0
  60. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/common/__init__.py +0 -0
  61. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/common/tracing.md +0 -0
  62. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/__init__.py +0 -0
  63. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/anthropic → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/aiohttp}/__init__.py +0 -0
  64. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/anthropic/entities → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/anthropic}/__init__.py +0 -0
  65. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/anthropic/_helper.py +0 -0
  66. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/botocore → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/anthropic/entities}/__init__.py +0 -0
  67. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/anthropic/entities/inference.py +0 -0
  68. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/anthropic/methods.py +0 -0
  69. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/botocore/entities → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/botocore}/__init__.py +0 -0
  70. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/botocore/_helper.py +0 -0
  71. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/flask → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/botocore/entities}/__init__.py +0 -0
  72. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/botocore/entities/inference.py +0 -0
  73. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/botocore/handlers/botocore_span_handler.py +0 -0
  74. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/botocore/methods.py +0 -0
  75. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/haystack → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/flask}/__init__.py +0 -0
  76. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/flask/methods.py +0 -0
  77. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/haystack/entities → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/haystack}/__init__.py +0 -0
  78. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/langchain → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/haystack/entities}/__init__.py +0 -0
  79. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/haystack/entities/retrieval.py +0 -0
  80. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/langchain/entities → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/langchain}/__init__.py +0 -0
  81. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/langchain/_helper.py +0 -0
  82. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/langgraph → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/langchain/entities}/__init__.py +0 -0
  83. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/langchain/entities/retrieval.py +0 -0
  84. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/langchain/methods.py +0 -0
  85. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/langgraph/entities → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/langgraph}/__init__.py +0 -0
  86. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/langgraph/_helper.py +0 -0
  87. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/llamaindex → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/langgraph/entities}/__init__.py +0 -0
  88. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/langgraph/entities/inference.py +0 -0
  89. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/langgraph/methods.py +0 -0
  90. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/llamaindex/entities → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/llamaindex}/__init__.py +0 -0
  91. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/openai → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/llamaindex/entities}/__init__.py +0 -0
  92. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/llamaindex/entities/agent.py +0 -0
  93. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/llamaindex/entities/retrieval.py +0 -0
  94. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/openai/entities → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/openai}/__init__.py +0 -0
  95. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/teamsai → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/openai/entities}/__init__.py +0 -0
  96. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/openai/entities/retrieval.py +0 -0
  97. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/requests/__init__.py +0 -0
  98. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/requests/entities/http.py +0 -0
  99. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/src/monocle_apptrace/instrumentation/metamodel/requests/methods.py +0 -0
  100. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/teamsai/entities → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/teamsai}/__init__.py +0 -0
  101. {monocle_apptrace-0.3.1/src/monocle_apptrace/instrumentation/metamodel/teamsai/entities/inference → monocle_apptrace-0.4.0/src/monocle_apptrace/instrumentation/metamodel/teamsai/entities}/__init__.py +0 -0
  102. {monocle_apptrace-0.3.1 → monocle_apptrace-0.4.0}/tox.ini +0 -0
@@ -13,4 +13,5 @@ dist
13
13
  .tox
14
14
  .DS_Store
15
15
  Pipfile**
16
- launch.json
16
+ launch.json
17
+ monocle_trace**.json
@@ -1,3 +1,25 @@
1
+ ## Version 0.4.0 (2025-06-02)
2
+
3
+ - Update teams scopes ([#200](https://github.com/monocle2ai/monocle/pull/200))
4
+ - Record input and errors for inference.modelapi in case of error ([#193](https://github.com/monocle2ai/monocle/pull/193))
5
+ - Removed special handling for streaming in wrapper ([#192](https://github.com/monocle2ai/monocle/pull/192))
6
+
7
+
8
+ - Add Span error handling ([#186](https://github.com/monocle2ai/monocle/pull/186))
9
+ - Add teams ai enhancements ([#184](https://github.com/monocle2ai/monocle/pull/184))
10
+
11
+
12
+ - Added conversation id in scope for teams ai bot ([#180](https://github.com/monocle2ai/monocle/pull/180))
13
+ - Update inference entity type of TeamsAI SDK ([#178](https://github.com/monocle2ai/monocle/pull/178))
14
+ - Added stream and async for openai ([#177](https://github.com/monocle2ai/monocle/pull/177))
15
+ - Update inference span of TeamsAI ([#176](https://github.com/monocle2ai/monocle/pull/176))
16
+ - Remove Preset span name and Bugfix for Event ([#175](https://github.com/monocle2ai/monocle/pull/175))
17
+ - Add haystack anthropic sample ([#174](https://github.com/monocle2ai/monocle/pull/174))
18
+ - aiohttp auto instrumentation ([#173](https://github.com/monocle2ai/monocle/pull/173))
19
+ - Add source path to spans and fix json syntax in file exporter ([#172](https://github.com/monocle2ai/monocle/pull/172))
20
+ - Added changes for openai streaming ([#171](https://github.com/monocle2ai/monocle/pull/171))
21
+ - Add llama index anthropic sample ([#170](https://github.com/monocle2ai/monocle/pull/170))
22
+
1
23
  ## Version 0.3.1 (2024-04-18)
2
24
 
3
25
  - Add MetaModel for Anthropic SDK ([#159](https://github.com/monocle2ai/monocle/pull/159))
@@ -9,7 +31,7 @@
9
31
  - Support monocle exporter list as parameter to `setup_monocle_telemetry()` ([#161](https://github.com/monocle2ai/monocle/pull/161))
10
32
  - Add langchain anthropic sample ([#165](https://github.com/monocle2ai/monocle/pull/165))
11
33
 
12
- ## Version 0.3.0 (2024-12-10)
34
+ ## Version 0.3.0 (2024-03-18)
13
35
 
14
36
  - Fixed issue with passing context in async case ([#150](https://github.com/monocle2ai/monocle/pull/150))
15
37
  - Added lambda processor ([#148](https://github.com/monocle2ai/monocle/pull/148))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: monocle_apptrace
3
- Version: 0.3.1
3
+ Version: 0.4.0
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
@@ -16,40 +16,44 @@ Requires-Dist: opentelemetry-sdk>=1.21.0
16
16
  Requires-Dist: requests
17
17
  Requires-Dist: wrapt>=1.14.0
18
18
  Provides-Extra: aws
19
- Requires-Dist: boto3==1.35.19; extra == 'aws'
19
+ Requires-Dist: boto3==1.37.24; extra == 'aws'
20
20
  Provides-Extra: azure
21
21
  Requires-Dist: azure-storage-blob==12.22.0; extra == 'azure'
22
22
  Provides-Extra: dev
23
- Requires-Dist: anthropic==0.49.0; extra == 'dev'
23
+ Requires-Dist: anthropic-haystack; extra == 'dev'
24
+ Requires-Dist: anthropic==0.52.0; extra == 'dev'
24
25
  Requires-Dist: azure-storage-blob==12.22.0; extra == 'dev'
25
- Requires-Dist: boto3==1.34.131; extra == 'dev'
26
- Requires-Dist: chromadb==0.4.22; extra == 'dev'
26
+ Requires-Dist: boto3==1.37.24; extra == 'dev'
27
+ Requires-Dist: chromadb==1.0.10; extra == 'dev'
27
28
  Requires-Dist: datasets==2.20.0; extra == 'dev'
28
29
  Requires-Dist: faiss-cpu==1.8.0; extra == 'dev'
29
30
  Requires-Dist: flask; extra == 'dev'
30
31
  Requires-Dist: haystack-ai==2.3.0; extra == 'dev'
31
32
  Requires-Dist: instructorembedding==1.0.1; extra == 'dev'
32
- Requires-Dist: langchain-aws==0.1.10; extra == 'dev'
33
- Requires-Dist: langchain-chroma==0.1.1; extra == 'dev'
34
- Requires-Dist: langchain-community==0.2.5; extra == 'dev'
35
- Requires-Dist: langchain-mistralai==0.1.13; extra == 'dev'
36
- Requires-Dist: langchain-openai==0.1.8; extra == 'dev'
37
- Requires-Dist: langchain==0.2.5; extra == 'dev'
33
+ Requires-Dist: langchain-anthropic==0.3.13; extra == 'dev'
34
+ Requires-Dist: langchain-aws==0.2.23; extra == 'dev'
35
+ Requires-Dist: langchain-chroma==0.2.4; extra == 'dev'
36
+ Requires-Dist: langchain-community==0.3.24; extra == 'dev'
37
+ Requires-Dist: langchain-mistralai==0.2.10; extra == 'dev'
38
+ Requires-Dist: langchain-openai==0.3.18; extra == 'dev'
39
+ Requires-Dist: langchain==0.3.25; extra == 'dev'
38
40
  Requires-Dist: langchainhub==0.1.21; extra == 'dev'
39
41
  Requires-Dist: langgraph==0.2.68; extra == 'dev'
40
- Requires-Dist: llama-index-embeddings-huggingface==0.2.0; extra == 'dev'
41
- Requires-Dist: llama-index-llms-azure-openai==0.1.9; extra == 'dev'
42
- Requires-Dist: llama-index-llms-mistralai==0.1.20; extra == 'dev'
43
- Requires-Dist: llama-index-vector-stores-chroma==0.1.9; extra == 'dev'
44
- Requires-Dist: llama-index-vector-stores-opensearch==0.1.10; extra == 'dev'
45
- Requires-Dist: llama-index==0.10.30; extra == 'dev'
42
+ Requires-Dist: llama-index-embeddings-huggingface==0.5.4; extra == 'dev'
43
+ Requires-Dist: llama-index-llms-anthropic==0.6.19; extra == 'dev'
44
+ Requires-Dist: llama-index-llms-azure-openai==0.3.2; extra == 'dev'
45
+ Requires-Dist: llama-index-llms-mistralai==0.4.0; extra == 'dev'
46
+ Requires-Dist: llama-index-vector-stores-chroma==0.4.1; extra == 'dev'
47
+ Requires-Dist: llama-index-vector-stores-opensearch==0.5.4; extra == 'dev'
48
+ Requires-Dist: llama-index==0.12.37; extra == 'dev'
46
49
  Requires-Dist: mistral-haystack==0.0.2; extra == 'dev'
47
50
  Requires-Dist: numpy==1.26.4; extra == 'dev'
48
51
  Requires-Dist: opendal==0.45.14; extra == 'dev'
49
52
  Requires-Dist: opensearch-haystack==1.2.0; extra == 'dev'
50
53
  Requires-Dist: opentelemetry-instrumentation-flask; extra == 'dev'
51
54
  Requires-Dist: parameterized==0.9.0; extra == 'dev'
52
- Requires-Dist: pytest==8.0.0; extra == 'dev'
55
+ Requires-Dist: pytest-asyncio==0.26.0; extra == 'dev'
56
+ Requires-Dist: pytest==8.3.5; extra == 'dev'
53
57
  Requires-Dist: requests-aws4auth==1.2.3; extra == 'dev'
54
58
  Requires-Dist: sentence-transformers==2.6.1; extra == 'dev'
55
59
  Requires-Dist: types-requests==2.31.0.20240106; extra == 'dev'
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "monocle_apptrace"
7
- version = "0.3.1"
7
+ version = "0.4.0"
8
8
  authors = []
9
9
  description = "package with monocle genAI tracing"
10
10
  readme = "README.md"
@@ -41,39 +41,43 @@ markers = [
41
41
 
42
42
  [project.optional-dependencies]
43
43
  dev = [
44
- 'langchain-openai==0.1.8',
45
- 'langchain-chroma==0.1.1',
46
- 'langchain-community==0.2.5',
47
- 'langchain==0.2.5',
44
+ 'langchain-openai==0.3.18',
45
+ 'langchain-chroma==0.2.4',
46
+ 'langchain-community==0.3.24',
47
+ 'langchain==0.3.25',
48
48
  'datasets==2.20.0',
49
49
  'numpy==1.26.4',
50
50
  'types-requests==2.31.0.20240106',
51
51
  'InstructorEmbedding==1.0.1',
52
52
  'sentence-transformers==2.6.1',
53
53
  'faiss-cpu==1.8.0',
54
- 'pytest==8.0.0',
55
- 'llama-index==0.10.30',
56
- 'llama-index-embeddings-huggingface==0.2.0',
57
- 'llama-index-vector-stores-chroma==0.1.9',
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',
58
58
  'parameterized==0.9.0',
59
- 'llama-index-llms-mistralai==0.1.20',
60
- 'langchain-mistralai==0.1.13',
59
+ 'llama-index-llms-mistralai==0.4.0',
60
+ 'langchain-mistralai==0.2.10',
61
61
  'mistral-haystack==0.0.2',
62
- 'langchain-aws==0.1.10',
62
+ 'langchain-aws==0.2.23',
63
63
  'azure-storage-blob==12.22.0', # this is for blob exporter
64
- 'boto3==1.34.131', # this is for aws exporter
65
- 'llama-index-vector-stores-opensearch==0.1.10',
64
+ 'boto3==1.37.24', # this is for aws exporter
65
+ 'llama-index-vector-stores-opensearch==0.5.4',
66
66
  'haystack-ai==2.3.0',
67
- 'llama-index-llms-azure-openai==0.1.9',
67
+ 'llama-index-llms-azure-openai==0.3.2',
68
68
  'requests-aws4auth==1.2.3',
69
69
  'opensearch-haystack==1.2.0',
70
70
  'langchainhub==0.1.21',
71
- 'chromadb==0.4.22',
71
+ 'chromadb==1.0.10',
72
72
  'flask',
73
73
  'opentelemetry-instrumentation-flask',
74
74
  'langgraph==0.2.68',
75
75
  'opendal==0.45.14',
76
- 'anthropic==0.49.0',
76
+ 'anthropic==0.52.0',
77
+ 'anthropic-haystack',
78
+ 'pytest-asyncio==0.26.0',
79
+ 'llama-index-llms-anthropic==0.6.19',
80
+ 'langchain-anthropic==0.3.13'
77
81
  ]
78
82
 
79
83
  azure = [
@@ -81,7 +85,7 @@ azure = [
81
85
  ]
82
86
 
83
87
  aws = [
84
- 'boto3==1.35.19',
88
+ 'boto3==1.37.24',
85
89
  ]
86
90
 
87
91
  [project.urls]
@@ -129,6 +129,8 @@ class S3SpanExporter(SpanExporterBase):
129
129
  # Serialize spans to JSON or any other format you prefer
130
130
  valid_json_list = []
131
131
  for span in spans:
132
+ if self.skip_export(span):
133
+ continue
132
134
  try:
133
135
  valid_json_list.append(span.to_json(indent=0).replace("\n", ""))
134
136
  except json.JSONDecodeError as e:
@@ -169,7 +171,7 @@ class S3SpanExporter(SpanExporterBase):
169
171
  Key=file_name,
170
172
  Body=span_data_batch
171
173
  )
172
- logger.info(f"Span batch uploaded to AWS S3 as {file_name}.")
174
+ logger.debug(f"Span batch uploaded to AWS S3 as {file_name}.")
173
175
 
174
176
  async def force_flush(self, timeout_millis: int = 30000) -> bool:
175
177
  await self.__export_spans() # Export any remaining spans in the queue
@@ -82,8 +82,8 @@ class AzureBlobSpanExporter(SpanExporterBase):
82
82
  # With Monocle,OpenTelemetry is always loaded. If the Azure trace package is installed, then it triggers the blob trace generation on every blob operation.
83
83
  # Thus, the Monocle span write ends up generating a blob span which again comes back to the exporter .. and would result in an infinite loop.
84
84
  # To avoid this, we check if the span has the Monocle SDK version attribute and skip it if it doesn't. That way the blob span genearted by Azure library are not exported.
85
- if not span.attributes.get(MONOCLE_SDK_VERSION):
86
- continue # TODO: All exporters to use same base class and check it there
85
+ if self.skip_export(span):
86
+ continue
87
87
  self.export_queue.append(span)
88
88
  if len(self.export_queue) >= self.max_batch_size:
89
89
  await self.__export_spans()
@@ -1,20 +1,21 @@
1
- import time
1
+ import time, os
2
2
  import random
3
3
  import logging
4
4
  from abc import ABC, abstractmethod
5
5
  from opentelemetry.sdk.trace import ReadableSpan
6
- from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
6
+ from opentelemetry.sdk.trace.export import SpanExportResult
7
+ from monocle_apptrace.instrumentation.common.constants import MONOCLE_SDK_VERSION
7
8
  from typing import Sequence
8
- import asyncio
9
9
 
10
10
  logger = logging.getLogger(__name__)
11
11
 
12
12
  class SpanExporterBase(ABC):
13
- def __init__(self):
13
+ def __init__(self, export_monocle_only: bool = True):
14
14
  self.backoff_factor = 2
15
15
  self.max_retries = 10
16
16
  self.export_queue = []
17
17
  self.last_export_time = time.time()
18
+ self.export_monocle_only = export_monocle_only or os.environ.get("MONOCLE_EXPORTS_ONLY", True)
18
19
 
19
20
  @abstractmethod
20
21
  async def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
@@ -27,6 +28,11 @@ class SpanExporterBase(ABC):
27
28
  def shutdown(self) -> None:
28
29
  pass
29
30
 
31
+ def skip_export(self, span:ReadableSpan) -> bool:
32
+ if self.export_monocle_only and (not span.attributes.get(MONOCLE_SDK_VERSION)):
33
+ return True
34
+ return False
35
+
30
36
  @staticmethod
31
37
  def retry_with_backoff(retries=3, backoff_in_seconds=1, max_backoff_in_seconds=32, exceptions=(Exception,)):
32
38
  def decorator(func):
@@ -7,12 +7,13 @@ from typing import Optional, Callable, Sequence
7
7
  from opentelemetry.sdk.trace import ReadableSpan
8
8
  from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
9
9
  from opentelemetry.sdk.resources import SERVICE_NAME
10
+ from monocle_apptrace.exporters.base_exporter import SpanExporterBase
10
11
  from monocle_apptrace.exporters.exporter_processor import ExportTaskProcessor
11
12
 
12
13
  DEFAULT_FILE_PREFIX:str = "monocle_trace_"
13
14
  DEFAULT_TIME_FORMAT:str = "%Y-%m-%d_%H.%M.%S"
14
15
 
15
- class FileSpanExporter(SpanExporter):
16
+ class FileSpanExporter(SpanExporterBase):
16
17
  current_trace_id: int = None
17
18
  current_file_path: str = None
18
19
 
@@ -28,6 +29,7 @@ class FileSpanExporter(SpanExporter):
28
29
  + linesep,
29
30
  task_processor: Optional[ExportTaskProcessor] = None
30
31
  ):
32
+ super().__init__()
31
33
  self.out_handle:TextIOWrapper = None
32
34
  self.formatter = formatter
33
35
  self.service_name = service_name
@@ -39,21 +41,32 @@ class FileSpanExporter(SpanExporter):
39
41
  self.task_processor.start()
40
42
 
41
43
  def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
44
+ is_root_span = any(not span.parent for span in spans)
42
45
  if self.task_processor is not None and callable(getattr(self.task_processor, 'queue_task', None)):
43
46
  # Check if any span is a root span (no parent)
44
- is_root_span = any(not span.parent for span in spans)
45
47
  self.task_processor.queue_task(self._process_spans, spans, is_root_span)
46
48
  return SpanExportResult.SUCCESS
47
49
  else:
48
- return self._process_spans(spans)
50
+ return self._process_spans(spans, is_root_span=is_root_span)
49
51
 
50
52
  def _process_spans(self, spans: Sequence[ReadableSpan], is_root_span: bool = False) -> SpanExportResult:
53
+ first_span:bool = True
51
54
  for span in spans:
55
+ if self.skip_export(span):
56
+ continue
52
57
  if span.context.trace_id != self.current_trace_id:
53
58
  self.rotate_file(span.resource.attributes[SERVICE_NAME],
54
59
  span.context.trace_id)
60
+ first_span = True
61
+ if first_span:
62
+ first_span = False
63
+ else:
64
+ self.out_handle.write(",")
55
65
  self.out_handle.write(self.formatter(span))
56
- self.out_handle.flush()
66
+ if is_root_span:
67
+ self.reset_handle()
68
+ else:
69
+ self.out_handle.flush()
57
70
  return SpanExportResult.SUCCESS
58
71
 
59
72
  def rotate_file(self, trace_name:str, trace_id:int) -> None:
@@ -62,6 +75,7 @@ class FileSpanExporter(SpanExporter):
62
75
  self.file_prefix + trace_name + "_" + hex(trace_id) + "_"
63
76
  + datetime.now().strftime(self.time_format) + ".json")
64
77
  self.out_handle = open(self.current_file_path, "w", encoding='UTF-8')
78
+ self.out_handle.write("[")
65
79
  self.current_trace_id = trace_id
66
80
 
67
81
  def force_flush(self, timeout_millis: int = 30000) -> bool:
@@ -70,6 +84,7 @@ class FileSpanExporter(SpanExporter):
70
84
 
71
85
  def reset_handle(self) -> None:
72
86
  if self.out_handle is not None:
87
+ self.out_handle.write("]")
73
88
  self.out_handle.close()
74
89
  self.out_handle = None
75
90
 
@@ -1,6 +1,6 @@
1
1
  from typing import Dict, Any, List
2
2
  import os
3
- import logging
3
+ import logging, warnings
4
4
  from importlib import import_module
5
5
  from opentelemetry.sdk.trace.export import SpanExporter, ConsoleSpanExporter
6
6
  from monocle_apptrace.exporters.exporter_processor import LambdaExportTaskProcessor, is_aws_lambda_environment
@@ -34,7 +34,7 @@ def get_monocle_exporter(exporters_list:str=None) -> List[SpanExporter]:
34
34
  try:
35
35
  exporter_class_path = monocle_exporters[exporter_name]
36
36
  except KeyError:
37
- logger.debug(f"Unsupported Monocle span exporter '{exporter_name}', skipping.")
37
+ warnings.warn(f"Unsupported Monocle span exporter '{exporter_name}', skipping.")
38
38
  continue
39
39
  try:
40
40
  exporter_module = import_module(exporter_class_path["module"])
@@ -45,7 +45,7 @@ def get_monocle_exporter(exporters_list:str=None) -> List[SpanExporter]:
45
45
  else:
46
46
  exporters.append(exporter_class())
47
47
  except Exception as ex:
48
- logger.debug(
48
+ warnings.warn(
49
49
  f"Unable to initialize Monocle span exporter '{exporter_name}', error: {ex}. Using ConsoleSpanExporter as a fallback.")
50
50
  exporters.append(ConsoleSpanExporter())
51
51
  continue
@@ -6,7 +6,7 @@ import requests
6
6
  from opentelemetry.sdk.trace import ReadableSpan
7
7
  from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult, ConsoleSpanExporter
8
8
  from requests.exceptions import ReadTimeout
9
-
9
+ from monocle_apptrace.exporters.base_exporter import SpanExporterBase
10
10
  from monocle_apptrace.exporters.exporter_processor import ExportTaskProcessor
11
11
 
12
12
  REQUESTS_SUCCESS_STATUS_CODES = (200, 202)
@@ -15,7 +15,7 @@ OKAHU_PROD_INGEST_ENDPOINT = "https://ingest.okahu.co/api/v1/trace/ingest"
15
15
  logger = logging.getLogger(__name__)
16
16
 
17
17
 
18
- class OkahuSpanExporter(SpanExporter):
18
+ class OkahuSpanExporter(SpanExporterBase):
19
19
  def __init__(
20
20
  self,
21
21
  endpoint: Optional[str] = None,
@@ -24,6 +24,7 @@ class OkahuSpanExporter(SpanExporter):
24
24
  task_processor: ExportTaskProcessor = None
25
25
  ):
26
26
  """Okahu exporter."""
27
+ super().__init__()
27
28
  okahu_endpoint: str = os.environ.get("OKAHU_INGESTION_ENDPOINT", OKAHU_PROD_INGEST_ENDPOINT)
28
29
  self.endpoint = endpoint or okahu_endpoint
29
30
  api_key: str = os.environ.get("OKAHU_API_KEY")
@@ -58,6 +59,8 @@ class OkahuSpanExporter(SpanExporter):
58
59
 
59
60
  # append the batch object with all the spans object
60
61
  for span in spans:
62
+ if self.skip_export(span):
63
+ continue
61
64
  # create a object from serialized span
62
65
  obj = json.loads(span.to_json())
63
66
  if obj["parent_id"] is None:
@@ -14,10 +14,10 @@ GITHUB_CODESPACE_IDENTIFIER_ENV_NAME = "GITHUB_REPOSITORY"
14
14
  # Azure naming reference can be found here
15
15
  # https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-abbreviations
16
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.asp"
19
- AZURE_ML_SERVICE_NAME = "azure.mlw"
20
- AWS_LAMBDA_SERVICE_NAME = "aws.lambda"
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
21
  GITHUB_CODESPACE_SERVICE_NAME = "github_codespace"
22
22
 
23
23
  # Env variables to identify infra service type
@@ -51,7 +51,9 @@ llm_type_map = {
51
51
  "openaigenerator": "openai",
52
52
  "bedrockruntime":"aws_bedrock",
53
53
  "sagemakerruntime":"aws_sagemaker",
54
+ "anthropic": "anthropic",
54
55
  "chatanthropic":"anthropic",
56
+ "anthropicchatgenerator":"anthropic",
55
57
  }
56
58
 
57
59
  MONOCLE_INSTRUMENTOR = "monocle_apptrace"
@@ -74,4 +76,6 @@ WORKFLOW_TYPE_KEY = "monocle.workflow_type"
74
76
  ADD_NEW_WORKFLOW = "monocle.add_new_workflow"
75
77
  WORKFLOW_TYPE_GENERIC = "workflow.generic"
76
78
  MONOCLE_SDK_VERSION = "monocle_apptrace.version"
77
- MONOCLE_SDK_LANGUAGE = "monocle_apptrace.language"
79
+ MONOCLE_SDK_LANGUAGE = "monocle_apptrace.language"
80
+ MONOCLE_DETECTED_SPAN_ERROR = "monocle_apptrace.detected_span_error"
81
+ HTTP_SUCCESS_CODES = ('200', '201', '202', '204', '205', '206')
@@ -25,9 +25,9 @@ from monocle_apptrace.instrumentation.common.wrapper_method import (
25
25
  WrapperMethod,
26
26
  MONOCLE_SPAN_HANDLERS
27
27
  )
28
- from monocle_apptrace.instrumentation.common.wrapper import scope_wrapper, ascope_wrapper, wrapper_processor
28
+ from monocle_apptrace.instrumentation.common.wrapper import scope_wrapper, ascope_wrapper, monocle_wrapper, amonocle_wrapper
29
29
  from monocle_apptrace.instrumentation.common.utils import (
30
- set_scope, remove_scope, http_route_handler, load_scopes, async_wrapper, http_async_route_handler
30
+ set_scope, remove_scope, http_route_handler, load_scopes, http_async_route_handler
31
31
  )
32
32
  from monocle_apptrace.instrumentation.common.constants import MONOCLE_INSTRUMENTOR, WORKFLOW_TYPE_GENERIC
33
33
  from functools import wraps
@@ -68,13 +68,20 @@ class MonocleInstrumentor(BaseInstrumentor):
68
68
 
69
69
  def get_instrumentor(self, tracer):
70
70
  def instrumented_endpoint_invoke(to_wrap,wrapped, span_name, instance,fn):
71
- @wraps(fn)
72
- def with_instrumentation(*args, **kwargs):
73
- async_task = inspect.iscoroutinefunction(fn)
74
- boto_method_to_wrap = to_wrap.copy()
75
- boto_method_to_wrap['skip_span'] = False
76
- return wrapper_processor(async_task, tracer, NonFrameworkSpanHandler(),
77
- boto_method_to_wrap, fn, instance, args, kwargs)
71
+ if inspect.iscoroutinefunction(fn):
72
+ @wraps(fn)
73
+ async def with_instrumentation(*args, **kwargs):
74
+ boto_method_to_wrap = to_wrap.copy()
75
+ boto_method_to_wrap['skip_span'] = False
76
+ return await amonocle_wrapper(tracer, NonFrameworkSpanHandler(),
77
+ boto_method_to_wrap, fn, instance, "", args, kwargs)
78
+ else:
79
+ @wraps(fn)
80
+ def with_instrumentation(*args, **kwargs):
81
+ boto_method_to_wrap = to_wrap.copy()
82
+ boto_method_to_wrap['skip_span'] = False
83
+ return monocle_wrapper(tracer, NonFrameworkSpanHandler(),
84
+ boto_method_to_wrap, fn, instance, "", args, kwargs)
78
85
  return with_instrumentation
79
86
  return instrumented_endpoint_invoke
80
87
 
@@ -241,8 +248,8 @@ def start_trace():
241
248
  SpanHandler.set_workflow_properties(span)
242
249
  token = attach(updated_span_context)
243
250
  return token
244
- except:
245
- logger.warning("Failed to start trace")
251
+ except Exception as e:
252
+ logger.warning("Failed to start trace {e}")
246
253
  return None
247
254
 
248
255
  def stop_trace(token) -> None:
@@ -328,8 +335,12 @@ def monocle_trace_scope_method(scope_name: str, scope_value:str=None):
328
335
  if inspect.iscoroutinefunction(func):
329
336
  @wraps(func)
330
337
  async def wrapper(*args, **kwargs):
331
- result = async_wrapper(func, scope_name, scope_value, None, *args, **kwargs)
332
- return result
338
+ token = start_scope(scope_name, scope_value)
339
+ try:
340
+ result = await func(*args, **kwargs)
341
+ return result
342
+ finally:
343
+ stop_scope(token)
333
344
  return wrapper
334
345
  else:
335
346
  @wraps(func)