From 4603a4cbb574c07a45b5e1caa8b46b5c11a2cf54 Mon Sep 17 00:00:00 2001 From: Vadim Kharitonov Date: Tue, 13 Dec 2022 10:43:30 +0100 Subject: [PATCH] Bypass SENTRY_ENVIRONMENT variable in order to filter panics in sentry by environment. --- .github/ansible/neon-stress.hosts.yaml | 1 + .github/ansible/prod.ap-southeast-1.hosts.yaml | 1 + .github/ansible/prod.eu-central-1.hosts.yaml | 1 + .github/ansible/prod.us-east-2.hosts.yaml | 1 + .github/ansible/production.hosts.yaml | 1 + .github/ansible/staging.eu-west-1.hosts.yaml | 1 + .github/ansible/staging.hosts.yaml | 1 + .github/ansible/staging.us-east-2.hosts.yaml | 1 + .github/ansible/systemd/pageserver.service | 2 +- .github/ansible/systemd/safekeeper.service | 2 +- .github/helm-values/dev-eu-west-1-zeta.neon-proxy-scram.yaml | 1 + .../helm-values/dev-eu-west-1-zeta.neon-storage-broker.yaml | 2 ++ .github/helm-values/dev-us-east-2-beta.neon-proxy-link.yaml | 1 + .../dev-us-east-2-beta.neon-proxy-scram-legacy.yaml | 1 + .github/helm-values/dev-us-east-2-beta.neon-proxy-scram.yaml | 1 + .../helm-values/dev-us-east-2-beta.neon-storage-broker.yaml | 2 ++ .github/helm-values/neon-stress.neon-storage-broker.yaml | 2 ++ .github/helm-values/neon-stress.proxy-scram.yaml | 3 +++ .github/helm-values/neon-stress.proxy.yaml | 1 + .../prod-ap-southeast-1-epsilon.neon-proxy-scram.yaml | 1 + .../prod-ap-southeast-1-epsilon.neon-storage-broker.yaml | 2 ++ .../helm-values/prod-eu-central-1-gamma.neon-proxy-scram.yaml | 1 + .../prod-eu-central-1-gamma.neon-storage-broker.yaml | 2 ++ .github/helm-values/prod-us-east-2-delta.neon-proxy-scram.yaml | 1 + .../helm-values/prod-us-east-2-delta.neon-storage-broker.yaml | 2 ++ .github/helm-values/prod-us-west-2-eta.neon-proxy-scram.yaml | 1 + .../helm-values/prod-us-west-2-eta.neon-storage-broker.yaml | 2 ++ .github/helm-values/production.neon-storage-broker.yaml | 2 ++ .github/helm-values/production.proxy-scram.yaml | 3 +++ .github/helm-values/production.proxy.yaml | 1 + .github/helm-values/staging.neon-storage-broker.yaml | 2 ++ .github/helm-values/staging.proxy-scram.yaml | 1 + .github/helm-values/staging.proxy.yaml | 1 + libs/utils/src/sentry_init.rs | 2 ++ 34 files changed, 48 insertions(+), 2 deletions(-) diff --git a/.github/ansible/neon-stress.hosts.yaml b/.github/ansible/neon-stress.hosts.yaml index 6b2166e7a6..5d5df5a6d5 100644 --- a/.github/ansible/neon-stress.hosts.yaml +++ b/.github/ansible/neon-stress.hosts.yaml @@ -14,6 +14,7 @@ storage: safekeeper_s3_prefix: neon-stress/wal hostname_suffix: ".local" remote_user: admin + sentry_environment: development children: pageservers: hosts: diff --git a/.github/ansible/prod.ap-southeast-1.hosts.yaml b/.github/ansible/prod.ap-southeast-1.hosts.yaml index 76ec3d29ae..bcc7bb3b16 100644 --- a/.github/ansible/prod.ap-southeast-1.hosts.yaml +++ b/.github/ansible/prod.ap-southeast-1.hosts.yaml @@ -16,6 +16,7 @@ storage: ansible_aws_ssm_region: ap-southeast-1 ansible_aws_ssm_bucket_name: neon-prod-storage-ap-southeast-1 console_region_id: aws-ap-southeast-1 + sentry_environment: production children: pageservers: diff --git a/.github/ansible/prod.eu-central-1.hosts.yaml b/.github/ansible/prod.eu-central-1.hosts.yaml index c8a8b15ddb..2b372d0fcb 100644 --- a/.github/ansible/prod.eu-central-1.hosts.yaml +++ b/.github/ansible/prod.eu-central-1.hosts.yaml @@ -16,6 +16,7 @@ storage: ansible_aws_ssm_region: eu-central-1 ansible_aws_ssm_bucket_name: neon-prod-storage-eu-central-1 console_region_id: aws-eu-central-1 + sentry_environment: production children: pageservers: diff --git a/.github/ansible/prod.us-east-2.hosts.yaml b/.github/ansible/prod.us-east-2.hosts.yaml index 36a5337a8d..7a4002ec88 100644 --- a/.github/ansible/prod.us-east-2.hosts.yaml +++ b/.github/ansible/prod.us-east-2.hosts.yaml @@ -16,6 +16,7 @@ storage: ansible_aws_ssm_region: us-east-2 ansible_aws_ssm_bucket_name: neon-prod-storage-us-east-2 console_region_id: aws-us-east-2 + sentry_environment: production children: pageservers: diff --git a/.github/ansible/production.hosts.yaml b/.github/ansible/production.hosts.yaml index cea0556ba1..d22c845966 100644 --- a/.github/ansible/production.hosts.yaml +++ b/.github/ansible/production.hosts.yaml @@ -14,6 +14,7 @@ storage: safekeeper_s3_prefix: prod-1/wal hostname_suffix: ".local" remote_user: admin + sentry_environment: production children: pageservers: diff --git a/.github/ansible/staging.eu-west-1.hosts.yaml b/.github/ansible/staging.eu-west-1.hosts.yaml index 4a64423a0d..90f00175b0 100644 --- a/.github/ansible/staging.eu-west-1.hosts.yaml +++ b/.github/ansible/staging.eu-west-1.hosts.yaml @@ -16,6 +16,7 @@ storage: ansible_aws_ssm_region: eu-west-1 ansible_aws_ssm_bucket_name: neon-dev-storage-eu-west-1 console_region_id: aws-eu-west-1 + sentry_environment: development children: pageservers: diff --git a/.github/ansible/staging.hosts.yaml b/.github/ansible/staging.hosts.yaml index a580b7563a..79acfd1d2a 100644 --- a/.github/ansible/staging.hosts.yaml +++ b/.github/ansible/staging.hosts.yaml @@ -13,6 +13,7 @@ storage: safekeeper_s3_prefix: us-stage/wal hostname_suffix: ".local" remote_user: admin + sentry_environment: development children: pageservers: diff --git a/.github/ansible/staging.us-east-2.hosts.yaml b/.github/ansible/staging.us-east-2.hosts.yaml index 5a5a673a5e..d2b7fae12a 100644 --- a/.github/ansible/staging.us-east-2.hosts.yaml +++ b/.github/ansible/staging.us-east-2.hosts.yaml @@ -16,6 +16,7 @@ storage: ansible_aws_ssm_region: us-east-2 ansible_aws_ssm_bucket_name: neon-staging-storage-us-east-2 console_region_id: aws-us-east-2 + sentry_environment: development children: pageservers: diff --git a/.github/ansible/systemd/pageserver.service b/.github/ansible/systemd/pageserver.service index 9847ee0f9e..4570a666fa 100644 --- a/.github/ansible/systemd/pageserver.service +++ b/.github/ansible/systemd/pageserver.service @@ -5,7 +5,7 @@ After=network.target auditd.service [Service] Type=simple User=pageserver -Environment=RUST_BACKTRACE=1 NEON_REPO_DIR=/storage/pageserver LD_LIBRARY_PATH=/usr/local/v14/lib SENTRY_DSN={{ SENTRY_URL_PAGESERVER }} +Environment=RUST_BACKTRACE=1 NEON_REPO_DIR=/storage/pageserver LD_LIBRARY_PATH=/usr/local/v14/lib SENTRY_DSN={{ SENTRY_URL_PAGESERVER }} SENTRY_ENVIRONMENT={{ sentry_environment }} ExecStart=/usr/local/bin/pageserver -c "pg_distrib_dir='/usr/local'" -c "listen_pg_addr='0.0.0.0:6400'" -c "listen_http_addr='0.0.0.0:9898'" -c "broker_endpoint='{{ broker_endpoint }}'" -D /storage/pageserver/data ExecReload=/bin/kill -HUP $MAINPID KillMode=mixed diff --git a/.github/ansible/systemd/safekeeper.service b/.github/ansible/systemd/safekeeper.service index 828655e435..d7d8d26b1a 100644 --- a/.github/ansible/systemd/safekeeper.service +++ b/.github/ansible/systemd/safekeeper.service @@ -5,7 +5,7 @@ After=network.target auditd.service [Service] Type=simple User=safekeeper -Environment=RUST_BACKTRACE=1 NEON_REPO_DIR=/storage/safekeeper/data LD_LIBRARY_PATH=/usr/local/v14/lib SENTRY_DSN={{ SENTRY_URL_SAFEKEEPER }} +Environment=RUST_BACKTRACE=1 NEON_REPO_DIR=/storage/safekeeper/data LD_LIBRARY_PATH=/usr/local/v14/lib SENTRY_DSN={{ SENTRY_URL_SAFEKEEPER }} SENTRY_ENVIRONMENT={{ sentry_environment }} ExecStart=/usr/local/bin/safekeeper -l {{ inventory_hostname }}{{ hostname_suffix }}:6500 --listen-http {{ inventory_hostname }}{{ hostname_suffix }}:7676 -D /storage/safekeeper/data --broker-endpoint={{ broker_endpoint }} --remote-storage='{bucket_name="{{bucket_name}}", bucket_region="{{bucket_region}}", prefix_in_bucket="{{ safekeeper_s3_prefix }}"}' ExecReload=/bin/kill -HUP $MAINPID KillMode=mixed diff --git a/.github/helm-values/dev-eu-west-1-zeta.neon-proxy-scram.yaml b/.github/helm-values/dev-eu-west-1-zeta.neon-proxy-scram.yaml index 0e98636057..f89eea5972 100644 --- a/.github/helm-values/dev-eu-west-1-zeta.neon-proxy-scram.yaml +++ b/.github/helm-values/dev-eu-west-1-zeta.neon-proxy-scram.yaml @@ -8,6 +8,7 @@ settings: authBackend: "console" authEndpoint: "http://console-staging.local/management/api/v2" domain: "*.eu-west-1.aws.neon.build" + sentryEnvironment: "development" # -- Additional labels for neon-proxy pods podLabels: diff --git a/.github/helm-values/dev-eu-west-1-zeta.neon-storage-broker.yaml b/.github/helm-values/dev-eu-west-1-zeta.neon-storage-broker.yaml index f139244cff..e876367a18 100644 --- a/.github/helm-values/dev-eu-west-1-zeta.neon-storage-broker.yaml +++ b/.github/helm-values/dev-eu-west-1-zeta.neon-storage-broker.yaml @@ -53,3 +53,5 @@ extraManifests: matchNames: - "{{ .Release.Namespace }}" +settings: + sentryEnvironment: "development" diff --git a/.github/helm-values/dev-us-east-2-beta.neon-proxy-link.yaml b/.github/helm-values/dev-us-east-2-beta.neon-proxy-link.yaml index 685cbd192d..eeb025277b 100644 --- a/.github/helm-values/dev-us-east-2-beta.neon-proxy-link.yaml +++ b/.github/helm-values/dev-us-east-2-beta.neon-proxy-link.yaml @@ -8,6 +8,7 @@ settings: authBackend: "link" authEndpoint: "https://console.stage.neon.tech/authenticate_proxy_request/" uri: "https://console.stage.neon.tech/psql_session/" + sentryEnvironment: "development" # -- Additional labels for neon-proxy-link pods podLabels: diff --git a/.github/helm-values/dev-us-east-2-beta.neon-proxy-scram-legacy.yaml b/.github/helm-values/dev-us-east-2-beta.neon-proxy-scram-legacy.yaml index 76653e769c..ed710bc196 100644 --- a/.github/helm-values/dev-us-east-2-beta.neon-proxy-scram-legacy.yaml +++ b/.github/helm-values/dev-us-east-2-beta.neon-proxy-scram-legacy.yaml @@ -8,6 +8,7 @@ settings: authBackend: "console" authEndpoint: "http://console-staging.local/management/api/v2" domain: "*.cloud.stage.neon.tech" + sentryEnvironment: "development" # -- Additional labels for neon-proxy pods podLabels: diff --git a/.github/helm-values/dev-us-east-2-beta.neon-proxy-scram.yaml b/.github/helm-values/dev-us-east-2-beta.neon-proxy-scram.yaml index f2247fa4c1..ba0109c1eb 100644 --- a/.github/helm-values/dev-us-east-2-beta.neon-proxy-scram.yaml +++ b/.github/helm-values/dev-us-east-2-beta.neon-proxy-scram.yaml @@ -8,6 +8,7 @@ settings: authBackend: "console" authEndpoint: "http://console-staging.local/management/api/v2" domain: "*.us-east-2.aws.neon.build" + sentryEnvironment: "development" # -- Additional labels for neon-proxy pods podLabels: diff --git a/.github/helm-values/dev-us-east-2-beta.neon-storage-broker.yaml b/.github/helm-values/dev-us-east-2-beta.neon-storage-broker.yaml index d59d2ebe70..dcf4b99de2 100644 --- a/.github/helm-values/dev-us-east-2-beta.neon-storage-broker.yaml +++ b/.github/helm-values/dev-us-east-2-beta.neon-storage-broker.yaml @@ -53,3 +53,5 @@ extraManifests: matchNames: - "{{ .Release.Namespace }}" +settings: + sentryEnvironment: "development" diff --git a/.github/helm-values/neon-stress.neon-storage-broker.yaml b/.github/helm-values/neon-stress.neon-storage-broker.yaml index fd35c5e14e..e11e5d4214 100644 --- a/.github/helm-values/neon-stress.neon-storage-broker.yaml +++ b/.github/helm-values/neon-stress.neon-storage-broker.yaml @@ -52,3 +52,5 @@ extraManifests: matchNames: - "{{ .Release.Namespace }}" +settings: + sentryEnvironment: "development" diff --git a/.github/helm-values/neon-stress.proxy-scram.yaml b/.github/helm-values/neon-stress.proxy-scram.yaml index 8f55d31c87..bbdd13781c 100644 --- a/.github/helm-values/neon-stress.proxy-scram.yaml +++ b/.github/helm-values/neon-stress.proxy-scram.yaml @@ -24,3 +24,6 @@ metrics: enabled: true selector: release: kube-prometheus-stack + +settings: + sentryEnvironment: "development" diff --git a/.github/helm-values/neon-stress.proxy.yaml b/.github/helm-values/neon-stress.proxy.yaml index ce432ca23c..c3ecf6c743 100644 --- a/.github/helm-values/neon-stress.proxy.yaml +++ b/.github/helm-values/neon-stress.proxy.yaml @@ -4,6 +4,7 @@ settings: authBackend: "link" authEndpoint: "https://console.dev.neon.tech/authenticate_proxy_request/" uri: "https://console.dev.neon.tech/psql_session/" + sentryEnvironment: "development" # -- Additional labels for zenith-proxy pods podLabels: diff --git a/.github/helm-values/prod-ap-southeast-1-epsilon.neon-proxy-scram.yaml b/.github/helm-values/prod-ap-southeast-1-epsilon.neon-proxy-scram.yaml index f90f89a516..a37a37406c 100644 --- a/.github/helm-values/prod-ap-southeast-1-epsilon.neon-proxy-scram.yaml +++ b/.github/helm-values/prod-ap-southeast-1-epsilon.neon-proxy-scram.yaml @@ -8,6 +8,7 @@ settings: authBackend: "console" authEndpoint: "http://console-release.local/management/api/v2" domain: "*.ap-southeast-1.aws.neon.tech" + sentryEnvironment: "production" # -- Additional labels for neon-proxy pods podLabels: diff --git a/.github/helm-values/prod-ap-southeast-1-epsilon.neon-storage-broker.yaml b/.github/helm-values/prod-ap-southeast-1-epsilon.neon-storage-broker.yaml index 9654097934..0abc6ebaa1 100644 --- a/.github/helm-values/prod-ap-southeast-1-epsilon.neon-storage-broker.yaml +++ b/.github/helm-values/prod-ap-southeast-1-epsilon.neon-storage-broker.yaml @@ -53,3 +53,5 @@ extraManifests: matchNames: - "{{ .Release.Namespace }}" +settings: + sentryEnvironment: "production" diff --git a/.github/helm-values/prod-eu-central-1-gamma.neon-proxy-scram.yaml b/.github/helm-values/prod-eu-central-1-gamma.neon-proxy-scram.yaml index 33a1154099..69d00a7e9c 100644 --- a/.github/helm-values/prod-eu-central-1-gamma.neon-proxy-scram.yaml +++ b/.github/helm-values/prod-eu-central-1-gamma.neon-proxy-scram.yaml @@ -8,6 +8,7 @@ settings: authBackend: "console" authEndpoint: "http://console-release.local/management/api/v2" domain: "*.eu-central-1.aws.neon.tech" + sentryEnvironment: "production" # -- Additional labels for neon-proxy pods podLabels: diff --git a/.github/helm-values/prod-eu-central-1-gamma.neon-storage-broker.yaml b/.github/helm-values/prod-eu-central-1-gamma.neon-storage-broker.yaml index 9582327df3..d44a3eab5c 100644 --- a/.github/helm-values/prod-eu-central-1-gamma.neon-storage-broker.yaml +++ b/.github/helm-values/prod-eu-central-1-gamma.neon-storage-broker.yaml @@ -53,3 +53,5 @@ extraManifests: matchNames: - "{{ .Release.Namespace }}" +settings: + sentryEnvironment: "production" diff --git a/.github/helm-values/prod-us-east-2-delta.neon-proxy-scram.yaml b/.github/helm-values/prod-us-east-2-delta.neon-proxy-scram.yaml index 5f9f2d2e66..19d91fa4dc 100644 --- a/.github/helm-values/prod-us-east-2-delta.neon-proxy-scram.yaml +++ b/.github/helm-values/prod-us-east-2-delta.neon-proxy-scram.yaml @@ -8,6 +8,7 @@ settings: authBackend: "console" authEndpoint: "http://console-release.local/management/api/v2" domain: "*.us-east-2.aws.neon.tech" + sentryEnvironment: "production" # -- Additional labels for neon-proxy pods podLabels: diff --git a/.github/helm-values/prod-us-east-2-delta.neon-storage-broker.yaml b/.github/helm-values/prod-us-east-2-delta.neon-storage-broker.yaml index 7c64d4c7bd..b9eeff5681 100644 --- a/.github/helm-values/prod-us-east-2-delta.neon-storage-broker.yaml +++ b/.github/helm-values/prod-us-east-2-delta.neon-storage-broker.yaml @@ -53,3 +53,5 @@ extraManifests: matchNames: - "{{ .Release.Namespace }}" +settings: + sentryEnvironment: "production" diff --git a/.github/helm-values/prod-us-west-2-eta.neon-proxy-scram.yaml b/.github/helm-values/prod-us-west-2-eta.neon-proxy-scram.yaml index 1747cb95b1..f148188c48 100644 --- a/.github/helm-values/prod-us-west-2-eta.neon-proxy-scram.yaml +++ b/.github/helm-values/prod-us-west-2-eta.neon-proxy-scram.yaml @@ -8,6 +8,7 @@ settings: authBackend: "console" authEndpoint: "http://console-release.local/management/api/v2" domain: "*.us-west-2.aws.neon.tech" + sentryEnvironment: "production" # -- Additional labels for neon-proxy pods podLabels: diff --git a/.github/helm-values/prod-us-west-2-eta.neon-storage-broker.yaml b/.github/helm-values/prod-us-west-2-eta.neon-storage-broker.yaml index 1014d36264..249f76303a 100644 --- a/.github/helm-values/prod-us-west-2-eta.neon-storage-broker.yaml +++ b/.github/helm-values/prod-us-west-2-eta.neon-storage-broker.yaml @@ -53,3 +53,5 @@ extraManifests: matchNames: - "{{ .Release.Namespace }}" +settings: + sentryEnvironment: "production" diff --git a/.github/helm-values/production.neon-storage-broker.yaml b/.github/helm-values/production.neon-storage-broker.yaml index 395b023671..aa64081da3 100644 --- a/.github/helm-values/production.neon-storage-broker.yaml +++ b/.github/helm-values/production.neon-storage-broker.yaml @@ -52,3 +52,5 @@ extraManifests: matchNames: - "{{ .Release.Namespace }}" +settings: + sentryEnvironment: "production" diff --git a/.github/helm-values/production.proxy-scram.yaml b/.github/helm-values/production.proxy-scram.yaml index 54b0fbcd98..7011a9ce01 100644 --- a/.github/helm-values/production.proxy-scram.yaml +++ b/.github/helm-values/production.proxy-scram.yaml @@ -22,3 +22,6 @@ metrics: enabled: true selector: release: kube-prometheus-stack + +settings: + sentryEnvironment: "production" diff --git a/.github/helm-values/production.proxy.yaml b/.github/helm-values/production.proxy.yaml index c26a6258be..9db68c1044 100644 --- a/.github/helm-values/production.proxy.yaml +++ b/.github/helm-values/production.proxy.yaml @@ -2,6 +2,7 @@ settings: authBackend: "link" authEndpoint: "https://console.neon.tech/authenticate_proxy_request/" uri: "https://console.neon.tech/psql_session/" + sentryEnvironment: "production" # -- Additional labels for zenith-proxy pods podLabels: diff --git a/.github/helm-values/staging.neon-storage-broker.yaml b/.github/helm-values/staging.neon-storage-broker.yaml index bffcf41ef0..6b21c286a1 100644 --- a/.github/helm-values/staging.neon-storage-broker.yaml +++ b/.github/helm-values/staging.neon-storage-broker.yaml @@ -52,3 +52,5 @@ extraManifests: matchNames: - "{{ .Release.Namespace }}" +settings: + sentryEnvironment: "development" diff --git a/.github/helm-values/staging.proxy-scram.yaml b/.github/helm-values/staging.proxy-scram.yaml index 91422e754a..f249df3612 100644 --- a/.github/helm-values/staging.proxy-scram.yaml +++ b/.github/helm-values/staging.proxy-scram.yaml @@ -8,6 +8,7 @@ settings: authBackend: "console" authEndpoint: "http://console-staging.local/management/api/v2" domain: "*.cloud.stage.neon.tech" + sentryEnvironment: "development" # -- Additional labels for zenith-proxy pods podLabels: diff --git a/.github/helm-values/staging.proxy.yaml b/.github/helm-values/staging.proxy.yaml index 25842429a5..62b4c4a595 100644 --- a/.github/helm-values/staging.proxy.yaml +++ b/.github/helm-values/staging.proxy.yaml @@ -8,6 +8,7 @@ settings: authBackend: "link" authEndpoint: "https://console.stage.neon.tech/authenticate_proxy_request/" uri: "https://console.stage.neon.tech/psql_session/" + sentryEnvironment: "development" # -- Additional labels for zenith-proxy pods podLabels: diff --git a/libs/utils/src/sentry_init.rs b/libs/utils/src/sentry_init.rs index 4f1c297854..992cb5c671 100644 --- a/libs/utils/src/sentry_init.rs +++ b/libs/utils/src/sentry_init.rs @@ -10,11 +10,13 @@ pub fn init_sentry( extra_options: &[(&str, &str)], ) -> Option { let dsn = env::var("SENTRY_DSN").ok()?; + let environment = env::var("SENTRY_ENVIRONMENT").unwrap_or_else(|_| "development".into()); let guard = sentry::init(( dsn, sentry::ClientOptions { release: release_name, + environment: Some(environment.into()), ..Default::default() }, ));