Skip to content

fix(docker): disable guardrails-ai hub telemetry - #178

Closed
vprashrex wants to merge 1 commit into
mainfrom
fix/disable-guardrails-hub-telemetry
Closed

vprashrex wants to merge 1 commit into
mainfrom
fix/disable-guardrails-hub-telemetry

Conversation

@vprashrex

@vprashrex vprashrex commented Oct 29, 2026 •

Copy link
Copy Markdown

Summary

Target issue is #177

Every POST /api/v1/guardrails/ request produced a Sentry error (KAAPI-PRODUCTION-24, logger opentelemetry.exporter.otlp.proto.http.trace_exporter): Failed to export span batch due to timeout, max retries or shutdown.

The exporter is not ours. It is the guardrails-ai library's own hub telemetry (HubTelemetry in guardrails/utils/hub_telemetry_utils.py), which sends spans to a hardcoded vendor collector (hty0gc1ok3.execute-api.us-east-1.amazonaws.com) that no longer resolves. It runs whenever settings.rc.enable_metrics is truthy, and RC defaults that to True when ~/.guardrailsrc is missing. Our image never writes that file.

This PR writes enable_metrics=false to /root/.guardrailsrc in backend/Dockerfile (the container runs as root, so ~ is /root). No outbound telemetry goes to the vendor, and our own Sentry/OTel setup in app/core/telemetry.py is unaffected.

Checklist

Before submitting a pull request, please ensure that you mark these task.

  • Ran fastapi run --reload app/main.py or docker compose up in the repository root and test.
  • If you've fixed a bug or added code that is tested and has test cases.

Notes

  • Not yet built or run locally; the image change is one RUN line. After deploy, verify:
    docker exec kaapi-guardrails-backend python -c "from guardrails.settings import settings; print(settings.rc.enable_metrics)"
    # expect: False
  • Second point in Backend: Disable Guardrails hub telemetry #177, not fixed by this PR: production events are tagged environment=development while the caller's baggage says production. telemetry.py sends settings.ENVIRONMENT, so this is a host config issue. ENVIRONMENT on the production host's env file must be production (already listed in deployment.md). Until then, Sentry's production environment filter hides this service's traces.

guardrails-ai defaults enable_metrics=True when ~/.guardrailsrc is absent
and exports spans to a vendor collector that no longer resolves, flooding
Sentry with 'Failed to export span batch' errors on /api/v1/guardrails/.
Write enable_metrics=false into the image.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@vprashrex vprashrex added the bug Something isn't working label Oct 29, 2026
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1
  • ready-for-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vprashrex vprashrex self-assigned this Oct 29, 2026
@vprashrex vprashrex closed this Oct 29, 2026
@vprashrex
vprashrex deleted the fix/disable-guardrails-hub-telemetry branch October 29, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant