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 { if !disableMetrics {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() 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() go metricsWorker.Run()
} }

View File

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