Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Meier <roger@bufferoverflow.ch>2019-05-02 18:00:24 +0300
committerPaul Okstad <pokstad@gitlab.com>2019-05-02 18:00:24 +0300
commitf0d93a2d6a901ebe793cfc05a341fc20ec6e44c3 (patch)
tree544f18f898864f74b56162ddd493ec593aea0aa9
parent6e1bd0c79267a70187f395d659c44ba005062f4a (diff)
feat: add sentry environment
-rw-r--r--changelogs/unreleased/feat-sentry-environment.yml5
-rw-r--r--doc/configuration/README.md1
-rw-r--r--internal/config/config.go9
-rw-r--r--internal/config/sentry.go4
-rw-r--r--internal/rubyserver/rubyserver.go4
-rw-r--r--ruby/lib/gitaly_server/sentry.rb1
6 files changed, 20 insertions, 4 deletions
diff --git a/changelogs/unreleased/feat-sentry-environment.yml b/changelogs/unreleased/feat-sentry-environment.yml
new file mode 100644
index 000000000..263da7368
--- /dev/null
+++ b/changelogs/unreleased/feat-sentry-environment.yml
@@ -0,0 +1,5 @@
+---
+title: Add option to add Sentry environment
+merge_request: 1216
+author: Roger Meier
+type: added
diff --git a/doc/configuration/README.md b/doc/configuration/README.md
index 652745eb4..644e400e9 100644
--- a/doc/configuration/README.md
+++ b/doc/configuration/README.md
@@ -145,6 +145,7 @@ level = "warn"
|format|string|no|Log format: "text" or "json". Default: "text"|
|level|string|no| Log level: "debug", "info", "warn", "error", "fatal", or "panic". Default: "info"|
|sentry_dsn|string|no|Sentry DSN for exception monitoring|
+|sentry_environment|string|no|Sentry Environment for exception monitoring|
|ruby_sentry_dsn|string|no|Sentry DSN for gitaly-ruby exception monitoring|
## Environment variables
diff --git a/internal/config/config.go b/internal/config/config.go
index 4f625783e..ed562800c 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -80,10 +80,11 @@ type Storage struct {
// Logging contains the logging configuration for Gitaly
type Logging struct {
- Format string
- SentryDSN string `toml:"sentry_dsn"`
- RubySentryDSN string `toml:"ruby_sentry_dsn"`
- Level string `toml:"level"`
+ Format string
+ SentryDSN string `toml:"sentry_dsn"`
+ RubySentryDSN string `toml:"ruby_sentry_dsn"`
+ SentryEnvironment string `toml:"sentry_environment"`
+ Level string `toml:"level"`
}
// Prometheus contains additional configuration data for prometheus
diff --git a/internal/config/sentry.go b/internal/config/sentry.go
index 77a6a8029..1b8aa7d06 100644
--- a/internal/config/sentry.go
+++ b/internal/config/sentry.go
@@ -20,6 +20,10 @@ func ConfigureSentry(version string) {
raven.SetRelease("v" + version)
}
+ if Config.Logging.SentryEnvironment != "" {
+ raven.SetEnvironment(Config.Logging.SentryEnvironment)
+ }
+
panichandler.InstallPanicHandler(func(grpcMethod string, _err interface{}) {
err, ok := _err.(error)
if !ok {
diff --git a/internal/rubyserver/rubyserver.go b/internal/rubyserver/rubyserver.go
index 615444287..3b75b665e 100644
--- a/internal/rubyserver/rubyserver.go
+++ b/internal/rubyserver/rubyserver.go
@@ -120,6 +120,10 @@ func Start() (*Server, error) {
env = append(env, "SENTRY_DSN="+dsn)
}
+ if sentryEnvironment := cfg.Logging.SentryEnvironment; sentryEnvironment != "" {
+ env = append(env, "SENTRY_ENVIRONMENT="+sentryEnvironment)
+ }
+
gitalyRuby := path.Join(cfg.Ruby.Dir, "bin/gitaly-ruby")
numWorkers := cfg.Ruby.NumWorkers
diff --git a/ruby/lib/gitaly_server/sentry.rb b/ruby/lib/gitaly_server/sentry.rb
index b736cfe34..bb6d9100f 100644
--- a/ruby/lib/gitaly_server/sentry.rb
+++ b/ruby/lib/gitaly_server/sentry.rb
@@ -59,4 +59,5 @@ Raven.configure do |config|
config.release = ENV['GITALY_VERSION'].presence
config.sanitize_fields = %w[gitaly-servers authorization]
config.processors += [GitalyServer::Sentry::URLSanitizer]
+ config.current_environment = ENV['SENTRY_ENVIRONMENT'].presence
end