Skip to content

Commit 94124b0

Browse files
authored
docs(self-hosted): monitor self-hosted instance (#12660)
We don't have any good article or explanation on how to monitor self-hosted Sentry. "Monitoring self-hosted Sentry" means 3 things: 1. Monitor the actual services made by Sentry (sentry, snuba, symbolicator, relay) by using Statsd 2. Monitor the dependencies (Kafka, Postgres, etc) by using Prometheus exporters, or similar things 3. Monitor the host machine or Docker daemon ## LEGAL BOILERPLATE Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
1 parent 3a2ec23 commit 94124b0

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
title: Self-Hosted Monitoring
3+
sidebar_title: Monitoring
4+
sidebar_order: 10
5+
---
6+
7+
<Alert title="Important" level="warning">
8+
These are community-contributed docs. Sentry does not officially provide support for self-hosted configurations beyond the default install.
9+
</Alert>
10+
11+
This page is considered experimental because everyone will have different setup and requirements for their monitoring system. It is also best to use your existing monitoring system, and try to integrate Sentry with it, instead of spinning up a new one.
12+
13+
Most containers have a `statsd` client that you can point to your monitoring system. If you have a native `statsd` server instance, you can directly use it. If you don't, you might want to add some kind of converter that converts the ingested `statsd` format into your own. For example, if you are using Prometheus, you can use [prometheus-statsd-exporter](https://github.com/prometheus/statsd_exporter) to bridge the gap.
14+
15+
If you are using DataDog as your monitoring system, it is recommended to use [DogStatsD](https://docs.datadoghq.com/developers/dogstatsd/?tab=hostagent) as the collector.
16+
17+
We recommend [the original `statsd` server made by Etsy](https://github.com/statsd/statsd) or the others on the [server re-implementations](https://github.com/statsd/statsd/blob/master/docs/server_implementations.md).
18+
19+
Sentry does not provide any alerts if your host instance is low on resources such as free memory or disk space. You will need to configure this own your own relative to your needs. It is critical for you to monitor the disk space as once it gets full, it will be much harder to recover from there.
20+
21+
<Alert title="Note">
22+
After changing configuration files, don't forget to restart the containers with `docker compose restart`. See the <Link to="/self-hosted/#configuration">configuration section</Link> for more information.
23+
</Alert>
24+
25+
## Sentry-related configurations
26+
27+
This documentation assumes `100.100.123.123` as your statsd host IP address. On most services, it is recommended to provide an IP address for the host like this, instead of a domain name like `statsd.yourcompany.com`.
28+
29+
### Sentry
30+
31+
You can configure Sentry to send metrics to Statsd server by configuring your `sentry/sentry.conf.py` file:
32+
33+
```python
34+
SENTRY_METRICS_BACKEND = 'sentry.metrics.statsd.StatsdMetricsBackend'
35+
SENTRY_METRICS_OPTIONS: dict[str, Any] = {
36+
'host': '100.100.123.123', # It's recommended to use IP address instead of domain name
37+
'port': 8125,
38+
}
39+
# SENTRY_METRICS_SAMPLE_RATE = 1.0 # Adjust this to your needs, default is 1.0
40+
# SENTRY_METRICS_PREFIX = "sentry." # Adjust this to your needs, default is "sentry."
41+
```
42+
43+
### Snuba
44+
45+
You can configure Snuba to send metrics to Statsd server by configuring your `docker-compose.yml` file:
46+
47+
```yaml
48+
# The rest of your Docker Compose file
49+
50+
x-snuba-defaults: &snuba_defaults
51+
<<: *restart_policy
52+
depends_on:
53+
clickhouse:
54+
<<: *depends_on-healthy
55+
kafka:
56+
<<: *depends_on-healthy
57+
redis:
58+
<<: *depends_on-healthy
59+
image: "$SNUBA_IMAGE"
60+
environment:
61+
SNUBA_SETTINGS: self_hosted
62+
CLICKHOUSE_HOST: clickhouse
63+
DEFAULT_BROKERS: "kafka:9092"
64+
REDIS_HOST: redis
65+
UWSGI_MAX_REQUESTS: "10000"
66+
UWSGI_DISABLE_LOGGING: "true"
67+
# Leaving the value empty to just pass whatever is set
68+
# on the host system (or in the .env file)
69+
SENTRY_EVENT_RETENTION_DAYS:
70+
SNUBA_STATSD_HOST: "100.100.123.123" # Must be an IP address, not domain name
71+
SNUBA_STATSD_PORT: 8125
72+
73+
# The rest of your Docker Compose file
74+
```
75+
76+
### Relay
77+
78+
You can configure Relay to send metrics to Statsd server by configuring your `relay/config.yml` file:
79+
80+
```yaml
81+
# The rest of your config.yml file
82+
metrics:
83+
statsd: "100.100.123.123:8125" # It's recommended to use IP address instead of domain name
84+
# prefix: "sentry.relay" # Adjust this to your needs, default is "sentry.relay"
85+
# sample_rate: 1.0 # Adjust this to your needs, default is 1.0
86+
# `periodic_secs` is the interval for periodic metrics emitted from Relay.
87+
# Setting it to `0` seconds disables the periodic metrics.
88+
# periodic_secs: 5
89+
```
90+
91+
### Symbolicator
92+
93+
You can configure Symbolicator to send metrics to Statsd server by configuring your `symbolicator/config.yml` file:
94+
95+
```yaml
96+
# The rest of your config.yml file
97+
metrics:
98+
statsd: "100.100.123.123:8125" # It's recommended to use IP address instead of domain name
99+
prefix: "sentry.symbolicator" # Adjust this to your needs, default is "symbolicator"
100+
```
101+
102+
## Sentry dependencies
103+
104+
We don't provide configurations for Sentry's dependencies such as PostgreSQL, Kafka, Redis, Memcached and ClickHouse that are bundled with the Docker Compose file. You will need to provide monitoring configuration for those service yourself adjusted to your needs.

0 commit comments

Comments
 (0)