Skip to content

Commit

Permalink
[Tasks] get rid of unused counters (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
SvartMetal authored Feb 10, 2024
1 parent 8615cdc commit b70871e
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions cloud/tasks/runner_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,13 @@ type taskMetrics struct {
////////////////////////////////////////////////////////////////////////////////

type runnerMetricsImpl struct {
registry metrics.Registry
otherErrorsCounter metrics.Counter
wrongGenerationErrorsCounter metrics.Counter
hangingTaskTimeout time.Duration
exceptHangingTaskTypes []string
taskMetrics *taskMetrics
taskMetricsMutex sync.Mutex
onExecutionStopped func()
logger logging.Logger
registry metrics.Registry
hangingTaskTimeout time.Duration
exceptHangingTaskTypes []string
taskMetrics *taskMetrics
taskMetricsMutex sync.Mutex
onExecutionStopped func()
logger logging.Logger
}

func (m *runnerMetricsImpl) OnExecutionStarted(state tasks_storage.TaskState) {
Expand Down Expand Up @@ -189,12 +187,7 @@ func (m *runnerMetricsImpl) OnError(err error) {
if errors.Is(err, errors.NewWrongGenerationError()) {
if m.taskMetrics != nil {
m.taskMetrics.wrongGenerationErrorsCounter.Inc()
} else {
m.wrongGenerationErrorsCounter.Inc()
}
} else {
// Other errors.
m.otherErrorsCounter.Inc()
}
}

Expand Down Expand Up @@ -255,12 +248,10 @@ func newRunnerMetrics(
) *runnerMetricsImpl {

return &runnerMetricsImpl{
registry: registry,
otherErrorsCounter: registry.Counter("errors/other"),
wrongGenerationErrorsCounter: registry.Counter("errors/wrongGeneration"),
hangingTaskTimeout: hangingTaskTimeout,
exceptHangingTaskTypes: exceptHangingTaskTypes,
onExecutionStopped: func() {},
logger: logging.GetLogger(ctx),
registry: registry,
hangingTaskTimeout: hangingTaskTimeout,
exceptHangingTaskTypes: exceptHangingTaskTypes,
onExecutionStopped: func() {},
logger: logging.GetLogger(ctx),
}
}

0 comments on commit b70871e

Please sign in to comment.