Appearance
To send OpenTelemetry metrics and traces generated by ARMS from your AI Application to Middleware, follow the below steps.
1. Get your Credentials
Sign in to your Middleware account: Go to Middleware Dashboard
Navigate to API Keys: Go to Settings → API Keys (Direct Link)
Copy your credentials:
- MW_API_KEY: Your Middleware API key for authentication
- MW_TARGET: Your Middleware target URL endpoint
Save these values - you'll need them for configuration.
2. Instrument your application
SDK
For direct integration into your Python applications:
Function Arguments
python
import elsai_arms
elsai_arms.init(
otlp_endpoint="MW_TARGET",
application_name="YOUR_APPLICATION_NAME",
otlp_headers={
"Authorization": "MW_API_KEY",
"X-Trace-Source": "elsai-arms",
}
)Replace:
MW_TARGETwith your Middleware target URL from Step 1.- Example:
https://abcd.middleware.io:443
- Example:
MW_API_KEYwith your Middleware API key from Step 1.- Example:
dxyxsdojzrgpsvizzzcsvhrwnmzqdsdsd
- Example:
YOUR_APPLICATION_NAMEwith your application name.
Environment Variables
python
import elsai_arms
elsai_arms.init()Set these environment variables:
shell
export OTEL_EXPORTER_OTLP_ENDPOINT="MW_TARGET"
export OTEL_SERVICE_NAME="YOUR_APPLICATION_NAME"
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=MW_API_KEY,X-Trace-Source=elsai-arms"Replace:
MW_TARGETwith your Middleware target URL from Step 1.- Example:
https://abcd.middleware.io:443
- Example:
MW_API_KEYwith your Middleware API key from Step 1.- Example:
dxyxsdojzrgpsvizzzcsvhrwnmzqdsdsd
- Example:
YOUR_APPLICATION_NAMEwith your application name.
See the ARMS SDK configuration docs for more advanced options.
CLI
For zero-code auto-instrumentation via command line:
CLI Arguments
shell
# Using CLI arguments
elsai-arms-instrument \
--otlp-endpoint "MW_TARGET" \
--otlp-headers "Authorization=MW_API_KEY,X-Trace-Source=elsai-arms" \
--service-name "YOUR_APPLICATION_NAME" \
--deployment-environment "production" \
python app.pyReplace:
MW_TARGETwith your Middleware target URL from Step 1.- Example:
https://abcd.middleware.io:443
- Example:
MW_API_KEYwith your Middleware API key from Step 1.- Example:
dxyxsdojzrgpsvizzzcsvhrwnmzqdsdsd
- Example:
YOUR_APPLICATION_NAMEwith your application name.
Environment Variables
shell
# Set environment variables (takes precedence over CLI args)
export OTEL_EXPORTER_OTLP_ENDPOINT="MW_TARGET"
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=MW_API_KEY,X-Trace-Source=elsai-arms"
export OTEL_SERVICE_NAME="YOUR_APPLICATION_NAME"
export OTEL_DEPLOYMENT_ENVIRONMENT="production"
# Run your application
elsai-arms-instrument python app.pyReplace:
MW_TARGETwith your Middleware target URL from Step 1.- Example:
https://abcd.middleware.io:443
- Example:
MW_API_KEYwith your Middleware API key from Step 1.- Example:
dxyxsdojzrgpsvizzzcsvhrwnmzqdsdsd
- Example:
YOUR_APPLICATION_NAMEwith your application name.
See the ARMS SDK configuration docs for more advanced options.
3. Visualize in Middleware
Once your LLM application is instrumented, you can explore the telemetry data in Middleware:
- Navigate to LLM Observability: Go to your Middleware Dashboard and click on LLM Observability in the sidebar
- Explore AI Operations: View your AI application traces including:
- LLM request traces with detailed timing
- Token usage and cost information
- Vector database operations
- Model performance analytics
- Request/response payloads (if enabled)
- Custom Dashboards: Create custom dashboards for your specific LLM metrics
- Alerting: Set up alerts for LLM performance anomalies and cost thresholds
- Performance Analysis: Analyze latency, throughput, and resource usage patterns
For detailed information on LLM Observability features, consult the Middleware LLM Observability Documentation.