Skip to content

Commit

Permalink
fix(api): allow /mon/metrics without jaeger (#3917)
Browse files Browse the repository at this point in the history
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
  • Loading branch information
yesnault authored Feb 6, 2019
1 parent e1d9e3b commit b8a8528
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
5 changes: 1 addition & 4 deletions engine/api/observability/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ func Init(cfg Configuration, serviceName string) error {
},
)

if statsExporter == nil {
log.Info("observability> initializing prometheus exporter")
statsExporter, err = prometheus.NewExporter(prometheus.Options{})
}
statsExporter, err = prometheus.NewExporter(prometheus.Options{})
if err != nil {
return err
}
Expand Down
13 changes: 0 additions & 13 deletions engine/api/observability/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,15 @@ import (

"github.com/ovh/cds/engine/service"
"github.com/ovh/cds/sdk"
"github.com/ovh/cds/sdk/log"
)

// RegisterView begins collecting data for the given views
func RegisterView(views ...*view.View) error {
if statsExporter == nil {
log.Info("observability> metrics are disabled")
return nil
}
return sdk.WithStack(view.Register(views...))
}

// FindAndRegisterViewLast begins collecting data for the given views
func FindAndRegisterViewLast(nameInput string, tags []tag.Key) (*view.View, error) {
if statsExporter == nil {
log.Info("observability> metrics are disabled")
return nil, nil
}
name := strings.ToLower(nameInput)
viewFind := view.Find(name)
if viewFind != nil {
Expand All @@ -41,10 +32,6 @@ func FindAndRegisterViewLast(nameInput string, tags []tag.Key) (*view.View, erro

// FindAndRegisterViewLastFloat64 begins collecting data for the given views
func FindAndRegisterViewLastFloat64(nameInput string, tags []tag.Key) (*view.View, error) {
if statsExporter == nil {
log.Info("observability> metrics are disabled")
return nil, nil
}
name := strings.ToLower(nameInput)
viewFind := view.Find(name)
if viewFind != nil {
Expand Down

0 comments on commit b8a8528

Please sign in to comment.