Langfuse
To send OpenTelemetry traces generated by Shield360 from your AI Application to Langfuse, follow the below steps.
Langfuse is an OpenTelemetry backend that supports native trace ingestion from OpenTelemetry instrumentation libraries like Shield360.
1. Get your Credentials
- Sign up at Langfuse: Go to Langfuse Cloud or deploy Langfuse self-hosted
- Get your Project Keys:
- Public Key: Your Langfuse public key (starts with
pk-lf-) - Secret Key: Your Langfuse secret key (starts with
sk-lf-)
- Public Key: Your Langfuse public key (starts with
- Choose your data region:
- EU Region:
https://cloud.langfuse.com/api/public/otel - US Region:
https://us.cloud.langfuse.com/api/public/otel - Self-hosted:
https://your-langfuse-instance.com/api/public/otel
- EU Region:
Save these credentials - you’ll need them for authentication.
2. Instrument your application
For direct integration into your Python applications:
import shield360import base64
# Create Base64 encoded auth headerLANGFUSE_PUBLIC_KEY = "pk-lf-..."LANGFUSE_SECRET_KEY = "sk-lf-..."LANGFUSE_AUTH = base64.b64encode(f"{LANGFUSE_PUBLIC_KEY}:{LANGFUSE_SECRET_KEY}".encode()).decode()
shield360.init( otlp_endpoint="https://cloud.langfuse.com/api/public/otel", otlp_headers=f"Authorization=Basic {LANGFUSE_AUTH}", disable_batch=True # Process traces immediately for better Langfuse integration)Replace:
LANGFUSE_PUBLIC_KEYwith your Langfuse public key from Step 1.LANGFUSE_SECRET_KEYwith your Langfuse secret key from Step 1.- Update the endpoint for your region:
- EU:
https://cloud.langfuse.com/api/public/otel - US:
https://us.cloud.langfuse.com/api/public/otel - Self-hosted:
https://your-langfuse-instance.com/api/public/otel
- EU:
import shield360
shield360.init()Set these environment variables:
# Create Base64 encoded auth (replace with your actual keys)export LANGFUSE_PUBLIC_KEY="pk-lf-..."export LANGFUSE_SECRET_KEY="sk-lf-..."export LANGFUSE_AUTH=$(echo -n "$LANGFUSE_PUBLIC_KEY:$LANGFUSE_SECRET_KEY" | base64)
# Configure OpenTelemetryexport OTEL_EXPORTER_OTLP_ENDPOINT="https://cloud.langfuse.com/api/public/otel"export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic $LANGFUSE_AUTH"export OTEL_SERVICE_NAME="my-ai-service"export OTEL_DEPLOYMENT_ENVIRONMENT="production"Replace:
LANGFUSE_PUBLIC_KEYandLANGFUSE_SECRET_KEYwith your actual keys.- Update the endpoint for your region as needed.
Refer to the Shield360 SDK configuration reference for more advanced configurations and use cases.
For zero-code auto-instrumentation via command line:
# Create Base64 encoded auth (replace with your actual keys)export LANGFUSE_PUBLIC_KEY="pk-lf-..."export LANGFUSE_SECRET_KEY="sk-lf-..."export LANGFUSE_AUTH=$(echo -n "$LANGFUSE_PUBLIC_KEY:$LANGFUSE_SECRET_KEY" | base64)
# Using CLI argumentsshield360-instrument \ --otlp-endpoint "https://cloud.langfuse.com/api/public/otel" \ --otlp-headers "Authorization=Basic $LANGFUSE_AUTH" \ --service-name "my-ai-service" \ --deployment-environment "production" \ --disable-batch \ python app.pyReplace:
LANGFUSE_PUBLIC_KEYandLANGFUSE_SECRET_KEYwith your actual keys.- Update the endpoint for your region as needed.
# Create Base64 encoded auth (replace with your actual keys)export LANGFUSE_PUBLIC_KEY="pk-lf-..."export LANGFUSE_SECRET_KEY="sk-lf-..."export LANGFUSE_AUTH=$(echo -n "$LANGFUSE_PUBLIC_KEY:$LANGFUSE_SECRET_KEY" | base64)
# Set environment variables (takes precedence over CLI args)export OTEL_EXPORTER_OTLP_ENDPOINT="https://cloud.langfuse.com/api/public/otel"export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic $LANGFUSE_AUTH"export OTEL_SERVICE_NAME="my-ai-service"export OTEL_DEPLOYMENT_ENVIRONMENT="production"
# Run your applicationshield360-instrument python app.pyReplace:
LANGFUSE_PUBLIC_KEYandLANGFUSE_SECRET_KEYwith your actual keys.- Update the endpoint for your region as needed.
Refer to the Shield360 SDK configuration reference for more advanced configurations and use cases.
3. Visualize in Langfuse
Once your LLM application is instrumented, you can explore the telemetry data in Langfuse:
- Navigate to Langfuse: Go to your Langfuse Dashboard (or your self-hosted instance)
- Explore Traces: Click on Traces in the sidebar to view your AI application traces
- View Detailed Traces: Each trace includes:
- LLM requests with detailed timing and token usage
- Model performance analytics and latency metrics
- Request/response payloads for debugging
- Cost tracking and token consumption
- Hierarchical spans showing the complete request flow
- Sessions and Users: Link traces to user sessions for comprehensive observability
- Datasets and Evaluations: Use Langfuse’s evaluation features to assess model performance
- Analytics Dashboard: Monitor trends, costs, and performance over time

Example: You can view this sample trace to see how Shield360 traces appear in Langfuse.
Your Shield360-instrumented AI applications will appear automatically in Langfuse with comprehensive observability including LLM costs, token usage, model performance, and detailed execution traces with full context and debugging capabilities.