Skip to content

Commit

Permalink
Tech - Ajout de l'environnement dans sentry (UPDATE ENV VAR) (#4014)
Browse files Browse the repository at this point in the history
- Ajout des variables d'environnement pour récupérer la version et
l'environnement dans les erreurs remontées sur Sentry:

Dans le docker-compose :
```
      - MONITORFISH_VERSION=$MONITORFISH_VERSION
      - MONITORFISH_SENTRY_ENV=$MONITORFISH_SENTRY_ENV

```

----

- [ ] Tests E2E (Cypress)
  • Loading branch information
louptheron authored Jan 13, 2025
2 parents b9ef9f7 + c70ba5f commit 6d6db7a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@ import org.slf4j.LoggerFactory
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

@SpringBootApplication
class MonitorFishApplication
@SpringBootApplication class MonitorFishApplication

fun main(args: Array<String>) {
val ctx = runApplication<MonitorFishApplication>(*args)
val logger: Logger = LoggerFactory.getLogger(MonitorFishApplication::class.java)

val isSentryEnabled: String? = ctx.environment.getProperty("monitorfish.sentry.enabled")
val sentryDsn: String? = ctx.environment.getProperty("sentry.dsn")
val sentryEnvironment: String? = ctx.environment.getProperty("monitorfish.sentry.env")
val version: String? = ctx.environment.getProperty("monitorfish.version")

if (isSentryEnabled == "true") {
Sentry.init { options ->
options.dsn = sentryDsn
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
options.environment = sentryEnvironment
options.release = version
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance
// monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0
}
Expand Down
2 changes: 2 additions & 0 deletions infra/remote/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ services:
- MONITORFISH_HTTP_PROXY_HOST=$MONITORFISH_HTTP_PROXY_HOST
- MONITORFISH_HTTP_PROXY_PORT=$MONITORFISH_HTTP_PROXY_PORT
- MONITORFISH_HTTP_NON_PROXY_HOSTS=$MONITORFISH_HTTP_NON_PROXY_HOSTS
- MONITORFISH_VERSION=$MONITORFISH_VERSION
- ENV_DB_URL=jdbc:postgresql://db:5432/$POSTGRES_DB?user=$POSTGRES_USER&password=$POSTGRES_PASSWORD
- FRONTEND_GEOSERVER_REMOTE_URL=$MONITORFISH_GEOSERVER_REMOTE_URL
- FRONTEND_GEOSERVER_LOCAL_URL=$MONITORFISH_GEOSERVER_LOCAL_URL
Expand All @@ -44,6 +45,7 @@ services:
- MONITORFISH_API_PROTECTED_PATHS=$MONITORFISH_API_PROTECTED_PATHS
- MONITORFISH_API_PROTECTED_PUBLIC_PATHS=$MONITORFISH_API_PROTECTED_PUBLIC_PATHS
- MONITORFISH_SCHEDULING_ENABLED=$MONITORFISH_SCHEDULING_ENABLED
- MONITORFISH_SENTRY_ENV=$MONITORFISH_SENTRY_ENV
- FRONTEND_SENTRY_ENV=$MONITORFISH_SENTRY_ENV
- SENTRY_DSN=$MONITORFISH_SENTRY_DSN
- FRONTEND_SENTRY_DSN=$MONITORFISH_SENTRY_DSN
Expand Down

0 comments on commit 6d6db7a

Please sign in to comment.