From b8a8528f6ba402199fbe988310cff2401aacd844 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Wed, 6 Feb 2019 15:37:47 +0100 Subject: [PATCH] fix(api): allow /mon/metrics without jaeger (#3917) Signed-off-by: Yvonnick Esnault --- engine/api/observability/init.go | 5 +---- engine/api/observability/stats.go | 13 ------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/engine/api/observability/init.go b/engine/api/observability/init.go index 61456ffca3..224d924420 100644 --- a/engine/api/observability/init.go +++ b/engine/api/observability/init.go @@ -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 } diff --git a/engine/api/observability/stats.go b/engine/api/observability/stats.go index a8c4247a74..1c2aee2c46 100644 --- a/engine/api/observability/stats.go +++ b/engine/api/observability/stats.go @@ -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 { @@ -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 {