Skip to content

Commit

Permalink
Merge pull request #1885 from jwhitlock/add-sentry-environment
Browse files Browse the repository at this point in the history
Send SENTRY_ENVIRONMENT to Sentry
  • Loading branch information
jwhitlock committed Aug 22, 2022
2 parents a50544c + d2903a7 commit 5154ac1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions ichnaea/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class Config:
doc="Sentry DSN; leave blank to disable Sentry error reporting",
default="",
)
sentry_environment = Option(doc="Sentry environment", default="")
statsd_host = Option(doc="StatsD host; blank to disable StatsD", default="")
statsd_port = Option(default="8125", parser=int, doc="StatsD port")
redis_uri = Option(doc="uri for Redis; ``redis://HOST:PORT/DB``")
Expand Down
9 changes: 8 additions & 1 deletion ichnaea/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,17 @@ def configure_raven(transport=None, tags=None, _client=None):
raise ValueError("No valid raven transport was configured.")

dsn = settings("sentry_dsn")
environment = settings("sentry_environment")
klass = DebugRavenClient if not dsn else RavenClient
info = version_info()
release = info.get("version") or info.get("commit") or "unknown"
client = klass(dsn=dsn, transport=transport, release=release, tags=tags or {})
client = klass(
dsn=dsn,
transport=transport,
release=release,
environment=environment or None,
tags=tags or {},
)
return client


Expand Down

0 comments on commit 5154ac1

Please sign in to comment.