From lisa-rails
Verify OpenTelemetry traces are being collected and exported to AWS X-Ray for Rails applications. Check collector health, trace export, and CloudWatch metrics.
npx claudepluginhub codyswanngt/lisa --plugin lisa-railsThis skill is limited to using the following tools:
Verify OpenTelemetry traces are being collected and exported to X-Ray.
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Verify OpenTelemetry traces are being collected and exported to X-Ray.
Argument: $ARGUMENTS — check type (traces, metrics, all; default: all)
Gemfile for OpenTelemetry gem configuration:
opentelemetry-sdkopentelemetry-exporter-otlpopentelemetry-instrumentation-all (or individual instrumentation gems)config/initializers/opentelemetry.rb (or similar) for SDK configurationconfig/deploy.yml or environment files for OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_SERVICE_NAMEdocker-compose.yml for OpenTelemetry Collector sidecar configuration (if present)bundle list | grep -i opentelemetry
grep -r "OpenTelemetry" config/initializers/ app/
echo "OTEL_EXPORTER_OTLP_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT:-not set}"
echo "OTEL_SERVICE_NAME=${OTEL_SERVICE_NAME:-not set}"
Make a request to the local app and check that traces are produced:
# Make a request that should generate a trace
curl -sf http://localhost:3000/up -w "\nHTTP %{http_code}\n"
# Check Rails logs for OpenTelemetry output (if configured to log)
grep -i "otel\|opentelemetry\|trace_id" log/development.log | tail -10
docker compose logs otel-collector 2>/dev/null | tail -20 || echo "No otel-collector service in Docker Compose"
aws xray get-trace-summaries \
--region {aws-region} \
--start-time $(ruby -r time -e 'puts (Time.now.utc - 30 * 60).iso8601') \
--end-time $(ruby -r time -e 'puts Time.now.utc.iso8601') \
--query 'TraceSummaries | length(@)' \
--output text
aws xray get-trace-summaries \
--region {aws-region} \
--start-time $(ruby -r time -e 'puts (Time.now.utc - 30 * 60).iso8601') \
--end-time $(ruby -r time -e 'puts Time.now.utc.iso8601') \
--filter-expression "service(\"{service-name}\")" \
--query 'TraceSummaries[:10].{TraceId:Id,Duration:Duration,StatusCode:Http.HttpStatus,URL:Http.HttpURL,ResponseTime:ResponseTime}' \
--output table
aws xray get-trace-summaries \
--region {aws-region} \
--start-time $(ruby -r time -e 'puts (Time.now.utc - 3600).iso8601') \
--end-time $(ruby -r time -e 'puts Time.now.utc.iso8601') \
--filter-expression "service(\"{service-name}\") AND fault = true" \
--query 'TraceSummaries[:10].{TraceId:Id,Duration:Duration,StatusCode:Http.HttpStatus,URL:Http.HttpURL}' \
--output table
aws xray batch-get-traces \
--region {aws-region} \
--trace-ids "{trace-id}" \
--query 'Traces[0].Segments[].Document' \
--output text | jq '.'
aws xray get-service-graph \
--region {aws-region} \
--start-time $(ruby -r time -e 'puts (Time.now.utc - 3600).iso8601') \
--end-time $(ruby -r time -e 'puts Time.now.utc.iso8601') \
--query 'Services[].{Name:Name,Type:Type,Edges:Edges[].{Ref:ReferenceId,Latency:ResponseTimeHistogram[0].Average}}' \
--output table
aws cloudwatch list-metrics \
--region {aws-region} \
--namespace "{app_name}" \
--query 'Metrics[].{MetricName:MetricName,Dimensions:Dimensions[].{Name:Name,Value:Value}}' \
--output table
aws cloudwatch get-metric-statistics \
--region {aws-region} \
--namespace "{app_name}" \
--metric-name "{metric-name}" \
--start-time $(ruby -r time -e 'puts (Time.now.utc - 3600).iso8601') \
--end-time $(ruby -r time -e 'puts Time.now.utc.iso8601') \
--period 300 \
--statistics Average Sum \
--output table
aws cloudwatch describe-alarms \
--region {aws-region} \
--alarm-name-prefix "{app_name}" \
--query 'MetricAlarms[].{Name:AlarmName,State:StateValue,Metric:MetricName,Threshold:Threshold}' \
--output table
For checking telemetry configuration in deployed environments:
kamal app exec --roles=web "bin/rails runner \"
puts 'OTEL_EXPORTER_OTLP_ENDPOINT: ' + ENV.fetch('OTEL_EXPORTER_OTLP_ENDPOINT', 'NOT SET')
puts 'OTEL_SERVICE_NAME: ' + ENV.fetch('OTEL_SERVICE_NAME', 'NOT SET')
puts 'OTEL_TRACES_EXPORTER: ' + ENV.fetch('OTEL_TRACES_EXPORTER', 'NOT SET')
\"" -d {environment}
| Check | Status | Details |
|---|---|---|
| OTel gems installed | OK/FAIL | opentelemetry-sdk v1.x.x |
| OTel initializer present | OK/FAIL | config/initializers/opentelemetry.rb |
| OTLP endpoint configured | OK/FAIL | https://otel-collector:4318 |
| Traces in X-Ray (last 30m) | OK/FAIL | 245 traces found |
| Error traces (last 1h) | OK/WARN | 3 fault traces |
| CloudWatch metrics | OK/FAIL | 12 custom metrics published |
| CloudWatch alarms | OK/WARN | 1 alarm in ALARM state |
| Trace ID | Duration | Status | URL |
|---|---|---|---|
| 1-abc123 | 45ms | 200 | GET /up |
| 1-def456 | 120ms | 200 | GET /api/v1/users |
| 1-ghi789 | 2300ms | 500 | POST /api/v1/orders |
Flag concerns: