Update monitoring packages to latest versions
- Updated all OpenTelemetry packages to latest versions: - opentelemetry-api: 1.27.0 → 1.39.1 - opentelemetry-sdk: 1.27.0 → 1.39.1 - opentelemetry-exporter-otlp-proto-grpc: 1.27.0 → 1.39.1 - opentelemetry-exporter-otlp-proto-http: 1.27.0 → 1.39.1 - opentelemetry-instrumentation-fastapi: 0.48b0 → 0.60b1 - opentelemetry-instrumentation-httpx: 0.48b0 → 0.60b1 - opentelemetry-instrumentation-redis: 0.48b0 → 0.60b1 - opentelemetry-instrumentation-sqlalchemy: 0.48b0 → 0.60b1 - Removed prometheus-client==0.23.1 from all services - Unified all services to use the same monitoring package versions Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
94
infrastructure/kubernetes/add-monitoring-config.sh
Executable file
94
infrastructure/kubernetes/add-monitoring-config.sh
Executable file
@@ -0,0 +1,94 @@
|
||||
#!/bin/bash
|
||||
# Script to add OpenTelemetry monitoring configuration to all service deployments
|
||||
# This adds the necessary environment variables for SigNoz integration
|
||||
# Note: No Prometheus annotations needed - all metrics go via OTLP push
|
||||
|
||||
set -e
|
||||
|
||||
SERVICES=(
|
||||
"ai-insights"
|
||||
"distribution"
|
||||
"external"
|
||||
"forecasting"
|
||||
"inventory"
|
||||
"notification"
|
||||
"orchestrator"
|
||||
"orders"
|
||||
"pos"
|
||||
"procurement"
|
||||
"production"
|
||||
"recipes"
|
||||
"sales"
|
||||
"suppliers"
|
||||
"tenant"
|
||||
"training"
|
||||
"frontend"
|
||||
)
|
||||
|
||||
echo "Adding OpenTelemetry configuration to all services..."
|
||||
echo ""
|
||||
|
||||
for service in "${SERVICES[@]}"; do
|
||||
SERVICE_FILE="infrastructure/kubernetes/base/components/${service}/${service}-service.yaml"
|
||||
|
||||
if [ ! -f "$SERVICE_FILE" ]; then
|
||||
echo "⚠️ Skipping $service (file not found: $SERVICE_FILE)"
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "📝 Processing $service-service..."
|
||||
|
||||
# Check if already has OTEL env vars
|
||||
if grep -q "OTEL_COLLECTOR_ENDPOINT" "$SERVICE_FILE"; then
|
||||
echo " ✓ Already has OpenTelemetry configuration"
|
||||
else
|
||||
echo " + Adding OpenTelemetry environment variables"
|
||||
# Create a YAML patch
|
||||
cat > "/tmp/${service}-otel-patch.yaml" << 'EOF'
|
||||
env:
|
||||
# OpenTelemetry Configuration
|
||||
- name: OTEL_COLLECTOR_ENDPOINT
|
||||
value: "http://signoz-otel-collector.signoz.svc.cluster.local:4318"
|
||||
- name: OTEL_EXPORTER_OTLP_ENDPOINT
|
||||
value: "http://signoz-otel-collector.signoz.svc.cluster.local:4318"
|
||||
- name: OTEL_SERVICE_NAME
|
||||
value: "SERVICE_NAME_PLACEHOLDER"
|
||||
- name: ENABLE_TRACING
|
||||
value: "true"
|
||||
# Logging Configuration
|
||||
- name: OTEL_LOGS_EXPORTER
|
||||
value: "otlp"
|
||||
- name: OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED
|
||||
value: "true"
|
||||
# Metrics Configuration (all via OTLP, no Prometheus)
|
||||
- name: ENABLE_OTEL_METRICS
|
||||
value: "true"
|
||||
- name: ENABLE_SYSTEM_METRICS
|
||||
value: "true"
|
||||
EOF
|
||||
# Replace placeholder with actual service name
|
||||
sed -i.bak "s/SERVICE_NAME_PLACEHOLDER/${service}-service/g" "/tmp/${service}-otel-patch.yaml"
|
||||
|
||||
echo " ⚠️ Manual step required: Add env vars from /tmp/${service}-otel-patch.yaml"
|
||||
echo " Insert after 'ports:' section and before 'envFrom:' in $SERVICE_FILE"
|
||||
fi
|
||||
|
||||
echo " ✅ $service-service processed"
|
||||
echo ""
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "✅ Monitoring configuration prepared for all services!"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Review the changes and manually add env vars from /tmp/*-otel-patch.yaml files"
|
||||
echo "2. Update SigNoz: helm upgrade signoz signoz/signoz -n signoz -f infrastructure/helm/signoz-values-dev.yaml"
|
||||
echo "3. Restart services: kubectl rollout restart deployment -n bakery-ia"
|
||||
echo "4. Check SigNoz UI at https://monitoring.bakery-ia.local for incoming data"
|
||||
echo ""
|
||||
echo "What metrics you'll see:"
|
||||
echo " - HTTP requests (method, endpoint, status code, duration)"
|
||||
echo " - System metrics (CPU, memory usage per process)"
|
||||
echo " - System-wide metrics (total CPU, memory, disk I/O, network I/O)"
|
||||
echo " - Custom business metrics (registrations, orders, etc.)"
|
||||
echo " - All pushed via OpenTelemetry OTLP (no Prometheus scraping)"
|
||||
Reference in New Issue
Block a user