mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-11 18:56:23 +00:00
Update test scripts and documentation for simplified OpenTelemetry approach
- Update all test scripts to use OTEL_EXPORT_ENABLED instead of legacy flags - Remove references to deprecated ENABLE_OPENTELEMETRY and OTEL_ENABLED - Simplify run_tests_local.sh to use --exclude-tag=bluesky - Update documentation to reflect instrumentation always enabled - Remove legacy configuration section from README.md All scripts now use the new approach where: - OpenTelemetry instrumentation is always enabled - Only data export is controlled by OTEL_EXPORT_ENABLED flag - Cleaner configuration with single export control flag
This commit is contained in:
@@ -30,11 +30,6 @@ OpenTelemetry instrumentation is always enabled in ivatar. The following environ
|
||||
- Example: "http://localhost:4317" (gRPC) or "http://localhost:4318" (HTTP)
|
||||
- `OTEL_PROMETHEUS_ENDPOINT`: Prometheus metrics endpoint (default: "0.0.0.0:9464")
|
||||
|
||||
### Legacy Configuration (Deprecated)
|
||||
|
||||
- `ENABLE_OPENTELEMETRY`: Legacy flag, no longer used (instrumentation always enabled)
|
||||
- `OTEL_ENABLED`: Legacy flag, no longer used (instrumentation always enabled)
|
||||
|
||||
## Example Configurations
|
||||
|
||||
### Development (Export Disabled)
|
||||
|
||||
@@ -1,27 +1,19 @@
|
||||
#!/bin/bash
|
||||
# Run tests locally, skipping Bluesky tests that require external API credentials
|
||||
# OpenTelemetry is disabled by default for local testing
|
||||
# OpenTelemetry instrumentation is always enabled, but export is disabled for local testing
|
||||
|
||||
echo "Running tests locally (skipping Bluesky tests, OpenTelemetry disabled)..."
|
||||
echo "======================================================================="
|
||||
echo "Running tests locally (skipping Bluesky tests, OpenTelemetry export disabled)..."
|
||||
echo "============================================================================="
|
||||
|
||||
# Ensure OpenTelemetry is disabled for local testing
|
||||
export ENABLE_OPENTELEMETRY=false
|
||||
export OTEL_ENABLED=false
|
||||
# OpenTelemetry instrumentation is always enabled, but disable export for local testing
|
||||
export OTEL_EXPORT_ENABLED=false
|
||||
export OTEL_SERVICE_NAME=ivatar-local
|
||||
export OTEL_ENVIRONMENT=development
|
||||
|
||||
# Run Django tests excluding the Bluesky test file and OpenTelemetry tests
|
||||
# Run Django tests excluding Bluesky tests (OpenTelemetry tests are included)
|
||||
python3 manage.py test \
|
||||
ivatar.ivataraccount.test_auth \
|
||||
ivatar.ivataraccount.test_views \
|
||||
ivatar.test_auxiliary \
|
||||
ivatar.test_file_security \
|
||||
ivatar.test_static_pages \
|
||||
ivatar.test_utils \
|
||||
ivatar.test_views \
|
||||
ivatar.test_views_stats \
|
||||
ivatar.tools.test_views \
|
||||
ivatar.test_wsgi \
|
||||
-v3
|
||||
--exclude-tag=bluesky \
|
||||
-v2
|
||||
|
||||
echo ""
|
||||
echo "To run all tests including Bluesky (requires API credentials):"
|
||||
@@ -30,8 +22,7 @@ echo ""
|
||||
echo "To run only Bluesky tests:"
|
||||
echo "python3 manage.py test ivatar.ivataraccount.test_views_bluesky -v3"
|
||||
echo ""
|
||||
echo "To run tests with OpenTelemetry enabled:"
|
||||
echo "./run_tests_with_ot.sh"
|
||||
echo "To run tests with OpenTelemetry export enabled:"
|
||||
echo "OTEL_EXPORT_ENABLED=true python3 manage.py test -v2"
|
||||
echo ""
|
||||
echo "To run tests without OpenTelemetry (default):"
|
||||
echo "./run_tests_no_ot.sh"
|
||||
echo "Note: OpenTelemetry instrumentation is always enabled. Only export is controlled by OTEL_EXPORT_ENABLED."
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
#!/bin/bash
|
||||
# Run tests without OpenTelemetry enabled (default mode)
|
||||
# Run tests with OpenTelemetry instrumentation enabled but export disabled
|
||||
# This is the default test mode for most users
|
||||
|
||||
set -e
|
||||
|
||||
echo "Running tests without OpenTelemetry (default mode)..."
|
||||
echo "====================================================="
|
||||
echo "Running tests with OpenTelemetry instrumentation (export disabled)..."
|
||||
echo "===================================================================="
|
||||
|
||||
# Ensure OpenTelemetry is disabled
|
||||
export ENABLE_OPENTELEMETRY=false
|
||||
export OTEL_ENABLED=false
|
||||
# OpenTelemetry instrumentation is always enabled, but disable export for testing
|
||||
export OTEL_EXPORT_ENABLED=false
|
||||
export OTEL_SERVICE_NAME=ivatar-test
|
||||
export OTEL_ENVIRONMENT=test
|
||||
|
||||
# Run Django tests (Django will auto-discover all tests)
|
||||
python3 manage.py test -v3
|
||||
|
||||
echo ""
|
||||
echo "Tests completed successfully (OpenTelemetry disabled)"
|
||||
echo "Tests completed successfully (OpenTelemetry instrumentation enabled, export disabled)"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Run tests with OpenTelemetry enabled and coverage measurement.
|
||||
Run tests with OpenTelemetry instrumentation and export enabled, plus coverage measurement.
|
||||
This script is designed to be used with 'coverage run' command.
|
||||
"""
|
||||
|
||||
@@ -13,14 +13,13 @@ from django.test.utils import get_runner
|
||||
|
||||
|
||||
def main():
|
||||
# Enable OpenTelemetry
|
||||
os.environ["ENABLE_OPENTELEMETRY"] = "true"
|
||||
os.environ["OTEL_ENABLED"] = "true"
|
||||
# Enable OpenTelemetry instrumentation and export
|
||||
os.environ["OTEL_EXPORT_ENABLED"] = "true"
|
||||
os.environ["OTEL_SERVICE_NAME"] = "ivatar-test"
|
||||
os.environ["OTEL_ENVIRONMENT"] = "test"
|
||||
|
||||
print("Running tests with OpenTelemetry enabled...")
|
||||
print("==========================================")
|
||||
print("Running tests with OpenTelemetry instrumentation and export enabled...")
|
||||
print("====================================================================")
|
||||
|
||||
# Add current directory to Python path
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
@@ -41,7 +40,9 @@ def main():
|
||||
return 1
|
||||
else:
|
||||
print("")
|
||||
print("Tests completed successfully (OpenTelemetry enabled)")
|
||||
print(
|
||||
"Tests completed successfully (OpenTelemetry instrumentation and export enabled)"
|
||||
)
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Run tests with OpenTelemetry enabled
|
||||
# Run tests with OpenTelemetry instrumentation and export enabled
|
||||
# This is used in CI to test OpenTelemetry functionality
|
||||
|
||||
set -e
|
||||
|
||||
echo "Running tests with OpenTelemetry enabled..."
|
||||
echo "=========================================="
|
||||
echo "Running tests with OpenTelemetry instrumentation and export enabled..."
|
||||
echo "===================================================================="
|
||||
|
||||
# Enable OpenTelemetry
|
||||
export ENABLE_OPENTELEMETRY=true
|
||||
export OTEL_ENABLED=true
|
||||
# Enable OpenTelemetry instrumentation and export
|
||||
export OTEL_EXPORT_ENABLED=true
|
||||
export OTEL_SERVICE_NAME=ivatar-test
|
||||
export OTEL_ENVIRONMENT=test
|
||||
|
||||
@@ -17,4 +16,4 @@ export OTEL_ENVIRONMENT=test
|
||||
python3 manage.py test -v3
|
||||
|
||||
echo ""
|
||||
echo "Tests completed successfully (OpenTelemetry enabled)"
|
||||
echo "Tests completed successfully (OpenTelemetry instrumentation and export enabled)"
|
||||
|
||||
Reference in New Issue
Block a user