genai-otel-instrument 0.1.27__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.
- genai_otel_instrument-0.1.27/.claude/settings.local.json +9 -0
- genai_otel_instrument-0.1.27/.github/RELEASE_GUIDE.md +179 -0
- genai_otel_instrument-0.1.27/.github/RELEASE_QUICKSTART.md +112 -0
- genai_otel_instrument-0.1.27/.github/images/Landing_Page.jpg +0 -0
- genai_otel_instrument-0.1.27/.github/images/Logo.jpg +0 -0
- genai_otel_instrument-0.1.27/.github/images/Screenshots/GENAI_OpenSearch_output.png +0 -0
- genai_otel_instrument-0.1.27/.github/images/Screenshots/GPU_Metrics.png +0 -0
- genai_otel_instrument-0.1.27/.github/images/Screenshots/Trace_HuggingFace_Transformer_Models.png +0 -0
- genai_otel_instrument-0.1.27/.github/images/Screenshots/Traces_Ollama.png +0 -0
- genai_otel_instrument-0.1.27/.github/images/Screenshots/Traces_OpenAI.png +0 -0
- genai_otel_instrument-0.1.27/.github/images/Screenshots/Traces_SmolAgent_Token_Cost_breakdown.png +0 -0
- genai_otel_instrument-0.1.27/.github/images/Screenshots/Traces_SmolAgent_with_tool_calls.png +0 -0
- genai_otel_instrument-0.1.27/.github/workflows/README.md +203 -0
- genai_otel_instrument-0.1.27/.github/workflows/pre-release-check.yml +128 -0
- genai_otel_instrument-0.1.27/.github/workflows/publish.yml +109 -0
- genai_otel_instrument-0.1.27/.github/workflows/test.yml +135 -0
- genai_otel_instrument-0.1.27/.gitignore +366 -0
- genai_otel_instrument-0.1.27/.idea/.gitignore +3 -0
- genai_otel_instrument-0.1.27/.idea/genai_otel_instrument.iml +8 -0
- genai_otel_instrument-0.1.27/.idea/inspectionProfiles/Project_Default.xml +61 -0
- genai_otel_instrument-0.1.27/.idea/inspectionProfiles/profiles_settings.xml +6 -0
- genai_otel_instrument-0.1.27/.idea/misc.xml +4 -0
- genai_otel_instrument-0.1.27/.idea/modules.xml +8 -0
- genai_otel_instrument-0.1.27/.idea/vcs.xml +6 -0
- genai_otel_instrument-0.1.27/.pre-commit-config.yaml +79 -0
- genai_otel_instrument-0.1.27/.pylintrc +44 -0
- genai_otel_instrument-0.1.27/CHANGELOG.md +1528 -0
- genai_otel_instrument-0.1.27/Contributing.md +195 -0
- genai_otel_instrument-0.1.27/DESIGN_V0.2.0.md +1140 -0
- genai_otel_instrument-0.1.27/DEVELOPMENT.md +160 -0
- genai_otel_instrument-0.1.27/FRAMEWORK_RESEARCH.md +1247 -0
- genai_otel_instrument-0.1.27/LICENSE +680 -0
- genai_otel_instrument-0.1.27/MANIFEST.in +11 -0
- genai_otel_instrument-0.1.27/PKG-INFO +1571 -0
- genai_otel_instrument-0.1.27/README.md +1340 -0
- genai_otel_instrument-0.1.27/TROUBLESHOOTING.md +365 -0
- genai_otel_instrument-0.1.27/after_changes_tests.txt +416 -0
- genai_otel_instrument-0.1.27/baseline_tests.txt +95 -0
- genai_otel_instrument-0.1.27/check_prometheus_metrics.py +73 -0
- genai_otel_instrument-0.1.27/docs/SERVER_METRICS.md +477 -0
- genai_otel_instrument-0.1.27/example_usage.py +218 -0
- genai_otel_instrument-0.1.27/examples/README.md +304 -0
- genai_otel_instrument-0.1.27/examples/anthropic/.env.example +15 -0
- genai_otel_instrument-0.1.27/examples/anthropic/README.md +41 -0
- genai_otel_instrument-0.1.27/examples/anthropic/example.py +25 -0
- genai_otel_instrument-0.1.27/examples/autogen_example.py +373 -0
- genai_otel_instrument-0.1.27/examples/aws_bedrock/.env.example +17 -0
- genai_otel_instrument-0.1.27/examples/aws_bedrock/README.md +41 -0
- genai_otel_instrument-0.1.27/examples/aws_bedrock/example.py +37 -0
- genai_otel_instrument-0.1.27/examples/azure_openai/.env.example +16 -0
- genai_otel_instrument-0.1.27/examples/azure_openai/README.md +41 -0
- genai_otel_instrument-0.1.27/examples/azure_openai/example.py +29 -0
- genai_otel_instrument-0.1.27/examples/bedrock_agents_example.py +423 -0
- genai_otel_instrument-0.1.27/examples/bias_detection/README.md +105 -0
- genai_otel_instrument-0.1.27/examples/bias_detection/placeholder.py +43 -0
- genai_otel_instrument-0.1.27/examples/bias_detection_example.py +478 -0
- genai_otel_instrument-0.1.27/examples/cohere/.env.example +6 -0
- genai_otel_instrument-0.1.27/examples/cohere/README.md +13 -0
- genai_otel_instrument-0.1.27/examples/cohere/example.py +21 -0
- genai_otel_instrument-0.1.27/examples/comprehensive_evaluation_example.py +425 -0
- genai_otel_instrument-0.1.27/examples/crewai_example.py +265 -0
- genai_otel_instrument-0.1.27/examples/demo/.env.example +6 -0
- genai_otel_instrument-0.1.27/examples/demo/Dockerfile +28 -0
- genai_otel_instrument-0.1.27/examples/demo/OPENSEARCH_SETUP.md +397 -0
- genai_otel_instrument-0.1.27/examples/demo/README.md +209 -0
- genai_otel_instrument-0.1.27/examples/demo/app.py +101 -0
- genai_otel_instrument-0.1.27/examples/demo/docker-compose.yml +172 -0
- genai_otel_instrument-0.1.27/examples/demo/grafana/dashboards/GenAI OTel Demo Metrics-1761310525837.json +594 -0
- genai_otel_instrument-0.1.27/examples/demo/grafana/dashboards/GenAI OTel Demo Traces-1761321575526.json +135 -0
- genai_otel_instrument-0.1.27/examples/demo/grafana/dashboards/GenAI Traces - OpenSearch-1761319701624.json +879 -0
- genai_otel_instrument-0.1.27/examples/demo/grafana/dashboards/genai-metrics-dashboard.json +1044 -0
- genai_otel_instrument-0.1.27/examples/demo/grafana/dashboards/genai-opensearch-traces-dashboard.json +905 -0
- genai_otel_instrument-0.1.27/examples/demo/grafana/dashboards/genai-traces-dashboard.json +126 -0
- genai_otel_instrument-0.1.27/examples/demo/grafana/provisioning/dashboards/dashboards.yml +12 -0
- genai_otel_instrument-0.1.27/examples/demo/grafana/provisioning/datasources/jaeger.yml +9 -0
- genai_otel_instrument-0.1.27/examples/demo/grafana/provisioning/datasources/opensearch.yml +19 -0
- genai_otel_instrument-0.1.27/examples/demo/grafana/provisioning/datasources/prometheus.yml +9 -0
- genai_otel_instrument-0.1.27/examples/demo/opensearch-setup.sh +131 -0
- genai_otel_instrument-0.1.27/examples/demo/otel-collector-config.yml +40 -0
- genai_otel_instrument-0.1.27/examples/demo/prometheus.yml +23 -0
- genai_otel_instrument-0.1.27/examples/demo/requirements.txt +8 -0
- genai_otel_instrument-0.1.27/examples/dspy_example.py +457 -0
- genai_otel_instrument-0.1.27/examples/google_ai/.env.example +15 -0
- genai_otel_instrument-0.1.27/examples/google_ai/README.md +41 -0
- genai_otel_instrument-0.1.27/examples/google_ai/example.py +26 -0
- genai_otel_instrument-0.1.27/examples/google_genai_example.py +309 -0
- genai_otel_instrument-0.1.27/examples/groq/.env.example +5 -0
- genai_otel_instrument-0.1.27/examples/groq/README.md +7 -0
- genai_otel_instrument-0.1.27/examples/groq/example.py +18 -0
- genai_otel_instrument-0.1.27/examples/haystack_example.py +386 -0
- genai_otel_instrument-0.1.27/examples/huggingface/.env.example +3 -0
- genai_otel_instrument-0.1.27/examples/huggingface/README.md +6 -0
- genai_otel_instrument-0.1.27/examples/huggingface/example.py +12 -0
- genai_otel_instrument-0.1.27/examples/huggingface/example_automodel.py +123 -0
- genai_otel_instrument-0.1.27/examples/hyperbolic_example.py +247 -0
- genai_otel_instrument-0.1.27/examples/instructor_example.py +471 -0
- genai_otel_instrument-0.1.27/examples/langchain/.env.example +15 -0
- genai_otel_instrument-0.1.27/examples/langchain/README.md +41 -0
- genai_otel_instrument-0.1.27/examples/langchain/example.py +27 -0
- genai_otel_instrument-0.1.27/examples/langgraph_example.py +331 -0
- genai_otel_instrument-0.1.27/examples/litellm/example.py +24 -0
- genai_otel_instrument-0.1.27/examples/llamaindex/.env.example +4 -0
- genai_otel_instrument-0.1.27/examples/llamaindex/README.md +7 -0
- genai_otel_instrument-0.1.27/examples/llamaindex/example.py +17 -0
- genai_otel_instrument-0.1.27/examples/mistralai/.env.example +4 -0
- genai_otel_instrument-0.1.27/examples/mistralai/README.md +6 -0
- genai_otel_instrument-0.1.27/examples/mistralai/example.py +18 -0
- genai_otel_instrument-0.1.27/examples/ollama/.env.example +3 -0
- genai_otel_instrument-0.1.27/examples/ollama/README.md +6 -0
- genai_otel_instrument-0.1.27/examples/ollama/example.py +11 -0
- genai_otel_instrument-0.1.27/examples/ollama/example_with_server_metrics.py +117 -0
- genai_otel_instrument-0.1.27/examples/openai/.env.example +20 -0
- genai_otel_instrument-0.1.27/examples/openai/README.md +41 -0
- genai_otel_instrument-0.1.27/examples/openai/example.py +29 -0
- genai_otel_instrument-0.1.27/examples/openai_agents_example.py +228 -0
- genai_otel_instrument-0.1.27/examples/phase4_session_rag_tracking.py +254 -0
- genai_otel_instrument-0.1.27/examples/pii_detection/README.md +157 -0
- genai_otel_instrument-0.1.27/examples/pii_detection/basic_detect_mode.py +68 -0
- genai_otel_instrument-0.1.27/examples/pii_detection/blocking_mode.py +67 -0
- genai_otel_instrument-0.1.27/examples/pii_detection/combined_compliance.py +84 -0
- genai_otel_instrument-0.1.27/examples/pii_detection/custom_threshold.py +71 -0
- genai_otel_instrument-0.1.27/examples/pii_detection/env_var_config.py +86 -0
- genai_otel_instrument-0.1.27/examples/pii_detection/gdpr_compliance.py +71 -0
- genai_otel_instrument-0.1.27/examples/pii_detection/hipaa_compliance.py +71 -0
- genai_otel_instrument-0.1.27/examples/pii_detection/pci_dss_compliance.py +70 -0
- genai_otel_instrument-0.1.27/examples/pii_detection/redaction_mode.py +66 -0
- genai_otel_instrument-0.1.27/examples/pii_detection/response_detection.py +68 -0
- genai_otel_instrument-0.1.27/examples/pii_detection_example.py +432 -0
- genai_otel_instrument-0.1.27/examples/pydantic_ai_example.py +417 -0
- genai_otel_instrument-0.1.27/examples/replicate/.env.example +3 -0
- genai_otel_instrument-0.1.27/examples/replicate/README.md +6 -0
- genai_otel_instrument-0.1.27/examples/replicate/example.py +11 -0
- genai_otel_instrument-0.1.27/examples/sambanova_example.py +183 -0
- genai_otel_instrument-0.1.27/examples/server_metrics_example.py +172 -0
- genai_otel_instrument-0.1.27/examples/smolagents/example.py +21 -0
- genai_otel_instrument-0.1.27/examples/togetherai/.env.example +3 -0
- genai_otel_instrument-0.1.27/examples/togetherai/README.md +6 -0
- genai_otel_instrument-0.1.27/examples/togetherai/example.py +15 -0
- genai_otel_instrument-0.1.27/examples/toxicity_detection/README.md +193 -0
- genai_otel_instrument-0.1.27/examples/toxicity_detection/basic_detoxify.py +77 -0
- genai_otel_instrument-0.1.27/examples/toxicity_detection/blocking_mode.py +71 -0
- genai_otel_instrument-0.1.27/examples/toxicity_detection/category_detection.py +88 -0
- genai_otel_instrument-0.1.27/examples/toxicity_detection/combined_with_pii.py +123 -0
- genai_otel_instrument-0.1.27/examples/toxicity_detection/custom_threshold.py +104 -0
- genai_otel_instrument-0.1.27/examples/toxicity_detection/env_var_config.py +100 -0
- genai_otel_instrument-0.1.27/examples/toxicity_detection/perspective_api.py +94 -0
- genai_otel_instrument-0.1.27/examples/toxicity_detection/response_detection.py +99 -0
- genai_otel_instrument-0.1.27/examples/toxicity_detection_example.py +409 -0
- genai_otel_instrument-0.1.27/examples/vertexai/.env.example +3 -0
- genai_otel_instrument-0.1.27/examples/vertexai/README.md +6 -0
- genai_otel_instrument-0.1.27/examples/vertexai/example.py +11 -0
- genai_otel_instrument-0.1.27/genai_otel/__init__.py +132 -0
- genai_otel_instrument-0.1.27/genai_otel/__version__.py +34 -0
- genai_otel_instrument-0.1.27/genai_otel/auto_instrument.py +632 -0
- genai_otel_instrument-0.1.27/genai_otel/cli.py +92 -0
- genai_otel_instrument-0.1.27/genai_otel/config.py +337 -0
- genai_otel_instrument-0.1.27/genai_otel/cost_calculator.py +467 -0
- genai_otel_instrument-0.1.27/genai_otel/cost_enriching_exporter.py +207 -0
- genai_otel_instrument-0.1.27/genai_otel/cost_enrichment_processor.py +174 -0
- genai_otel_instrument-0.1.27/genai_otel/evaluation/__init__.py +76 -0
- genai_otel_instrument-0.1.27/genai_otel/evaluation/bias_detector.py +364 -0
- genai_otel_instrument-0.1.27/genai_otel/evaluation/config.py +261 -0
- genai_otel_instrument-0.1.27/genai_otel/evaluation/hallucination_detector.py +525 -0
- genai_otel_instrument-0.1.27/genai_otel/evaluation/pii_detector.py +356 -0
- genai_otel_instrument-0.1.27/genai_otel/evaluation/prompt_injection_detector.py +262 -0
- genai_otel_instrument-0.1.27/genai_otel/evaluation/restricted_topics_detector.py +316 -0
- genai_otel_instrument-0.1.27/genai_otel/evaluation/span_processor.py +1047 -0
- genai_otel_instrument-0.1.27/genai_otel/evaluation/toxicity_detector.py +406 -0
- genai_otel_instrument-0.1.27/genai_otel/exceptions.py +17 -0
- genai_otel_instrument-0.1.27/genai_otel/gpu_metrics.py +673 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/__init__.py +71 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/anthropic_instrumentor.py +134 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/anyscale_instrumentor.py +27 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/autogen_instrumentor.py +394 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/aws_bedrock_instrumentor.py +94 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/azure_openai_instrumentor.py +69 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/base.py +1043 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/bedrock_agents_instrumentor.py +398 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/cohere_instrumentor.py +140 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/crewai_instrumentor.py +524 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/dspy_instrumentor.py +661 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/google_ai_instrumentor.py +310 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/groq_instrumentor.py +106 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/guardrails_ai_instrumentor.py +510 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/haystack_instrumentor.py +503 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/huggingface_instrumentor.py +399 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/hyperbolic_instrumentor.py +236 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/instructor_instrumentor.py +425 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/langchain_instrumentor.py +340 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/langgraph_instrumentor.py +328 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/llamaindex_instrumentor.py +36 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/mistralai_instrumentor.py +315 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/ollama_instrumentor.py +276 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/ollama_server_metrics_poller.py +336 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/openai_agents_instrumentor.py +291 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/openai_instrumentor.py +260 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/pydantic_ai_instrumentor.py +362 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/replicate_instrumentor.py +87 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/sambanova_instrumentor.py +196 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/togetherai_instrumentor.py +146 -0
- genai_otel_instrument-0.1.27/genai_otel/instrumentors/vertexai_instrumentor.py +106 -0
- genai_otel_instrument-0.1.27/genai_otel/llm_pricing.json +3346 -0
- genai_otel_instrument-0.1.27/genai_otel/logging_config.py +45 -0
- genai_otel_instrument-0.1.27/genai_otel/mcp_instrumentors/__init__.py +14 -0
- genai_otel_instrument-0.1.27/genai_otel/mcp_instrumentors/api_instrumentor.py +144 -0
- genai_otel_instrument-0.1.27/genai_otel/mcp_instrumentors/base.py +105 -0
- genai_otel_instrument-0.1.27/genai_otel/mcp_instrumentors/database_instrumentor.py +336 -0
- genai_otel_instrument-0.1.27/genai_otel/mcp_instrumentors/kafka_instrumentor.py +31 -0
- genai_otel_instrument-0.1.27/genai_otel/mcp_instrumentors/manager.py +139 -0
- genai_otel_instrument-0.1.27/genai_otel/mcp_instrumentors/redis_instrumentor.py +31 -0
- genai_otel_instrument-0.1.27/genai_otel/mcp_instrumentors/vector_db_instrumentor.py +265 -0
- genai_otel_instrument-0.1.27/genai_otel/metrics.py +148 -0
- genai_otel_instrument-0.1.27/genai_otel/py.typed +2 -0
- genai_otel_instrument-0.1.27/genai_otel/server_metrics.py +197 -0
- genai_otel_instrument-0.1.27/genai_otel_instrument.egg-info/PKG-INFO +1571 -0
- genai_otel_instrument-0.1.27/genai_otel_instrument.egg-info/SOURCES.txt +319 -0
- genai_otel_instrument-0.1.27/genai_otel_instrument.egg-info/dependency_links.txt +1 -0
- genai_otel_instrument-0.1.27/genai_otel_instrument.egg-info/entry_points.txt +2 -0
- genai_otel_instrument-0.1.27/genai_otel_instrument.egg-info/requires.txt +238 -0
- genai_otel_instrument-0.1.27/genai_otel_instrument.egg-info/top_level.txt +1 -0
- genai_otel_instrument-0.1.27/openlit/semcov.py +30 -0
- genai_otel_instrument-0.1.27/pyproject.toml +307 -0
- genai_otel_instrument-0.1.27/requirements-dev.txt +62 -0
- genai_otel_instrument-0.1.27/requirements-testing.txt +70 -0
- genai_otel_instrument-0.1.27/requirements.txt +86 -0
- genai_otel_instrument-0.1.27/sample.env +228 -0
- genai_otel_instrument-0.1.27/scripts/README.md +106 -0
- genai_otel_instrument-0.1.27/scripts/SOLUTION_SUMMARY.md +318 -0
- genai_otel_instrument-0.1.27/scripts/VALIDATION_REPORT.md +414 -0
- genai_otel_instrument-0.1.27/scripts/add_ollama_pricing.py +108 -0
- genai_otel_instrument-0.1.27/scripts/debug/simple_test.py +157 -0
- genai_otel_instrument-0.1.27/scripts/debug/test_example_debug.py +56 -0
- genai_otel_instrument-0.1.27/scripts/debug/test_exporter_fix.py +41 -0
- genai_otel_instrument-0.1.27/scripts/debug/test_final.py +41 -0
- genai_otel_instrument-0.1.27/scripts/debug/test_gpu_debug.py +23 -0
- genai_otel_instrument-0.1.27/scripts/debug/test_gpu_metrics.py +15 -0
- genai_otel_instrument-0.1.27/scripts/debug/test_litellm_instrumentation.py +105 -0
- genai_otel_instrument-0.1.27/scripts/debug/test_ollama_cost.py +88 -0
- genai_otel_instrument-0.1.27/scripts/debug/test_ollama_span_attributes.py +54 -0
- genai_otel_instrument-0.1.27/scripts/fix_all_deps.sh +61 -0
- genai_otel_instrument-0.1.27/scripts/fix_instrumentors.py +176 -0
- genai_otel_instrument-0.1.27/scripts/test_attribute_type.py +65 -0
- genai_otel_instrument-0.1.27/scripts/test_codecarbon_metrics.py +39 -0
- genai_otel_instrument-0.1.27/scripts/test_correct_port.py +47 -0
- genai_otel_instrument-0.1.27/scripts/test_installation.py +158 -0
- genai_otel_instrument-0.1.27/scripts/test_pii_debug.py +76 -0
- genai_otel_instrument-0.1.27/scripts/test_pii_detailed.py +84 -0
- genai_otel_instrument-0.1.27/scripts/test_pii_final.py +71 -0
- genai_otel_instrument-0.1.27/scripts/test_pii_grpc.py +46 -0
- genai_otel_instrument-0.1.27/scripts/test_pii_grpc_env.py +45 -0
- genai_otel_instrument-0.1.27/scripts/test_pii_with_fix.py +47 -0
- genai_otel_instrument-0.1.27/scripts/test_release.sh +206 -0
- genai_otel_instrument-0.1.27/scripts/validate_examples.bat +137 -0
- genai_otel_instrument-0.1.27/scripts/validate_examples.sh +258 -0
- genai_otel_instrument-0.1.27/scripts/verify_server_metrics_integration.py +128 -0
- genai_otel_instrument-0.1.27/setup.cfg +4 -0
- genai_otel_instrument-0.1.27/setup.py +12 -0
- genai_otel_instrument-0.1.27/tests/__init__.py +0 -0
- genai_otel_instrument-0.1.27/tests/evaluation/__init__.py +1 -0
- genai_otel_instrument-0.1.27/tests/evaluation/test_bias_detector.py +486 -0
- genai_otel_instrument-0.1.27/tests/evaluation/test_hallucination_detector.py +313 -0
- genai_otel_instrument-0.1.27/tests/evaluation/test_integration.py +1364 -0
- genai_otel_instrument-0.1.27/tests/evaluation/test_pii_detector.py +393 -0
- genai_otel_instrument-0.1.27/tests/evaluation/test_prompt_injection_detector.py +216 -0
- genai_otel_instrument-0.1.27/tests/evaluation/test_restricted_topics_detector.py +235 -0
- genai_otel_instrument-0.1.27/tests/evaluation/test_toxicity_detector.py +475 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_anthropic_instrumentor.py +287 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_anyscale_instrumentor.py +43 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_autogen_instrumentor.py +464 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_aws_bedrock_instrumentor.py +383 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_azure_openai_instrumentor.py +254 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_base.py +928 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_bedrock_agents_instrumentor.py +441 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_cohere_instrumentor.py +223 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_crewai_instrumentor.py +358 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_dspy_instrumentor.py +604 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_google_ai_instrumentor.py +377 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_groq_instrumentor.py +235 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_guardrails_ai_instrumentor.py +164 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_haystack_instrumentor.py +496 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_huggingface_instrumentor.py +430 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_hyperbolic_instrumentor.py +131 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_instructor_instrumentor.py +480 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_langchain_instrumentor.py +522 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_langgraph_instrumentor.py +294 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_litellm_instrumentor.py +51 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_llamaindex_instrumentor.py +160 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_mcp_instrumentor.py +59 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_mistralai_instrumentor.py +129 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_ollama_instrumentor.py +589 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_ollama_server_metrics_poller.py +480 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_openai_agents_instrumentor.py +249 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_openai_instrumentor.py +497 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_pydantic_ai_instrumentor.py +549 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_replicate_instrumentor.py +132 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_sambanova_instrumentor.py +196 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_smolagents_instrumentor.py +61 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_togetherai_instrumentor.py +165 -0
- genai_otel_instrument-0.1.27/tests/instrumentors/test_vertexai_instrumentor.py +186 -0
- genai_otel_instrument-0.1.27/tests/mcp_instrumentors/test_api_instrumentor.py +236 -0
- genai_otel_instrument-0.1.27/tests/mcp_instrumentors/test_database_instrumentor.py +431 -0
- genai_otel_instrument-0.1.27/tests/mcp_instrumentors/test_kafka_instrumentor.py +75 -0
- genai_otel_instrument-0.1.27/tests/mcp_instrumentors/test_manager.py +501 -0
- genai_otel_instrument-0.1.27/tests/mcp_instrumentors/test_mcp_base.py +139 -0
- genai_otel_instrument-0.1.27/tests/mcp_instrumentors/test_redis_instrumentor.py +106 -0
- genai_otel_instrument-0.1.27/tests/mcp_instrumentors/test_vector_db_instrumentor.py +507 -0
- genai_otel_instrument-0.1.27/tests/test_auto_instrument.py +913 -0
- genai_otel_instrument-0.1.27/tests/test_cli.py +207 -0
- genai_otel_instrument-0.1.27/tests/test_config.py +88 -0
- genai_otel_instrument-0.1.27/tests/test_cost_calculator.py +378 -0
- genai_otel_instrument-0.1.27/tests/test_cost_enriching_exporter.py +391 -0
- genai_otel_instrument-0.1.27/tests/test_cost_enrichment_processor.py +457 -0
- genai_otel_instrument-0.1.27/tests/test_exceptions.py +50 -0
- genai_otel_instrument-0.1.27/tests/test_gpu_metrics.py +1025 -0
- genai_otel_instrument-0.1.27/tests/test_init.py +214 -0
- genai_otel_instrument-0.1.27/tests/test_logging_config.py +331 -0
- genai_otel_instrument-0.1.27/tests/test_metrics.py +100 -0
- genai_otel_instrument-0.1.27/tests/test_openai_instrumentor.py +93 -0
- genai_otel_instrument-0.1.27/tests/test_otel_setup.py +0 -0
- genai_otel_instrument-0.1.27/tests/test_phase4_features.py +209 -0
- genai_otel_instrument-0.1.27/tests/test_server_metrics.py +259 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Release Guide
|
|
2
|
+
|
|
3
|
+
This guide explains how to publish new versions of `genai-otel-instrument` to PyPI.
|
|
4
|
+
|
|
5
|
+
## Automated Publishing Workflow
|
|
6
|
+
|
|
7
|
+
The repository is configured to automatically publish to PyPI when you create a GitHub release. The workflow:
|
|
8
|
+
|
|
9
|
+
1. ✅ Runs full test suite
|
|
10
|
+
2. ✅ Checks code quality (black, isort)
|
|
11
|
+
3. ✅ Builds the package
|
|
12
|
+
4. ✅ Tests package installation
|
|
13
|
+
5. 📦 Publishes to Test PyPI
|
|
14
|
+
6. ✅ Verifies Test PyPI upload
|
|
15
|
+
7. 📦 Publishes to production PyPI
|
|
16
|
+
8. 📋 Creates release summary
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
|
|
20
|
+
Before creating a release, ensure:
|
|
21
|
+
|
|
22
|
+
- [ ] All tests pass: `pytest tests/ -v`
|
|
23
|
+
- [ ] Code is properly formatted: `black genai_otel tests && isort genai_otel tests`
|
|
24
|
+
- [ ] CHANGELOG.md is updated with release notes
|
|
25
|
+
- [ ] Version is bumped (handled by `setuptools_scm` based on git tags)
|
|
26
|
+
- [ ] All changes are committed and pushed to `main` branch
|
|
27
|
+
|
|
28
|
+
## Creating a Release
|
|
29
|
+
|
|
30
|
+
### Method 1: GitHub UI (Recommended)
|
|
31
|
+
|
|
32
|
+
1. Navigate to https://github.com/YOUR_ORG/genai-otel-instrument/releases/new
|
|
33
|
+
|
|
34
|
+
2. Click "Choose a tag" and create a new tag:
|
|
35
|
+
- Format: `v{MAJOR}.{MINOR}.{PATCH}` (e.g., `v0.1.14`)
|
|
36
|
+
- Target: `main` branch
|
|
37
|
+
|
|
38
|
+
3. Fill in release details:
|
|
39
|
+
- **Release title**: Same as tag (e.g., `v0.1.14`)
|
|
40
|
+
- **Description**: Copy relevant section from CHANGELOG.md
|
|
41
|
+
|
|
42
|
+
4. Click "Publish release"
|
|
43
|
+
|
|
44
|
+
5. Monitor the workflow:
|
|
45
|
+
- Go to Actions tab
|
|
46
|
+
- Watch "Publish to PyPI" workflow
|
|
47
|
+
|
|
48
|
+
### Method 2: GitHub CLI
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Create and push a tag
|
|
52
|
+
git tag -a v0.1.14 -m "Release v0.1.14: Added LangChain chat model support"
|
|
53
|
+
git push origin v0.1.14
|
|
54
|
+
|
|
55
|
+
# Create release from tag
|
|
56
|
+
gh release create v0.1.14 \
|
|
57
|
+
--title "v0.1.14" \
|
|
58
|
+
--notes-file CHANGELOG.md \
|
|
59
|
+
--target main
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Method 3: Manual Trigger (Testing)
|
|
63
|
+
|
|
64
|
+
For testing the workflow without creating a release:
|
|
65
|
+
|
|
66
|
+
1. Go to Actions tab
|
|
67
|
+
2. Select "Publish to PyPI" workflow
|
|
68
|
+
3. Click "Run workflow"
|
|
69
|
+
4. Select branch and click "Run workflow"
|
|
70
|
+
|
|
71
|
+
**Note**: Manual triggers will run tests but won't publish to PyPI (only releases trigger publishing).
|
|
72
|
+
|
|
73
|
+
## Versioning Strategy
|
|
74
|
+
|
|
75
|
+
This project uses `setuptools_scm` for automatic versioning:
|
|
76
|
+
|
|
77
|
+
- **Version source**: Git tags
|
|
78
|
+
- **Format**: Semantic Versioning (MAJOR.MINOR.PATCH)
|
|
79
|
+
- **Pre-releases**: Add suffix like `-alpha.1`, `-beta.1`, `-rc.1`
|
|
80
|
+
|
|
81
|
+
### Version Bumping Guidelines
|
|
82
|
+
|
|
83
|
+
- **MAJOR**: Breaking changes, incompatible API changes
|
|
84
|
+
- **MINOR**: New features, backward-compatible additions
|
|
85
|
+
- **PATCH**: Bug fixes, backward-compatible improvements
|
|
86
|
+
|
|
87
|
+
### Examples
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Patch release (bug fixes)
|
|
91
|
+
git tag v0.1.14
|
|
92
|
+
|
|
93
|
+
# Minor release (new features)
|
|
94
|
+
git tag v0.2.0
|
|
95
|
+
|
|
96
|
+
# Major release (breaking changes)
|
|
97
|
+
git tag v1.0.0
|
|
98
|
+
|
|
99
|
+
# Pre-release
|
|
100
|
+
git tag v0.2.0-rc.1
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Secrets Configuration
|
|
104
|
+
|
|
105
|
+
The workflow uses these GitHub secrets (already configured):
|
|
106
|
+
|
|
107
|
+
- `TEST_PYPI_API_TOKEN`: Token for https://test.pypi.org
|
|
108
|
+
- `PYPI_API_TOKEN`: Token for https://pypi.org
|
|
109
|
+
|
|
110
|
+
### Rotating Tokens
|
|
111
|
+
|
|
112
|
+
If tokens need rotation:
|
|
113
|
+
|
|
114
|
+
1. Generate new tokens:
|
|
115
|
+
- TestPyPI: https://test.pypi.org/manage/account/token/
|
|
116
|
+
- PyPI: https://pypi.org/manage/account/token/
|
|
117
|
+
|
|
118
|
+
2. Update GitHub secrets:
|
|
119
|
+
- Go to repository Settings → Secrets and variables → Actions
|
|
120
|
+
- Update `TEST_PYPI_API_TOKEN` and `PYPI_API_TOKEN`
|
|
121
|
+
|
|
122
|
+
## Manual Publishing (Fallback)
|
|
123
|
+
|
|
124
|
+
If automated workflow fails, publish manually:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Install build tools
|
|
128
|
+
pip install build twine
|
|
129
|
+
|
|
130
|
+
# Build package
|
|
131
|
+
python -m build
|
|
132
|
+
|
|
133
|
+
# Publish to Test PyPI
|
|
134
|
+
python -m twine upload --verbose --repository testpypi --username __token__ --password YOUR_TEST_PYPI_TOKEN dist/*
|
|
135
|
+
|
|
136
|
+
# Verify Test PyPI installation
|
|
137
|
+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ genai-otel-instrument
|
|
138
|
+
|
|
139
|
+
# Publish to PyPI
|
|
140
|
+
python -m twine upload --verbose dist/* --username __token__ --password YOUR_PYPI_TOKEN
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Post-Release Checklist
|
|
144
|
+
|
|
145
|
+
After publishing:
|
|
146
|
+
|
|
147
|
+
- [ ] Verify package on PyPI: https://pypi.org/project/genai-otel-instrument/
|
|
148
|
+
- [ ] Test installation: `pip install genai-otel-instrument --upgrade`
|
|
149
|
+
- [ ] Update documentation if needed
|
|
150
|
+
- [ ] Announce release (if major version)
|
|
151
|
+
- [ ] Monitor GitHub issues for installation problems
|
|
152
|
+
|
|
153
|
+
## Troubleshooting
|
|
154
|
+
|
|
155
|
+
### Workflow fails on test step
|
|
156
|
+
- Review test failures in Actions logs
|
|
157
|
+
- Fix issues locally and create new release
|
|
158
|
+
|
|
159
|
+
### "File already exists" error on PyPI
|
|
160
|
+
- Package version already published
|
|
161
|
+
- Bump version number and create new release
|
|
162
|
+
- **Note**: Cannot overwrite existing PyPI versions
|
|
163
|
+
|
|
164
|
+
### Test PyPI upload succeeds but PyPI fails
|
|
165
|
+
- Check PyPI token is valid
|
|
166
|
+
- Verify package metadata
|
|
167
|
+
- Check for naming conflicts
|
|
168
|
+
|
|
169
|
+
### Secrets not working
|
|
170
|
+
- Verify secrets are set in repository settings
|
|
171
|
+
- Check secret names match workflow file exactly
|
|
172
|
+
- Ensure tokens have correct permissions
|
|
173
|
+
|
|
174
|
+
## References
|
|
175
|
+
|
|
176
|
+
- [Python Packaging Guide](https://packaging.python.org/)
|
|
177
|
+
- [Twine Documentation](https://twine.readthedocs.io/)
|
|
178
|
+
- [GitHub Actions](https://docs.github.com/en/actions)
|
|
179
|
+
- [Semantic Versioning](https://semver.org/)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Quick Release Guide
|
|
2
|
+
|
|
3
|
+
## TL;DR - Release Checklist
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# 1. Update CHANGELOG.md with release notes
|
|
7
|
+
# 2. Commit changes
|
|
8
|
+
git add .
|
|
9
|
+
git commit -m "chore: Prepare release v0.1.14"
|
|
10
|
+
git push origin main
|
|
11
|
+
|
|
12
|
+
# 3. Create and push tag
|
|
13
|
+
git tag v0.1.14
|
|
14
|
+
git push origin v0.1.14
|
|
15
|
+
|
|
16
|
+
# 4. Create GitHub release (triggers auto-publish)
|
|
17
|
+
gh release create v0.1.14 --title "v0.1.14" --notes-file <(sed -n '/## \[0.1.14\]/,/## \[/p' CHANGELOG.md | head -n -1)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## What Happens Automatically?
|
|
21
|
+
|
|
22
|
+
When you create a GitHub release:
|
|
23
|
+
|
|
24
|
+
1. ✅ **Tests run** - Full pytest suite with coverage
|
|
25
|
+
2. ✅ **Quality checks** - black, isort formatting validation
|
|
26
|
+
3. ✅ **Package builds** - Creates wheel and source distribution
|
|
27
|
+
4. ✅ **Installation test** - Verifies package can be installed
|
|
28
|
+
5. 📦 **Publishes to TestPyPI** - Test environment first
|
|
29
|
+
6. ⏳ **Waits 30s** - Allows TestPyPI to process
|
|
30
|
+
7. ✅ **Verifies TestPyPI** - Attempts installation from test server
|
|
31
|
+
8. 📦 **Publishes to PyPI** - Production release
|
|
32
|
+
9. 📋 **Creates summary** - Release report in GitHub Actions
|
|
33
|
+
|
|
34
|
+
## Version Format
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
v{MAJOR}.{MINOR}.{PATCH}[-{PRE-RELEASE}]
|
|
38
|
+
|
|
39
|
+
Examples:
|
|
40
|
+
v0.1.14 # Patch release
|
|
41
|
+
v0.2.0 # Minor release
|
|
42
|
+
v1.0.0 # Major release
|
|
43
|
+
v0.2.0-rc.1 # Release candidate
|
|
44
|
+
v0.2.0-beta.2 # Beta release
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Common Commands
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Check current version
|
|
51
|
+
git describe --tags --abbrev=0
|
|
52
|
+
|
|
53
|
+
# List all tags
|
|
54
|
+
git tag -l
|
|
55
|
+
|
|
56
|
+
# Delete local tag (if mistake)
|
|
57
|
+
git tag -d v0.1.14
|
|
58
|
+
|
|
59
|
+
# Delete remote tag (if mistake)
|
|
60
|
+
git push origin :refs/tags/v0.1.14
|
|
61
|
+
|
|
62
|
+
# View workflow status
|
|
63
|
+
gh run list --workflow=publish.yml
|
|
64
|
+
|
|
65
|
+
# View workflow logs
|
|
66
|
+
gh run view --log
|
|
67
|
+
|
|
68
|
+
# Manual workflow trigger (for testing)
|
|
69
|
+
gh workflow run publish.yml
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Quick Fixes
|
|
73
|
+
|
|
74
|
+
### "Tests failed" in workflow
|
|
75
|
+
```bash
|
|
76
|
+
# Run tests locally first
|
|
77
|
+
pytest tests/ -v
|
|
78
|
+
|
|
79
|
+
# Fix issues and recommit
|
|
80
|
+
git add .
|
|
81
|
+
git commit -m "fix: Address test failures"
|
|
82
|
+
git push
|
|
83
|
+
|
|
84
|
+
# Delete and recreate tag
|
|
85
|
+
git tag -d v0.1.14
|
|
86
|
+
git push origin :refs/tags/v0.1.14
|
|
87
|
+
git tag v0.1.14
|
|
88
|
+
git push origin v0.1.14
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### "Package already exists" error
|
|
92
|
+
```bash
|
|
93
|
+
# Can't overwrite published versions
|
|
94
|
+
# Must increment version
|
|
95
|
+
git tag v0.1.15
|
|
96
|
+
git push origin v0.1.15
|
|
97
|
+
gh release create v0.1.15 --title "v0.1.15" --notes "Hotfix release"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### View published packages
|
|
101
|
+
- TestPyPI: https://test.pypi.org/project/genai-otel-instrument/
|
|
102
|
+
- PyPI: https://pypi.org/project/genai-otel-instrument/
|
|
103
|
+
|
|
104
|
+
## Secrets Location
|
|
105
|
+
|
|
106
|
+
GitHub Repository Settings → Secrets and variables → Actions:
|
|
107
|
+
- `TEST_PYPI_API_TOKEN` - For test.pypi.org
|
|
108
|
+
- `PYPI_API_TOKEN` - For pypi.org
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
**For detailed information, see [RELEASE_GUIDE.md](RELEASE_GUIDE.md)**
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
genai_otel_instrument-0.1.27/.github/images/Screenshots/Trace_HuggingFace_Transformer_Models.png
ADDED
|
Binary file
|
genai_otel_instrument-0.1.27/.github/images/Screenshots/Traces_SmolAgent_Token_Cost_breakdown.png
ADDED
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# CI/CD Workflows
|
|
2
|
+
|
|
3
|
+
This directory contains GitHub Actions workflows for automated testing, validation, and publishing.
|
|
4
|
+
|
|
5
|
+
## Workflows
|
|
6
|
+
|
|
7
|
+
### 1. `test.yml` - Continuous Integration Tests
|
|
8
|
+
|
|
9
|
+
**Triggers:**
|
|
10
|
+
- Push to `main` or `develop` branches
|
|
11
|
+
- Pull requests to `main` or `develop` branches
|
|
12
|
+
|
|
13
|
+
**Jobs:**
|
|
14
|
+
|
|
15
|
+
#### `test` job
|
|
16
|
+
- **Matrix:** Runs on Ubuntu, macOS, and Windows with Python 3.8-3.12
|
|
17
|
+
- **Steps:**
|
|
18
|
+
1. Lint with pylint
|
|
19
|
+
2. Check formatting with black
|
|
20
|
+
3. Check import sorting with isort
|
|
21
|
+
4. Type check with mypy
|
|
22
|
+
5. Run pytest with coverage
|
|
23
|
+
6. Upload coverage to Codecov
|
|
24
|
+
|
|
25
|
+
#### `build-and-install-test` job
|
|
26
|
+
- **Matrix:** Runs on Ubuntu and Windows with Python 3.9 and 3.12
|
|
27
|
+
- **Purpose:** Validates that the package can be built and installed correctly
|
|
28
|
+
- **Steps:**
|
|
29
|
+
1. Build the package using `python -m build`
|
|
30
|
+
2. Check package with `twine check`
|
|
31
|
+
3. Install in isolated virtual environment
|
|
32
|
+
4. Test core imports
|
|
33
|
+
5. Verify CLI tool works (`genai-instrument --help`)
|
|
34
|
+
|
|
35
|
+
#### `security` job
|
|
36
|
+
- **Platform:** Ubuntu with Python 3.11
|
|
37
|
+
- **Steps:**
|
|
38
|
+
1. Run safety check for dependency vulnerabilities
|
|
39
|
+
2. Run bandit security scan
|
|
40
|
+
|
|
41
|
+
### 2. `publish.yml` - PyPI Publication
|
|
42
|
+
|
|
43
|
+
**Triggers:**
|
|
44
|
+
- Release published on GitHub
|
|
45
|
+
- Manual workflow dispatch (for testing)
|
|
46
|
+
|
|
47
|
+
**Steps:**
|
|
48
|
+
1. **Test Suite:** Runs full pytest suite to ensure all tests pass
|
|
49
|
+
2. **Code Quality:** Validates formatting and import sorting
|
|
50
|
+
3. **Build:** Creates wheel and sdist packages
|
|
51
|
+
4. **Validation:** Checks package with twine
|
|
52
|
+
5. **Installation Test:** Tests package installation in clean environment
|
|
53
|
+
6. **Publish to Test PyPI:** Uploads to Test PyPI (if release event)
|
|
54
|
+
7. **Publish to PyPI:** Uploads to production PyPI (if release event)
|
|
55
|
+
|
|
56
|
+
**Required Secrets:**
|
|
57
|
+
- `TEST_PYPI_API_TOKEN`: API token for Test PyPI
|
|
58
|
+
- `PYPI_API_TOKEN`: API token for production PyPI
|
|
59
|
+
|
|
60
|
+
### 3. `pre-release-check.yml` - Pre-Release Validation
|
|
61
|
+
|
|
62
|
+
**Triggers:**
|
|
63
|
+
- Manual workflow dispatch
|
|
64
|
+
- Push of version tags (`v*`)
|
|
65
|
+
|
|
66
|
+
**Purpose:** Comprehensive validation before creating a release (mimics `scripts/test_release.sh`)
|
|
67
|
+
|
|
68
|
+
**Matrix:** Runs on Ubuntu, Windows, and macOS with Python 3.9 and 3.12
|
|
69
|
+
|
|
70
|
+
**Steps:**
|
|
71
|
+
1. Display environment information
|
|
72
|
+
2. Install development dependencies
|
|
73
|
+
3. Auto-format code (isort + black)
|
|
74
|
+
4. Run full test suite with coverage
|
|
75
|
+
5. Perform code quality checks
|
|
76
|
+
6. Build package
|
|
77
|
+
7. Validate package with twine
|
|
78
|
+
8. Test installation in isolated environment
|
|
79
|
+
9. Verify CLI functionality
|
|
80
|
+
10. Upload build artifacts (Ubuntu + Python 3.12 only)
|
|
81
|
+
|
|
82
|
+
**Use this workflow:**
|
|
83
|
+
- Before creating a new release
|
|
84
|
+
- To validate your changes work across all platforms
|
|
85
|
+
- As a final check that everything is ready for publication
|
|
86
|
+
|
|
87
|
+
## Usage Examples
|
|
88
|
+
|
|
89
|
+
### Running Pre-Release Validation Manually
|
|
90
|
+
|
|
91
|
+
1. Go to "Actions" tab in GitHub
|
|
92
|
+
2. Select "Pre-Release Validation" workflow
|
|
93
|
+
3. Click "Run workflow"
|
|
94
|
+
4. Select branch and click "Run workflow"
|
|
95
|
+
|
|
96
|
+
This will run all validation checks across all platforms.
|
|
97
|
+
|
|
98
|
+
### Creating a Release
|
|
99
|
+
|
|
100
|
+
1. **Run Pre-Release Validation:**
|
|
101
|
+
```bash
|
|
102
|
+
# Locally, you can use:
|
|
103
|
+
./scripts/test_release.sh
|
|
104
|
+
|
|
105
|
+
# Or trigger the GitHub Action manually
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
2. **Ensure all checks pass**
|
|
109
|
+
|
|
110
|
+
3. **Create and push a version tag:**
|
|
111
|
+
```bash
|
|
112
|
+
git tag v0.2.0
|
|
113
|
+
git push origin v0.2.0
|
|
114
|
+
```
|
|
115
|
+
This triggers the pre-release-check workflow.
|
|
116
|
+
|
|
117
|
+
4. **Create GitHub Release:**
|
|
118
|
+
- Go to "Releases" → "Draft a new release"
|
|
119
|
+
- Select the tag you created
|
|
120
|
+
- Fill in release notes
|
|
121
|
+
- Click "Publish release"
|
|
122
|
+
|
|
123
|
+
This triggers the publish workflow which will:
|
|
124
|
+
- Run tests
|
|
125
|
+
- Build package
|
|
126
|
+
- Publish to Test PyPI
|
|
127
|
+
- Publish to PyPI
|
|
128
|
+
|
|
129
|
+
### Manual Testing Before Release
|
|
130
|
+
|
|
131
|
+
Use the local script for faster iteration:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# From project root
|
|
135
|
+
./scripts/test_release.sh
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
This script provides colored output and validates:
|
|
139
|
+
- Project structure
|
|
140
|
+
- Python environment
|
|
141
|
+
- Code formatting (auto-applies)
|
|
142
|
+
- Full test suite
|
|
143
|
+
- Package build
|
|
144
|
+
- Package validation
|
|
145
|
+
- Installation in isolated environment
|
|
146
|
+
- CLI functionality
|
|
147
|
+
|
|
148
|
+
## Workflow Dependencies
|
|
149
|
+
|
|
150
|
+
All workflows require these tools (automatically installed):
|
|
151
|
+
- `pytest` - Testing framework
|
|
152
|
+
- `pytest-cov` - Coverage plugin
|
|
153
|
+
- `black` - Code formatter
|
|
154
|
+
- `isort` - Import sorter
|
|
155
|
+
- `pylint` - Linter
|
|
156
|
+
- `mypy` - Type checker
|
|
157
|
+
- `build` - Package builder
|
|
158
|
+
- `twine` - Package uploader
|
|
159
|
+
|
|
160
|
+
## Best Practices
|
|
161
|
+
|
|
162
|
+
1. **Before committing:**
|
|
163
|
+
- Run `black genai_otel tests`
|
|
164
|
+
- Run `isort genai_otel tests`
|
|
165
|
+
- Run `pytest tests/`
|
|
166
|
+
|
|
167
|
+
2. **Before creating a PR:**
|
|
168
|
+
- Ensure all CI checks pass
|
|
169
|
+
- Review coverage report
|
|
170
|
+
|
|
171
|
+
3. **Before releasing:**
|
|
172
|
+
- Run `./scripts/test_release.sh` locally
|
|
173
|
+
- Trigger "Pre-Release Validation" workflow
|
|
174
|
+
- Verify all platforms pass
|
|
175
|
+
- Update CHANGELOG.md
|
|
176
|
+
- Update version in `genai_otel/__version__.py`
|
|
177
|
+
|
|
178
|
+
4. **After releasing:**
|
|
179
|
+
- Test installation from PyPI: `pip install genai-otel-instrument`
|
|
180
|
+
- Verify functionality with example code
|
|
181
|
+
- Monitor for any user-reported issues
|
|
182
|
+
|
|
183
|
+
## Troubleshooting
|
|
184
|
+
|
|
185
|
+
### Tests fail only on specific OS
|
|
186
|
+
- Check for platform-specific path handling
|
|
187
|
+
- Review file permission issues (especially on Windows)
|
|
188
|
+
- Check line ending differences (CRLF vs LF)
|
|
189
|
+
|
|
190
|
+
### Package build fails
|
|
191
|
+
- Ensure `pyproject.toml` is valid
|
|
192
|
+
- Check MANIFEST.in includes all necessary files
|
|
193
|
+
- Verify dependencies are correctly specified
|
|
194
|
+
|
|
195
|
+
### Installation test fails
|
|
196
|
+
- Check entry points in `pyproject.toml`
|
|
197
|
+
- Verify all required files are included in the package
|
|
198
|
+
- Test locally with: `pip install dist/*.whl`
|
|
199
|
+
|
|
200
|
+
### CLI tool not found after installation
|
|
201
|
+
- Verify `[project.scripts]` section in `pyproject.toml`
|
|
202
|
+
- Check that console_scripts entry point is correct
|
|
203
|
+
- Test with: `python -m genai_otel.cli`
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
name: Pre-Release Validation
|
|
2
|
+
|
|
3
|
+
# This workflow mimics the manual test_release.sh script
|
|
4
|
+
# Run it before creating a release to validate everything works
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
workflow_dispatch: # Manual trigger only
|
|
8
|
+
push:
|
|
9
|
+
tags:
|
|
10
|
+
- 'v*' # Trigger on version tags
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
pre-release-validation:
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
19
|
+
python-version: ["3.9", "3.12"]
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: ${{ matrix.python-version }}
|
|
28
|
+
|
|
29
|
+
- name: Display environment info
|
|
30
|
+
run: |
|
|
31
|
+
echo "=========================================="
|
|
32
|
+
echo "Pre-Release Validation"
|
|
33
|
+
echo "=========================================="
|
|
34
|
+
python --version
|
|
35
|
+
python -c "import sys; print(f'Python path: {sys.executable}')"
|
|
36
|
+
|
|
37
|
+
- name: Install development dependencies
|
|
38
|
+
run: |
|
|
39
|
+
python -m pip install --upgrade pip
|
|
40
|
+
pip install -e ".[dev]"
|
|
41
|
+
|
|
42
|
+
- name: Auto-format code
|
|
43
|
+
run: |
|
|
44
|
+
echo "→ Auto-formatting code with isort and black..."
|
|
45
|
+
isort genai_otel tests
|
|
46
|
+
black genai_otel tests
|
|
47
|
+
echo "✓ Code formatting applied"
|
|
48
|
+
|
|
49
|
+
- name: Run full test suite
|
|
50
|
+
run: |
|
|
51
|
+
echo "→ Running tests..."
|
|
52
|
+
pytest tests/ -v --cov=genai_otel --cov-report=term --cov-report=html --cov-report=term-missing
|
|
53
|
+
echo "✓ All tests passed"
|
|
54
|
+
|
|
55
|
+
- name: Code quality checks
|
|
56
|
+
run: |
|
|
57
|
+
echo "→ Running code quality checks..."
|
|
58
|
+
black --check genai_otel tests --exclude='__version__\.py'
|
|
59
|
+
isort --check-only --skip-glob='*/__version__.py' genai_otel tests
|
|
60
|
+
pylint genai_otel --rcfile=.pylintrc --exit-zero || true
|
|
61
|
+
echo "✓ Code quality checks complete"
|
|
62
|
+
|
|
63
|
+
- name: Build package
|
|
64
|
+
run: |
|
|
65
|
+
echo "→ Building package..."
|
|
66
|
+
pip install build twine
|
|
67
|
+
python -m build
|
|
68
|
+
echo "✓ Package built successfully"
|
|
69
|
+
|
|
70
|
+
- name: Check package with twine
|
|
71
|
+
run: |
|
|
72
|
+
echo "→ Checking package with twine..."
|
|
73
|
+
twine check dist/*
|
|
74
|
+
echo "✓ Package check passed"
|
|
75
|
+
|
|
76
|
+
- name: Test installation in isolated environment
|
|
77
|
+
shell: bash
|
|
78
|
+
run: |
|
|
79
|
+
echo "→ Testing installation in temporary environment..."
|
|
80
|
+
|
|
81
|
+
# Create temporary virtual environment
|
|
82
|
+
python -m venv test_release_env
|
|
83
|
+
|
|
84
|
+
# Activate based on OS
|
|
85
|
+
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
|
86
|
+
source test_release_env/Scripts/activate
|
|
87
|
+
else
|
|
88
|
+
source test_release_env/bin/activate
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# Install the built wheel
|
|
92
|
+
pip install dist/*.whl
|
|
93
|
+
|
|
94
|
+
# Test imports
|
|
95
|
+
python -c 'import genai_otel; print(f"Successfully imported genai_otel version: {genai_otel.__version__}")'
|
|
96
|
+
python -c 'from genai_otel.config import OTelConfig; from genai_otel.cost_calculator import CostCalculator; from genai_otel.auto_instrument import setup_auto_instrumentation; print("All core components imported successfully")'
|
|
97
|
+
|
|
98
|
+
# Test CLI tool
|
|
99
|
+
genai-instrument --help > /dev/null 2>&1
|
|
100
|
+
echo "✓ CLI tool works"
|
|
101
|
+
|
|
102
|
+
# Cleanup
|
|
103
|
+
deactivate
|
|
104
|
+
|
|
105
|
+
- name: Upload build artifacts
|
|
106
|
+
uses: actions/upload-artifact@v4
|
|
107
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
108
|
+
with:
|
|
109
|
+
name: dist-packages
|
|
110
|
+
path: dist/
|
|
111
|
+
|
|
112
|
+
- name: Summary
|
|
113
|
+
if: success()
|
|
114
|
+
run: |
|
|
115
|
+
echo ""
|
|
116
|
+
echo "=========================================="
|
|
117
|
+
echo "✓ All Pre-Release Checks Passed!"
|
|
118
|
+
echo "=========================================="
|
|
119
|
+
echo ""
|
|
120
|
+
echo "Release Checklist:"
|
|
121
|
+
echo "✅ All tests passing"
|
|
122
|
+
echo "✅ Code formatting applied"
|
|
123
|
+
echo "✅ Import sorting applied"
|
|
124
|
+
echo "✅ Package builds successfully"
|
|
125
|
+
echo "✅ Installation tested"
|
|
126
|
+
echo "✅ CLI tool works"
|
|
127
|
+
echo ""
|
|
128
|
+
echo "Ready for release! 🚀"
|