mirror of
https://github.com/getsentry/self-hosted.git
synced 2026-02-06 02:46:53 +00:00
feat: statsd configuration through environment variables (#4031)
* feat: statsd configuration through environment variables * feat: provide statsd config via environment variables for relay and symbolicator * fix: default statsd value to localhost * Update sentry/sentry.conf.example.py
This commit is contained in:
parent
275e7d032c
commit
fe477b41d9
5
.env
5
.env
@ -26,3 +26,8 @@ HEALTHCHECK_FILE_RETRIES=3
|
||||
HEALTHCHECK_FILE_START_PERIOD=600s
|
||||
# Set SETUP_JS_SDK_ASSETS to 1 to enable the setup of JS SDK assets
|
||||
# SETUP_JS_SDK_ASSETS=1
|
||||
#
|
||||
# Sentry (and its' surrounding services) uses Statsd for metrics collection.
|
||||
# It's also the proper way to monitor self-hosted Sentry systems.
|
||||
# Set STATSD_ADDR to a valid IP:PORT combination to enable Statsd metrics collection.
|
||||
# STATSD_ADDR=127.0.0.1:8125
|
||||
|
||||
@ -69,6 +69,7 @@ x-sentry-defaults: &sentry_defaults
|
||||
SENTRY_EVENT_RETENTION_DAYS:
|
||||
SENTRY_MAIL_HOST:
|
||||
SENTRY_MAX_EXTERNAL_SOURCEMAP_SIZE:
|
||||
SENTRY_STATSD_ADDR: "${STATSD_ADDR:-}"
|
||||
volumes:
|
||||
- "sentry-data:/data"
|
||||
- "./sentry:/etc/sentry"
|
||||
@ -96,8 +97,7 @@ x-snuba-defaults: &snuba_defaults
|
||||
SENTRY_EVENT_RETENTION_DAYS:
|
||||
# If you have statsd server, you can utilize that to monitor self-hosted Snuba containers.
|
||||
# To start, state these environment variables below on your `.env.` file and adjust the options as needed.
|
||||
SNUBA_STATSD_HOST: # Example value: "100.100.123.123". Must be an IP address, not domain name
|
||||
SNUBA_STATSD_PORT: # Example value: 8125
|
||||
SNUBA_STATSD_ADDR: "${STATSD_ADDR:-}"
|
||||
services:
|
||||
smtp:
|
||||
<<: *restart_policy
|
||||
@ -466,6 +466,8 @@ services:
|
||||
symbolicator:
|
||||
<<: *restart_policy
|
||||
image: "$SYMBOLICATOR_IMAGE"
|
||||
environment:
|
||||
SYMBOLICATOR_STATSD_ADDR: ${STATSD_ADDR:-127.0.0.1:8125}
|
||||
command: run -c /etc/symbolicator/config.yml
|
||||
volumes:
|
||||
- "sentry-symbolicator:/data"
|
||||
@ -700,6 +702,8 @@ services:
|
||||
relay:
|
||||
<<: *restart_policy
|
||||
image: "$RELAY_IMAGE"
|
||||
environment:
|
||||
RELAY_STATSD_ADDR: ${STATSD_ADDR:-127.0.0.1:8125}
|
||||
volumes:
|
||||
- type: bind
|
||||
read_only: true
|
||||
@ -726,6 +730,7 @@ services:
|
||||
TASKBROKER_KAFKA_CLUSTER: "kafka:9092"
|
||||
TASKBROKER_KAFKA_DEADLETTER_CLUSTER: "kafka:9092"
|
||||
TASKBROKER_DB_PATH: "/opt/sqlite/taskbroker-activations.sqlite"
|
||||
TASKBROKER_STATSD_ADDR: ${STATSD_ADDR:-127.0.0.1:8125}
|
||||
volumes:
|
||||
- sentry-taskbroker:/opt/sqlite
|
||||
depends_on:
|
||||
@ -794,6 +799,7 @@ services:
|
||||
# Separated by commas. Leaving this unset will default to the systems dns
|
||||
# resolver.
|
||||
#UPTIME_CHECKER_HTTP_CHECKER_DNS_NAMESERVERS: "8.8.8.8,8.8.4.4"
|
||||
UPTIME_CHECKER_STATSD_ADDR: ${STATSD_ADDR:-127.0.0.1:8125}
|
||||
depends_on:
|
||||
kafka:
|
||||
<<: *depends_on-healthy
|
||||
|
||||
@ -27,9 +27,9 @@ processing:
|
||||
# If you have statsd server, you can utilize that to monitor self-hosted Relay.
|
||||
# To start, uncomment the following `metrics` section and adjust the options as needed.
|
||||
#
|
||||
# metrics:
|
||||
# statsd: "100.100.123.123:8125" # It is recommended to use IP address instead of domain name
|
||||
# prefix: "sentry.relay" # Adjust this to your needs, default is "sentry.relay"
|
||||
metrics:
|
||||
statsd: "${RELAY_STATSD_ADDR}"
|
||||
prefix: "sentry.relay" # Adjust this to your needs, default is "sentry.relay"
|
||||
# sample_rate: 1.0 # Adjust this to your needs, default is 1.0
|
||||
# # `periodic_secs` is the interval for periodic metrics emitted from Relay.
|
||||
# # Setting it to `0` seconds disables the periodic metrics.
|
||||
|
||||
@ -521,10 +521,14 @@ JS_SDK_LOADER_DEFAULT_SDK_URL = "https://browser.sentry-cdn.com/%s/bundle%s.min.
|
||||
#
|
||||
# To start, uncomment the following line and adjust the options as needed.
|
||||
|
||||
# SENTRY_METRICS_BACKEND = 'sentry.metrics.statsd.StatsdMetricsBackend'
|
||||
# SENTRY_METRICS_OPTIONS: dict[str, Any] = {
|
||||
# 'host': '100.100.123.123', # It is recommended to use IP address instead of domain name
|
||||
# 'port': 8125,
|
||||
# }
|
||||
SENTRY_STATSD_ADDR = env("SENTRY_STATSD_ADDR")
|
||||
if SENTRY_STATSD_ADDR:
|
||||
host, _, port = SENTRY_STATSD_ADDR.partition(":")
|
||||
port = int(port or 8125)
|
||||
SENTRY_METRICS_BACKEND = 'sentry.metrics.statsd.StatsdMetricsBackend'
|
||||
SENTRY_METRICS_OPTIONS: dict[str, Any] = {
|
||||
'host': host,
|
||||
'port': port,
|
||||
}
|
||||
# SENTRY_METRICS_SAMPLE_RATE = 1.0 # Adjust this to your needs, default is 1.0
|
||||
# SENTRY_METRICS_PREFIX = "sentry." # Adjust this to your needs, default is "sentry."
|
||||
|
||||
@ -3,13 +3,10 @@ cache_dir: "/data"
|
||||
bind: "0.0.0.0:3021"
|
||||
logging:
|
||||
level: "warn"
|
||||
metrics:
|
||||
statsd: null
|
||||
|
||||
sentry_dsn: null # TODO: Automatically fill this with the internal project DSN
|
||||
|
||||
# If you have statsd server, you can utilize that to monitor self-hosted Symbolicator.
|
||||
# To start, uncomment the following line and adjust the options as needed.
|
||||
#
|
||||
# metrics:
|
||||
# statsd: "100.100.123.123:8125" # It is recommended to use IP address instead of domain name
|
||||
# prefix: "sentry.symbolicator" # Adjust this to your needs, default is "symbolicator"
|
||||
metrics:
|
||||
statsd: "${SYMBOLICATOR_STATSD_ADDR}" # It is recommended to use IP address instead of domain name
|
||||
prefix: "sentry.symbolicator" # Adjust this to your needs, default is "symbolicator"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user