Validating credentials (integration health-check)

Is there an API call that can be done to validate credentials with the sentry server without sending an event?

In our application, we implement basic health-checks against all our 3th party integrations using django-health-check for django apps and Spring actuator for spring java apps.

We monitor the health-check page so we can detect if any of our API keys expired or if a service provider is having issues.

We also monitor that all the integrations are working before promoting a new release to production.

Is there a basic “ping” API that validates the credentials: SENTRY_IO_KEY, SENTRY_IO_SECRET, SENTRY_IO_PROJECT are a valid combination?

It would be possible to use the main function in raven.scripts.runner. This will exit with a status of 1 if something goes wrong sending a test message.

If you would rather raise an exception, you could also do something like:

import logging
import os
from raven import Client
from raven.scripts.runner import send_test_message

def test_availability():
  dsn = os.environ.get('SENTRY_DSN')
  if not dsn:
    raise Exception('Error: No configuration detected!')

  client = Client(dsn, include_paths=['raven'])

  send_test_message(client, {})
  if client.state.did_fail():
    raise Exception('Error sending message to')

Disclaimer: I did not test this at all.


I will have this tested and I’ll get back to you.

@cedric Did you get a chance to test this? I’m curious if this is sufficient test to make sure an application is able to communicate with after every deploy.