mvk-sdk-py 0.0.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.
Files changed (158) hide show
  1. mvk_sdk_py-0.0.1/CHANGELOG.md +344 -0
  2. mvk_sdk_py-0.0.1/LICENSE +202 -0
  3. mvk_sdk_py-0.0.1/MANIFEST.in +14 -0
  4. mvk_sdk_py-0.0.1/NOTICE +12 -0
  5. mvk_sdk_py-0.0.1/PKG-INFO +1798 -0
  6. mvk_sdk_py-0.0.1/README.md +1689 -0
  7. mvk_sdk_py-0.0.1/pyproject.toml +234 -0
  8. mvk_sdk_py-0.0.1/requirements-dev.txt +36 -0
  9. mvk_sdk_py-0.0.1/requirements-minimal.txt +21 -0
  10. mvk_sdk_py-0.0.1/requirements-optional.txt +84 -0
  11. mvk_sdk_py-0.0.1/requirements.txt +12 -0
  12. mvk_sdk_py-0.0.1/setup.cfg +4 -0
  13. mvk_sdk_py-0.0.1/src/mvk_sdk/__init__.py +298 -0
  14. mvk_sdk_py-0.0.1/src/mvk_sdk/circuit_breaker.py +233 -0
  15. mvk_sdk_py-0.0.1/src/mvk_sdk/cli/__init__.py +10 -0
  16. mvk_sdk_py-0.0.1/src/mvk_sdk/cli/instrument.py +271 -0
  17. mvk_sdk_py-0.0.1/src/mvk_sdk/cli/site.py +298 -0
  18. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/__init__.py +137 -0
  19. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/aws_collector.py +1570 -0
  20. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/azure_collector.py +835 -0
  21. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/base_collector.py +299 -0
  22. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/builder.py +102 -0
  23. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/collector.py +679 -0
  24. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/detector.py +190 -0
  25. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/environment.py +203 -0
  26. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/gcp_collector.py +614 -0
  27. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/k8s_metadata.py +897 -0
  28. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/oci_collector.py +488 -0
  29. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/onprem_collector.py +611 -0
  30. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/schema.py +257 -0
  31. mvk_sdk_py-0.0.1/src/mvk_sdk/cloud_metadata/types.py +95 -0
  32. mvk_sdk_py-0.0.1/src/mvk_sdk/config.py +94 -0
  33. mvk_sdk_py-0.0.1/src/mvk_sdk/config_registry/__init__.py +76 -0
  34. mvk_sdk_py-0.0.1/src/mvk_sdk/config_registry/config_model.py +802 -0
  35. mvk_sdk_py-0.0.1/src/mvk_sdk/config_registry/registry.py +780 -0
  36. mvk_sdk_py-0.0.1/src/mvk_sdk/config_schema.py +327 -0
  37. mvk_sdk_py-0.0.1/src/mvk_sdk/context.py +898 -0
  38. mvk_sdk_py-0.0.1/src/mvk_sdk/decorators.py +902 -0
  39. mvk_sdk_py-0.0.1/src/mvk_sdk/deployment_modes.py +402 -0
  40. mvk_sdk_py-0.0.1/src/mvk_sdk/error_handling.py +898 -0
  41. mvk_sdk_py-0.0.1/src/mvk_sdk/exporters/__init__.py +32 -0
  42. mvk_sdk_py-0.0.1/src/mvk_sdk/exporters/base.py +64 -0
  43. mvk_sdk_py-0.0.1/src/mvk_sdk/exporters/console.py +249 -0
  44. mvk_sdk_py-0.0.1/src/mvk_sdk/exporters/file.py +289 -0
  45. mvk_sdk_py-0.0.1/src/mvk_sdk/exporters/otlp_grpc.py +800 -0
  46. mvk_sdk_py-0.0.1/src/mvk_sdk/exporters/otlp_http.py +729 -0
  47. mvk_sdk_py-0.0.1/src/mvk_sdk/exporters/otlp_utils.py +190 -0
  48. mvk_sdk_py-0.0.1/src/mvk_sdk/exporters/retrying.py +221 -0
  49. mvk_sdk_py-0.0.1/src/mvk_sdk/http_suppression.py +800 -0
  50. mvk_sdk_py-0.0.1/src/mvk_sdk/import_hooks.py +205 -0
  51. mvk_sdk_py-0.0.1/src/mvk_sdk/instrument.py +1851 -0
  52. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/__init__.py +58 -0
  53. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/agentcore_instrumentor.py +1384 -0
  54. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/anthropic_instrumentor.py +3373 -0
  55. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/anthropic_tools.py +774 -0
  56. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/anthropic_vertex_instrumentor.py +732 -0
  57. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/azure_ai_openai_instrumentor.py +867 -0
  58. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/azure_openai_instrumentor.py +102 -0
  59. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/base.py +885 -0
  60. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/base_gemini_instrumentor.py +833 -0
  61. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch/__init__.py +55 -0
  62. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch/agno_batch_instrumentor.py +110 -0
  63. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch/anthropic_batch_instrumentor.py +1720 -0
  64. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch/azure_openai_batch_instrumentor.py +241 -0
  65. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch/base.py +429 -0
  66. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch/bedrock_batch_instrumentor.py +254 -0
  67. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch/crewai_batch_instrumentor.py +131 -0
  68. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch/gemini_batch_instrumentor.py +245 -0
  69. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch/langchain_batch_instrumentor.py +482 -0
  70. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch/openai_batch_instrumentor.py +2679 -0
  71. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch/semantic_kernel_batch_instrumentor.py +120 -0
  72. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch/threadpool_batch_instrumentor.py +197 -0
  73. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch/vertexai_batch_instrumentor.py +264 -0
  74. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/batch_utils.py +626 -0
  75. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/bedrock_instrumentor.py +2504 -0
  76. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/chromadb_instrumentor.py +655 -0
  77. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/common.py +629 -0
  78. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/content_hasher.py +154 -0
  79. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/detection.py +733 -0
  80. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/error_boundary.py +192 -0
  81. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/framework/__init__.py +76 -0
  82. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/framework/agent_framework_instrumentor.py +3082 -0
  83. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/framework/agno_instrumentor.py +1377 -0
  84. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/framework/crewai_instrumentor.py +674 -0
  85. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/framework/graph_context.py +124 -0
  86. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/framework/langchain_callback_handler.py +2442 -0
  87. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/framework/langgraph_instrumentor.py +427 -0
  88. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/framework/openai_agents_instrumentor.py +292 -0
  89. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/framework/semantic_kernel_instrumentor.py +827 -0
  90. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/framework/types.py +245 -0
  91. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/gemini_instrumentor.py +366 -0
  92. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/generativelanguage_instrumentor.py +690 -0
  93. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/google_genai_instrumentor.py +3092 -0
  94. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/grpc_selective_interceptor.py +1454 -0
  95. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/httpx_exclusions.py +116 -0
  96. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/httpx_instrumentor.py +286 -0
  97. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/litellm_instrumentor.py +5341 -0
  98. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/litellm_normalization.py +748 -0
  99. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/llm_envelope.py +199 -0
  100. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/model_detection.py +599 -0
  101. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/model_name_utils.py +98 -0
  102. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/oci_genai_instrumentor.py +2324 -0
  103. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/openai_instrumentor.py +4920 -0
  104. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/perplexity_common.py +236 -0
  105. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/perplexity_instrumentor.py +875 -0
  106. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/perplexity_rest_floor.py +597 -0
  107. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/perplexity_tools.py +278 -0
  108. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/pinecone_instrumentor.py +1765 -0
  109. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/prompt_response_collector.py +948 -0
  110. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/qdrant_instrumentor.py +248 -0
  111. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/rest_selective_transport.py +221 -0
  112. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/routers/__init__.py +25 -0
  113. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/routers/litellm_router_instrumentor.py +1516 -0
  114. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/routers/openrouter_instrumentor.py +2085 -0
  115. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/step_counter.py +58 -0
  116. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/streaming_iterators.py +471 -0
  117. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/streaming_wrapper.py +1925 -0
  118. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/vertexai_instrumentor.py +1540 -0
  119. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/weaviate_instrumentor.py +1746 -0
  120. mvk_sdk_py-0.0.1/src/mvk_sdk/instrumentation/wrapper_base.py +4930 -0
  121. mvk_sdk_py-0.0.1/src/mvk_sdk/json_utils.py +64 -0
  122. mvk_sdk_py-0.0.1/src/mvk_sdk/logging_config.py +186 -0
  123. mvk_sdk_py-0.0.1/src/mvk_sdk/logging_utils.py +249 -0
  124. mvk_sdk_py-0.0.1/src/mvk_sdk/metered_usage.py +1055 -0
  125. mvk_sdk_py-0.0.1/src/mvk_sdk/metrics.py +317 -0
  126. mvk_sdk_py-0.0.1/src/mvk_sdk/middleware/__init__.py +110 -0
  127. mvk_sdk_py-0.0.1/src/mvk_sdk/middleware/asgi.py +331 -0
  128. mvk_sdk_py-0.0.1/src/mvk_sdk/middleware/django.py +256 -0
  129. mvk_sdk_py-0.0.1/src/mvk_sdk/middleware/headers.py +833 -0
  130. mvk_sdk_py-0.0.1/src/mvk_sdk/middleware/request_context.py +442 -0
  131. mvk_sdk_py-0.0.1/src/mvk_sdk/middleware/wsgi.py +470 -0
  132. mvk_sdk_py-0.0.1/src/mvk_sdk/mvk_signal.py +209 -0
  133. mvk_sdk_py-0.0.1/src/mvk_sdk/mvk_tracer.py +1393 -0
  134. mvk_sdk_py-0.0.1/src/mvk_sdk/processors/__init__.py +11 -0
  135. mvk_sdk_py-0.0.1/src/mvk_sdk/processors/base.py +56 -0
  136. mvk_sdk_py-0.0.1/src/mvk_sdk/processors/factory.py +591 -0
  137. mvk_sdk_py-0.0.1/src/mvk_sdk/processors/failed_batch_disk.py +239 -0
  138. mvk_sdk_py-0.0.1/src/mvk_sdk/processors/writer.py +1141 -0
  139. mvk_sdk_py-0.0.1/src/mvk_sdk/propagator.py +134 -0
  140. mvk_sdk_py-0.0.1/src/mvk_sdk/py.typed +0 -0
  141. mvk_sdk_py-0.0.1/src/mvk_sdk/schema.py +1747 -0
  142. mvk_sdk_py-0.0.1/src/mvk_sdk/serverless/__init__.py +660 -0
  143. mvk_sdk_py-0.0.1/src/mvk_sdk/serverless/detection.py +265 -0
  144. mvk_sdk_py-0.0.1/src/mvk_sdk/shutdown.py +776 -0
  145. mvk_sdk_py-0.0.1/src/mvk_sdk/site_install.py +637 -0
  146. mvk_sdk_py-0.0.1/src/mvk_sdk/sitecustomize.py +743 -0
  147. mvk_sdk_py-0.0.1/src/mvk_sdk/span_builder.py +649 -0
  148. mvk_sdk_py-0.0.1/src/mvk_sdk/system_alerts/__init__.py +74 -0
  149. mvk_sdk_py-0.0.1/src/mvk_sdk/system_alerts/builder.py +602 -0
  150. mvk_sdk_py-0.0.1/src/mvk_sdk/system_alerts/collector.py +501 -0
  151. mvk_sdk_py-0.0.1/src/mvk_sdk/system_alerts/types.py +207 -0
  152. mvk_sdk_py-0.0.1/src/mvk_sdk/wrapper_logging.py +371 -0
  153. mvk_sdk_py-0.0.1/src/mvk_sdk_py.egg-info/PKG-INFO +1798 -0
  154. mvk_sdk_py-0.0.1/src/mvk_sdk_py.egg-info/SOURCES.txt +156 -0
  155. mvk_sdk_py-0.0.1/src/mvk_sdk_py.egg-info/dependency_links.txt +1 -0
  156. mvk_sdk_py-0.0.1/src/mvk_sdk_py.egg-info/entry_points.txt +3 -0
  157. mvk_sdk_py-0.0.1/src/mvk_sdk_py.egg-info/requires.txt +101 -0
  158. mvk_sdk_py-0.0.1/src/mvk_sdk_py.egg-info/top_level.txt +1 -0
