Defines the controller api metrics and registers them at controller startup (#1917)

Co-authored-by: Hugo Vieira <hugoamvieira@users.noreply.github.com>
This commit is contained in:
ToddandHugo Vieira authored and GitHub committed 2022-03-31 08:48:50 -07:00
1 parent 1bb2c5983d
commit 3eb22b073a
16 files changed
+1128 -16

No files matched your search

+7 -2
View File
@@ -10,8 +10,6 @@ import (
"testing"
"time"
"github.com/hashicorp/boundary/internal/session"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/api/authmethods"
@@ -27,10 +25,12 @@ import (
"github.com/hashicorp/boundary/internal/kms"
"github.com/hashicorp/boundary/internal/observability/event"
"github.com/hashicorp/boundary/internal/servers"
"github.com/hashicorp/boundary/internal/session"
"github.com/hashicorp/go-hclog"
wrapping "github.com/hashicorp/go-kms-wrapping/v2"
"github.com/hashicorp/go-secure-stdlib/base62"
"github.com/hashicorp/go-secure-stdlib/strutil"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/test/bufconn"
@@ -393,6 +393,10 @@ type TestControllerOpts struct {
// The logger to use, or one will be created
Logger hclog.Logger
// The registerer to use for registering all the collectors. Nil means
// no metrics are registered.
PrometheusRegisterer prometheus.Registerer
// A cluster address for overriding the advertised controller listener
// (overrides address provided in config, if any)
PublicClusterAddr string
@@ -519,6 +523,7 @@ func TestControllerConfig(t *testing.T, ctx context.Context, tc *TestController,
})
}
tc.b.PrometheusRegisterer = opts.PrometheusRegisterer
if opts.Config.Controller == nil {
opts.Config.Controller = new(config.Controller)
}