This commit is contained in:
Arris Li 2023-03-10 11:03:49 +13:00
Родитель 6ecd8312fb
Коммит 8734325163
2 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -348,10 +348,10 @@ func (m *manager) runSteps(ctx context.Context, s []steps.Step, metricsTopic str
if err == nil {
var totalInstallTime int64
for stepName, duration := range stepsTimeRun {
m.metricsEmitter.EmitGauge(fmt.Sprintf("backend.openshiftcluster.%s.%s.time", metricsTopic, stepName), duration, nil)
m.metricsEmitter.EmitGauge(fmt.Sprintf("backend.openshiftcluster.%s.%s.duration.seconds", metricsTopic, stepName), duration, nil)
totalInstallTime += duration
}
m.metricsEmitter.EmitGauge(fmt.Sprintf("backend.openshiftcluster.%s.time.total", metricsTopic), totalInstallTime, nil)
m.metricsEmitter.EmitGauge(fmt.Sprintf("backend.openshiftcluster.%s.duration.total.seconds", metricsTopic), totalInstallTime, nil)
}
} else {
_, err = steps.Run(ctx, m.log, 10*time.Second, s, nil)

Просмотреть файл

@ -262,10 +262,10 @@ func TestInstallationTimeMetrics(t *testing.T) {
steps.AuthorizationRefreshingAction(nil, steps.Action(successfulActionStep)),
},
wantedMetrics: map[string]int64{
"backend.openshiftcluster.install.time.total": 6,
"backend.openshiftcluster.install.action.successfulActionStep.time": 2,
"backend.openshiftcluster.install.condition.successfulConditionStep.time": 2,
"backend.openshiftcluster.install.refreshing.successfulActionStep.time": 2,
"backend.openshiftcluster.install.duration.total.seconds": 6,
"backend.openshiftcluster.install.action.successfulActionStep.duration.seconds": 2,
"backend.openshiftcluster.install.condition.successfulConditionStep.duration.seconds": 2,
"backend.openshiftcluster.install.refreshing.successfulActionStep.duration.seconds": 2,
},
},
{
@ -278,10 +278,10 @@ func TestInstallationTimeMetrics(t *testing.T) {
steps.AuthorizationRefreshingAction(nil, steps.Action(successfulActionStep)),
},
wantedMetrics: map[string]int64{
"backend.openshiftcluster.update.time.total": 9,
"backend.openshiftcluster.update.action.successfulActionStep.time": 3,
"backend.openshiftcluster.update.condition.successfulConditionStep.time": 3,
"backend.openshiftcluster.update.refreshing.successfulActionStep.time": 3,
"backend.openshiftcluster.update.duration.total.seconds": 9,
"backend.openshiftcluster.update.action.successfulActionStep.duration.seconds": 3,
"backend.openshiftcluster.update.condition.successfulConditionStep.duration.seconds": 3,
"backend.openshiftcluster.update.refreshing.successfulActionStep.duration.seconds": 3,
},
},
} {