Skip to content

Commit

Permalink
use Sentry configuration (#1911)
Browse files Browse the repository at this point in the history
  • Loading branch information
juandspy authored Dec 18, 2023
1 parent 74e204d commit 969c777
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
17 changes: 17 additions & 0 deletions conf/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ func setEnvVariables(t *testing.T) {
mustSetEnv(t, "INSIGHTS_RESULTS_AGGREGATOR__REDIS__DATABASE", "42")
mustSetEnv(t, "INSIGHTS_RESULTS_AGGREGATOR__REDIS__TIMEOUT_SECONDS", "0")
mustSetEnv(t, "INSIGHTS_RESULTS_AGGREGATOR__REDIS__PASSWORD", "top secret")

mustSetEnv(t, "INSIGHTS_RESULTS_AGGREGATOR__SENTRY__DSN", "test.example.com")
mustSetEnv(t, "INSIGHTS_RESULTS_AGGREGATOR__SENTRY__ENVIRONMENT", "test")
}

func mustSetEnv(t *testing.T, key, val string) {
Expand Down Expand Up @@ -388,6 +391,10 @@ func TestLoadConfigurationFromFile(t *testing.T) {
endpoint = "localhost:6379"
password = ""
timeout_seconds = 30
[sentry]
dsn = "test.example2.com"
environment = "test2"
`

tmpFilename, err := GetTmpConfigFile(config)
Expand Down Expand Up @@ -450,6 +457,11 @@ func TestLoadConfigurationFromFile(t *testing.T) {
RedisTimeoutSeconds: 30,
RedisPassword: "",
}, conf.GetRedisConfiguration())

assert.Equal(t, logger.SentryLoggingConfiguration{
SentryDSN: "test.example2.com",
SentryEnvironment: "test2",
}, conf.GetSentryLoggingConfiguration())
}

func TestLoadConfigurationFromEnv(t *testing.T) {
Expand Down Expand Up @@ -508,6 +520,11 @@ func TestLoadConfigurationFromEnv(t *testing.T) {
RedisTimeoutSeconds: 0,
RedisPassword: "top secret",
}, conf.GetRedisConfiguration())

assert.Equal(t, logger.SentryLoggingConfiguration{
SentryDSN: "test.example.com",
SentryEnvironment: "test",
}, conf.GetSentryLoggingConfiguration())
}

func TestGetLoggingConfigurationDefault(t *testing.T) {
Expand Down
16 changes: 16 additions & 0 deletions deploy/dvo-writer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ objects:
name: cloudwatch
key: aws_secret_access_key
optional: true
- name: INSIGHTS_RESULTS_AGGREGATOR__SENTRY__DSN
valueFrom:
secretKeyRef:
key: dsn
name: dvo-writer-dsn
optional: true
- name: INSIGHTS_RESULTS_AGGREGATOR__SENTRY__ENVIRONMENT
value: ${ENV_NAME}
resources:
limits:
cpu: ${DVO_WRITER_CPU_LIMIT}
Expand Down Expand Up @@ -181,6 +189,14 @@ objects:
name: cloudwatch
key: aws_secret_access_key
optional: true
- name: INSIGHTS_RESULTS_AGGREGATOR__SENTRY__DSN
valueFrom:
secretKeyRef:
key: dsn
name: dvo-writer-dsn
optional: true
- name: INSIGHTS_RESULTS_AGGREGATOR__SENTRY__ENVIRONMENT
value: ${ENV_NAME}
image: ${IMAGE}:${IMAGE_TAG}
livenessProbe:
failureThreshold: 10
Expand Down
4 changes: 4 additions & 0 deletions tests/config1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ logging_to_cloud_watch_enabled = false

[metrics]
namespace = "aggregator"

[sentry]
dsn = "test.example.com"
environment = "test"

0 comments on commit 969c777

Please sign in to comment.