Prometheus + Tempo


To send OpenTelemetry metrics and traces generated by Shield360 from your AI Application to Prometheus and Grafana Tempo, follow the below steps.
1. Configure OpenTelemetry Collector
Prometheus + Tempo requires an OpenTelemetry Collector to route metrics to Prometheus and traces to Tempo.
Install OpenTelemetry Collector (if not already running)
For detailed installation instructions, refer to the OpenTelemetry Collector Documentation.
Configure the Collector
- Configure OTLP Receiver: Set up receiver on
0.0.0.0:4318for HTTP and0.0.0.0:4317for gRPC. - Define Exporters:
prometheusremotewritefor metrics → Prometheusotlpfor traces → Tempo
- Assign to Pipelines: Route metrics and traces to appropriate backends.
Complete Collector Configuration
receivers: otlp: protocols: grpc: endpoint: 0.0.0.0:4317 http: endpoint: 0.0.0.0:4318
processors: batch: memory_limiter: # 80% of maximum memory up to 2G limit_mib: 1500 # 25% of limit up to 2G spike_limit_mib: 512 check_interval: 5s
exporters: prometheusremotewrite: endpoint: "YOUR_PROMETHEUS_REMOTE_WRITE_URL" add_metric_suffixes: false otlp: endpoint: "YOUR_TEMPO_URL"
service: pipelines: traces: receivers: [ otlp ] processors: [ memory_limiter, batch ] exporters: [ otlp ] metrics: receivers: [ otlp ] processors: [ memory_limiter, batch ] exporters: [ prometheusremotewrite ]Replace:
YOUR_PROMETHEUS_REMOTE_WRITE_URLwith your Prometheus remote write endpoint.- Example:
https://prometheus.grafana.net/api/prom/push
- Example:
YOUR_TEMPO_URLwith your Tempo endpoint.- Example:
tempo.grafana.net:443
- Example:
2. Instrument your application
For direct integration into your Python applications:
import shield360
shield360.init( otlp_endpoint="YOUR_OTELCOL_URL:4318")Replace:
YOUR_OTELCOL_URL:4318with the HTTP endpoint of your OpenTelemetry Collector.- Example:
http://127.0.0.1:4318(for local collector) - Example:
http://otel-collector.monitoring.svc.cluster.local:4318(for Kubernetes)
- Example:
import shield360
shield360.init()Set these environment variables:
export OTEL_EXPORTER_OTLP_ENDPOINT="YOUR_OTELCOL_URL:4318"Replace:
YOUR_OTELCOL_URL:4318with the HTTP endpoint of your OpenTelemetry Collector.- Example:
http://127.0.0.1:4318(for local collector) - Example:
http://otel-collector.monitoring.svc.cluster.local:4318(for Kubernetes)
- Example:
Refer to the Shield360 SDK configuration reference for more advanced configurations and use cases.
For zero-code auto-instrumentation via command line:
# Using CLI argumentsshield360-instrument \ --otlp-endpoint "YOUR_OTELCOL_URL:4318" \ --service-name "my-ai-service" \ --deployment-environment "production" \ python app.pyReplace:
YOUR_OTELCOL_URL:4318with the HTTP endpoint of your OpenTelemetry Collector.- Example:
http://127.0.0.1:4318(for local collector) - Example:
http://otel-collector.monitoring.svc.cluster.local:4318(for Kubernetes)
- Example:
# Set environment variables (takes precedence over CLI args)export OTEL_EXPORTER_OTLP_ENDPOINT="YOUR_OTELCOL_URL:4318"export OTEL_SERVICE_NAME="my-ai-service"export OTEL_DEPLOYMENT_ENVIRONMENT="production"
# Run your applicationshield360-instrument python app.pyReplace:
YOUR_OTELCOL_URL:4318with the HTTP endpoint of your OpenTelemetry Collector.- Example:
http://127.0.0.1:4318(for local collector) - Example:
http://otel-collector.monitoring.svc.cluster.local:4318(for Kubernetes)
- Example:
Refer to the Shield360 SDK configuration reference for more advanced configurations and use cases.
3. Import the pre-built Dashboard
- Log into your Grafana Instance. To install Grafana, refer to the Official documentation.
- Add Data Sources: Make sure Prometheus and Tempo are added as data sources in Grafana. To add a new data source, follow the steps in the Official documentation.
- Click Dashboards in the primary menu.
- Click New and select Import in the drop-down menu.
- Copy the dashboard JSONs provided in the offical Grafana AI Observability repository
- Paste the dashboard JSONs one by one directly into the text area.
- Click Import.
- Save the dashboard.