I recently started trialing Sentry and was seriously impressed with it. However, I had an issue where the number of performance events being sent to Sentry was enormous and with only testing by me and my three colleagues, we were generating in excess of 10, 000 events a day. Of course, there were some scanning events from random internet addresses and the like, but they were not responsible for the lion’s share of performance data.
Whilst the performance data is fantastic to have access to, it would have cost us a small fortune just to have the four of us on our platform, never mind the 70 users who have recently started using the platform.
Is there anyone here who is very familiar with Sentry and Django and perhaps knows how to use Sentry to ensure that one can stick to 100 000 performance data within a month?
Or perhaps it is the case that something seems off? Or perhaps I’m doing something wrong?
At the moment we have an income of precisely $0 and we don’t expect this to change until semester start after the European summer holidays.
Below you can find an example of the Sentry configuration I had.
Any ideas and advice is greatly appreciated.
Cheers,
C
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
sentry_key = os.environ.get("SENTRY_KEY", None)
SENTRY_DSN = <hidden>
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[DjangoIntegration()],
traces_sample_rate=1.0,
# If you wish to associate users to errors (assuming you are using
# django.contrib.auth) you may enable sending PII data.
send_default_pii=True,
sample_rate=0.2 # send 20% of performance events
)
RAVEN_CONFIG = {
"dsn": SENTRY_DSN,
}
# logging
LOGGING_CONFIG = None
logging.config.dictConfig(
{
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"console": {
# exact format is not important, this is the minimum information
"format": "%(asctime)s %(name)-12s %(levelname)-8s %(message)s",
},
},
"handlers": {
"sentry": {
"level": "INFO", # To capture more than ERROR, change to WARNING, INFO, etc.
"class": "raven.contrib.django.raven_compat.handlers.SentryHandler",
"tags": {"custom-tag": "x"},
},
"console": {"level": "DEBUG", "class": "logging.StreamHandler", "formatter": "console"},
},
"loggers": {
# root logger
"": {"level": "ERROR", "handlers": ["console"]},
"config": {
"level": "ERROR",
"handlers": ["console"],
# required to avoid double logging with root logger
"propagate": False,
},
"raven": {"level": "DEBUG", "handlers": ["console"], "propagate": False},
"sentry.errors": {"level": "DEBUG", "handlers": ["console"], "propagate": False},
"populator": {
"level": "INFO",
"handlers": ["console"],
# required to avoid double logging with root logger
"propagate": False,
},
},
}
)