Record idp manager type (#1027)

This allows to define priority on support different managers
This commit is contained in:
Maycon Santos 2023-07-22 19:30:59 +02:00 committed by GitHub
parent 6c2ed4b4f2
commit 76db4f801a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -218,7 +218,11 @@ var (
if !disableMetrics {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
metricsWorker := metrics.NewWorker(ctx, installationID, store, peersUpdateManager)
idpManager := "disabled"
if config.IdpManagerConfig != nil && config.IdpManagerConfig.ManagerType != "" {
idpManager = config.IdpManagerConfig.ManagerType
}
metricsWorker := metrics.NewWorker(ctx, installationID, store, peersUpdateManager, idpManager)
go metricsWorker.Run()
}

View File

@ -59,6 +59,7 @@ type ConnManager interface {
type Worker struct {
ctx context.Context
id string
idpManager string
dataSource DataSource
connManager ConnManager
startupTime time.Time
@ -66,11 +67,12 @@ type Worker struct {
}
// NewWorker returns a metrics worker
func NewWorker(ctx context.Context, id string, dataSource DataSource, connManager ConnManager) *Worker {
func NewWorker(ctx context.Context, id string, dataSource DataSource, connManager ConnManager, idpManager string) *Worker {
currentTime := time.Now()
return &Worker{
ctx: ctx,
id: id,
idpManager: idpManager,
dataSource: dataSource,
connManager: connManager,
startupTime: currentTime,
@ -277,6 +279,7 @@ func (w *Worker) generateProperties() properties {
metricsProperties["min_active_peer_version"] = minActivePeerVersion
metricsProperties["max_active_peer_version"] = maxActivePeerVersion
metricsProperties["ui_clients"] = uiClient
metricsProperties["idp_manager"] = w.idpManager
for protocol, count := range rulesProtocol {
metricsProperties["rules_protocol_"+protocol] = count