Skip to content

Commit

Permalink
[jenson] Remove redundant disabling of new relic instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
olttwa committed Jan 8, 2019
1 parent 0c875c8 commit e8f5a41
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 21 deletions.
1 change: 0 additions & 1 deletion proctord/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ export PROCTOR_POSTGRES_MAX_CONNECTIONS="50"
export PROCTOR_POSTGRES_CONNECTIONS_MAX_LIFETIME="30"
export PROCTOR_NEW_RELIC_APP_NAME="PROCTORD"
export PROCTOR_NEW_RELIC_LICENCE_KEY="nrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnr"
export PROCTOR_NEW_RELIC_ENABLED=false
export PROCTOR_MIN_CLIENT_VERSION="v0.2.0"
1 change: 0 additions & 1 deletion proctord/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ export PROCTOR_POSTGRES_MAX_CONNECTIONS=50
export PROCTOR_POSTGRES_CONNECTIONS_MAX_LIFETIME=30
export PROCTOR_NEW_RELIC_APP_NAME="PROCTORD"
export PROCTOR_NEW_RELIC_LICENCE_KEY="nrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnr"
export PROCTOR_NEW_RELIC_ENABLED=false
export PROCTOR_MIN_CLIENT_VERSION="v0.2.0"
2 changes: 2 additions & 0 deletions proctord/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@
* Create database `PROCTOR_POSTGRES_DATABASE`
* `PROCTOR_POSTGRES_MAX_CONNECTIONS` defines maximum open and idle connections to postgres
* `PROCTOR_POSTGRES_CONNECTIONS_MAX_LIFETIME` is the lifetime of a connection in minutes
* `PROCTOR_NEW_RELIC_APP_NAME` and `PROCTOR_NEW_RELIC_LICENCE_KEY` are used to send profiling details to newrelic. Provide dummy values if you don't want profiling
* `PROCTOR_MIN_CLIENT_VERSION` is minimum client version allowed to communicate with proctord
6 changes: 1 addition & 5 deletions proctord/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ func NewRelicLicenceKey() string {
return viper.GetString("NEW_RELIC_LICENCE_KEY")
}

func NewRelicEnabled() bool {
return viper.GetBool("NEW_RELIC_ENABLED")
}

func MinClientVersion() string {
return viper.GetString("MIN_CLIENT_VERSION")
}
}
8 changes: 0 additions & 8 deletions proctord/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,6 @@ func TestNewRelicLicenceKey(t *testing.T) {
assert.Equal(t, "nrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnr", NewRelicLicenceKey())
}

func TestNewRelicEnabled(t *testing.T) {
os.Setenv("PROCTOR_NEW_RELIC_ENABLED", "true")

viper.AutomaticEnv()

assert.Equal(t, true, NewRelicEnabled())
}

func TestMinClientVersion(t *testing.T) {
os.Setenv("PROCTOR_MIN_CLIENT_VERSION", "0.2.0")

Expand Down
6 changes: 0 additions & 6 deletions proctord/instrumentation/newrelic.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@ import (
"net/http"

"github.com/gojektech/proctor/proctord/config"
"github.com/gojektech/proctor/proctord/logger"
"github.com/newrelic/go-agent"
)

var NewRelicApp newrelic.Application

func InitNewRelic() error {
if !config.NewRelicEnabled() {
logger.Warn("New Relic is disabled")
NewRelicApp = &StubNewrelicApp{}
return nil
}
appName := config.NewRelicAppName()
licenceKey := config.NewRelicLicenceKey()
newRelicConfig := newrelic.NewConfig(appName, licenceKey)
Expand Down

0 comments on commit e8f5a41

Please sign in to comment.