Skip to content

Commit

Permalink
Reinstate the submariner_service_export metric
Browse files Browse the repository at this point in the history
This got lost in the shuffle during during the refactoring in the 0.15 release.

Fixes #1363

Signed-off-by: Tom Pantelis <[email protected]>
  • Loading branch information
tpantelis committed Sep 20, 2023
1 parent a3cc31a commit 7309d2b
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions pkg/agent/controller/service_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,6 @@ func newServiceImportController(spec *AgentSpecification, syncerMetricNames Agen
serviceExportClient: serviceExportClient,
}

syncCounter := prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: syncerMetricNames.ServiceImportCounterName,
Help: "Count of imported services",
},
[]string{
syncer.DirectionLabel,
syncer.OperationLabel,
syncer.SyncerNameLabel,
},
)
prometheus.MustRegister(syncCounter)

var err error

controller.localSyncer, err = syncer.NewResourceSyncer(&syncer.ResourceSyncerConfig{
Expand All @@ -81,7 +68,10 @@ func newServiceImportController(spec *AgentSpecification, syncerMetricNames Agen
ResourceType: &mcsv1a1.ServiceImport{},
Transform: controller.onLocalServiceImport,
Scheme: syncerConfig.Scheme,
SyncCounter: syncCounter,
SyncCounterOpts: &prometheus.GaugeOpts{
Name: syncerMetricNames.ServiceExportCounterName,
Help: "Count of exported services",
},
})
if err != nil {
return nil, errors.Wrap(err, "error creating local ServiceImport syncer")
Expand All @@ -107,6 +97,10 @@ func newServiceImportController(spec *AgentSpecification, syncerMetricNames Agen
OnSuccessfulSync: controller.serviceImportMigrator.onSuccessfulSyncFromBroker,
Scheme: syncerConfig.Scheme,
ResyncPeriod: brokerResyncePeriod,
SyncCounterOpts: &prometheus.GaugeOpts{
Name: syncerMetricNames.ServiceImportCounterName,
Help: "Count of imported services",
},
})
if err != nil {
return nil, errors.Wrap(err, "error creating ServiceImport watcher")
Expand Down

0 comments on commit 7309d2b

Please sign in to comment.