@@ -0,0 +1,344 @@
1
+ # Changelog
2
+
3
+ All notable changes to the MVK Micro SDK will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.3.7] - 2026-04
9
+
10
+ - Run ID implementation (DX-6912)(https://digitalexio.atlassian.net/browse/DX-6912)
11
+
12
+ ## [1.3.6] - 2026-03
13
+
14
+ ### Added
15
+ - **Microsoft Agent Framework Support**: Full instrumentation for Microsoft Agent Framework ([DX-6383](https://digitalexio.atlassian.net/browse/DX-6383))
16
+ - **AWS AgentCore Support**: Full instrumentation for AWS AgentCore Runtime Support ([DX-6636](https://digitalexio.atlassian.net/browse/DX-6636))
17
+
18
+ ### Changed
19
+ - Schema field `call_type` value changed from "streaming" to "stream" for consistency ([DX-6383])
20
+
21
+
22
+ ## [1.3.5] - 2026-02
23
+
24
+ ### Added
25
+ - W3C TraceContext support with `traceparent`/`tracestate` header parsing ([DX-6232])
26
+ - Zero-code auto-instrumentation via `sitecustomize.py` ([DX-6232])
27
+ - Framework auto-detection for FastAPI, Flask, Django, Starlette ([DX-6234])
28
+ - Signal API: `create_signal()`, `@mvk.signal` decorator ([DX-6232])
29
+ - Configurable tag prefixes via `MVK_TAG_PREFIXES` ([DX-6232])
30
+ - Automatic credential redaction in headers ([DX-6232])
31
+
32
+ ### Fixed
33
+ - Race condition in `get_batch_context()` - TOCTOU issue ([DX-6232])
34
+ - Log noise in Django middleware cleanup handler ([DX-6232])
35
+
36
+ ## [1.3.0] - 2025-12-18
37
+
38
+ ### Added
39
+ - OpenRouter support ([DX-6280])
40
+ - LiteLLM Proxy support ([DX-6281])
41
+
42
+ <!-- JIRA Links -->
43
+ [DX-6232]: https://digitalexio.atlassian.net/browse/DX-6232
44
+ [DX-6234]: https://digitalexio.atlassian.net/browse/DX-6234
45
+ [DX-6280]: https://digitalexio.atlassian.net/browse/DX-6280
46
+ [DX-6281]: https://digitalexio.atlassian.net/browse/DX-6281
47
+
48
+ ## [1.2.2] - 2025-12-XX
49
+
50
+ - Native [Anthropic Client](https://github.com/anthropics/anthropic-sdk-python) Support.
51
+ - LangChain + Anthropic + Batch Support.
52
+ - LangChain + Gemini + Batch Support.
53
+ - LangChain + OpenAI + Batch Support.
54
+ - LangChain + Bedrock + Batch Support.
55
+ - LangChain + VertexAI + Batch Support.
56
+ - LangChain + Azure OpenAI + Batch Support.
57
+ - Pure OpenAI Batch support.
58
+
59
+ ## [1.2.1] - 2024-12-XX
60
+
61
+ ### Added
62
+
63
+ - **Streaming Response Support**: Full token capture and metrics for streaming responses across all LLM providers
64
+ - **OpenAI**
65
+ - **Anthropic**
66
+ - **AWS Bedrock**
67
+ - **Google Vertex AI**
68
+ - **Azure OpenAI**
69
+ - **Google Gemini**
70
+
71
+ ### Trace Span Attributes
72
+
73
+ Streaming spans now include:
74
+ - `mvk.prompt_tokens`: Number of tokens in the prompt
75
+ - `mvk.completion_tokens`: Number of tokens in the completion
76
+ - `mvk.total_tokens`: Total tokens (prompt + completion)
77
+ - `mvk.stream_enabled`: Boolean indicating streaming was enabled
78
+ - `mvk.operation_subtype`: Set to "stream" for streaming operations
79
+
80
+ ## [1.1.0] - 2024-12-XX
81
+
82
+ ### Breaking Changes
83
+
84
+ - None (backward compatible with v1.0)
85
+
86
+ ### Added
87
+
88
+ #### Configuration & Deployment
89
+
90
+ - **MVK-only Configuration**: Removed all OTEL\_\* environment variables for simplicity
91
+ - **DIRECT vs COLLECTOR Modes**: Clear separation of deployment topologies
92
+ - `MVK_MODE=DIRECT`: Agent exports directly to MVK backend
93
+ - `MVK_MODE=COLLECTOR`: Agent exports to your OTEL Collector
94
+ - **Collector Configuration**: New `MVK_COLLECTOR_*` environment variables for OTEL collector setup
95
+ - **Operations-Friendly**: Environment variables now override function parameters
96
+
97
+ #### Serverless Support
98
+
99
+ - **Auto-Detection**: Automatic detection of serverless environments
100
+ - AWS Lambda (`AWS_LAMBDA_FUNCTION_NAME`)
101
+ - Google Cloud Functions (`K_SERVICE`, `FUNCTION_NAME`)
102
+ - Azure Functions (`FUNCTIONS_WORKER_RUNTIME`)
103
+ - Vercel (`VERCEL`)
104
+ - **Optimized Configuration**: Automatic serverless optimizations
105
+ - Batch size: 1 (immediate export)
106
+ - Flush interval: 100ms (vs 3000ms normal)
107
+ - Reduced retries and timeouts
108
+ - **Lambda Handler**: New `@lambda_handler` decorator for automatic flush
109
+ - **Force Serverless**: `MVK_SERVERLESS=true` to force serverless mode
110
+
111
+ #### Error Handling & Resilience
112
+
113
+ - **Non-Breaking Guarantee**: SDK will NEVER break client code under any circumstances
114
+ - **OTEL-Compliant Patterns**: All exceptions use `except Exception: # pylint: disable=broad-except`
115
+ - **Comprehensive Error Matrix**: Clear behavior for vendor vs SDK errors
116
+ - **Safe Cleanup**: All cleanup code in finally blocks with error suppression
117
+
118
+ #### HTTP Instrumentation Protection
119
+
120
+ - **Suppression Guard**: Prevents double instrumentation of HTTP calls
121
+ - **Default Exclusions**: Built-in exclusions for AI provider endpoints
122
+ - **Custom Exclusions**: `MVK_HTTP_EXCLUSIONS` for additional exclusions
123
+ - **Opt-in HTTP**: HTTP wrappers disabled by default
124
+
125
+ #### Platform Safety
126
+
127
+ - **Signal Handling**: Graceful shutdown on SIGTERM/SIGINT
128
+ - **Fork Safety**: Support for Gunicorn, uWSGI, and prefork servers
129
+ - **Thread Safety**: Proper locking for all shared state
130
+ - **Container Support**: Kubernetes-compatible graceful shutdown
131
+
132
+ ### Changed
133
+
134
+ #### Package Distribution
135
+
136
+ - **Package Name**: Changed from `mvk-sdk-micro` to `mvk-sdk-py`
137
+ - **Import**: Remains `import mvk_sdk as mvk` (unchanged)
138
+
139
+ #### Configuration Priority
140
+
141
+ - Environment variables now have highest priority (override function parameters)
142
+ - Removed `MVK_EXPORTER_MODE` in favor of `MVK_MODE`
143
+ - Simplified configuration with clear mode selection
144
+
145
+ #### Error Handling
146
+
147
+ - All bare `except:` replaced with `except Exception: # pylint: disable=broad-except`
148
+ - Vendor exceptions propagate normally (never swallowed)
149
+ - SDK internal errors logged but never propagated
150
+ - Enhanced retry logic with proper jitter
151
+
152
+ ### Deprecated
153
+
154
+ - All `OTEL_*` environment variables (use `MVK_*` equivalents)
155
+ - `MVK_EXPORTER_MODE` (replaced by `MVK_MODE`)
156
+ - Mixed OTEL/MVK configuration (use MVK-only)
157
+
158
+ ### Fixed
159
+
160
+ - HTTPError handling in exporters now properly handles mock objects
161
+ - Test import paths corrected for proper module access
162
+ - Signal handler registration issues resolved
163
+ - Memory pressure detection improved
164
+
165
+ ### Documentation
166
+
167
+ - Added comprehensive troubleshooting section
168
+ - Enhanced serverless deployment guide
169
+ - Clear DIRECT vs COLLECTOR mode documentation
170
+ - Error behavior matrix for all error scenarios
171
+ - Platform-specific deployment guides
172
+
173
+ ### Security
174
+
175
+ - API keys never logged (enhanced protection)
176
+ - Query strings excluded from HTTP spans
177
+ - Authorization headers redacted in logs
178
+ - PII policy enforcement strengthened
179
+
180
+ ### Performance
181
+
182
+ - Serverless cold start optimizations
183
+ - Reduced memory footprint in serverless mode
184
+ - Improved batching efficiency
185
+ - Enhanced export retry logic
186
+
187
+ ## [1.0.0] - 2024-11-XX
188
+
189
+ ### Initial Release
190
+
191
+ #### Core Features
192
+
193
+ - **OTLP Compliance**: Full OpenTelemetry compatibility
194
+ - **Auto-instrumentation**: Support for 6 GenAI providers and 4 Vector DBs
195
+ - **W3C TraceContext**: Standard distributed tracing
196
+ - **Metered Usage**: Automatic token tracking
197
+ - **Pure Python**: Minimal dependencies
198
+
199
+ #### Supported Providers
200
+
201
+ - **GenAI**: OpenAI, Anthropic, Gemini, AWS Bedrock, Azure OpenAI, Vertex AI
202
+ - **Vector DBs**: Pinecone, Weaviate, ChromaDB, Qdrant
203
+ - **HTTP**: Requests, HTTPX (opt-in)
204
+
205
+ #### Exporters
206
+
207
+ - OTLP/HTTP with JSON/Protobuf
208
+ - OTLP/gRPC with Protobuf
209
+ - Console (human-readable/JSON)
210
+ - File (OTLP JSON lines)
211
+
212
+ #### Configuration
213
+
214
+ - Environment variables with MVK*\* and OTEL*\* prefixes
215
+ - Function parameters
216
+ - Mixed configuration support
217
+ - Tenant identity support
218
+
219
+ #### Processing
220
+
221
+ - Memory queue (10MB/10k spans)
222
+ - Single writer thread model
223
+ - Exponential backoff with jitter
224
+
225
+ #### Platform Support
226
+
227
+ - Linux x86_64/ARM64 (Python 3.9-3.12)
228
+ - macOS x86_64/ARM64 (Python 3.10-3.12)
229
+ - Windows x64 (Python 3.10-3.12)
230
+ - PyPy (best-effort)
231
+
232
+ ---
233
+
234
+ ## Migration Guide
235
+
236
+ ### Migrating from 1.0 to 1.1
237
+
238
+ #### Configuration Changes
239
+
240
+ **Before (v1.0):**
241
+
242
+ ```bash
243
+ # Mixed OTEL and MVK variables
244
+ export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=collector:4317
245
+ export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc
246
+ export MVK_AGENT_ID=my-agent
247
+ export MVK_TENANT_ID=tenant-123
248
+ ```
249
+
250
+ **After (v1.1):**
251
+
252
+ ```bash
253
+ # MVK-only configuration
254
+ export MVK_MODE=COLLECTOR
255
+ export MVK_COLLECTOR_ENDPOINT=collector:4317
256
+ export MVK_COLLECTOR_PROTOCOL=grpc
257
+ export MVK_AGENT_ID=my-agent
258
+ export MVK_TENANT_ID=tenant-123
259
+ ```
260
+
261
+ #### Package Installation
262
+
263
+ **Before (v1.0):**
264
+
265
+ ```bash
266
+ pip install mvk-sdk-micro
267
+ ```
268
+
269
+ **After (v1.1):**
270
+
271
+ ```bash
272
+ pip install mvk-sdk-py
273
+ ```
274
+
275
+ #### Serverless Deployment
276
+
277
+ **Before (v1.0):**
278
+
279
+ ```python
280
+ # Manual configuration for Lambda
281
+ mvk.instrument(
282
+ agent_id="lambda-func",
283
+ config={
284
+ "batching": {"max_items": 1, "max_interval_ms": 100},
285
+ "exporter": {"timeout": 3}
286
+ }
287
+ )
288
+
289
+ # Manual flush in handler
290
+ def handler(event, context):
291
+ result = process(event)
292
+ mvk.force_flush(timeout_ms=1000)
293
+ return result
294
+ ```
295
+
296
+ **After (v1.1):**
297
+
298
+ ```python
299
+ # Automatic serverless detection and configuration
300
+ from mvk_sdk.serverless import lambda_handler
301
+
302
+ @lambda_handler() # Automatic flush and optimization
303
+ def handler(event, context):
304
+ return process(event)
305
+ ```
306
+
307
+ #### Error Handling
308
+
309
+ **Before (v1.0):**
310
+
311
+ ```python
312
+ try:
313
+ # SDK operation
314
+ pass
315
+ except: # Could catch SystemExit
316
+ pass
317
+ ```
318
+
319
+ **After (v1.1):**
320
+
321
+ ```python
322
+ try:
323
+ # SDK operation
324
+ pass
325
+ except Exception: # pylint: disable=broad-except
326
+ logger.exception("SDK operation failed")
327
+ # SDK continues without breaking client code
328
+ ```
329
+
330
+ ### Deprecated Features
331
+
332
+ The following will be removed in v2.0:
333
+
334
+ - All `OTEL_*` environment variable support
335
+ - `MVK_EXPORTER_MODE` (use `MVK_MODE`)
336
+ - Mixed OTEL/MVK configuration patterns
337
+
338
+ ### Support
339
+
340
+ For questions or issues with migration:
341
+
342
+ - GitHub Issues: https://github.com/mavvrik/mvk-sdk
343
+ - Documentation: https://docs.mavvrik.ai/sdk
344
+ - Email: support@mavvrik.ai
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,14 @@
1
+ include LICENSE
2
+ include NOTICE
3
+ include README.md
4
+ include CHANGELOG.md
5
+ include requirements*.txt
6
+ include src/mvk_sdk/py.typed
7
+
8
+ recursive-exclude tests *
9
+ recursive-exclude examples *
10
+ recursive-exclude analysis *
11
+ recursive-exclude docs *
12
+ global-exclude *.pyc
13
+ global-exclude __pycache__
14
+ global-exclude .DS_Store
@@ -0,0 +1,12 @@
1
+ MVK SDK for Python (mvk-sdk-py)
2
+ Copyright (c) 2024-2026 Mavvrik AI
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this software except in compliance with the License.
6
+ You may obtain a copy of the License in the accompanying LICENSE file or at:
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.