Skip to content

Commit

Permalink
internal/collector: add missing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
talal committed Sep 14, 2021
1 parent 1910675 commit 30b025c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Collector struct {
ExitCodeMetrics map[string]*promhelper.TypedDesc // map of task name to its exit code metric
}

// New returns a new Collector.
func New(maxFailures int) *Collector {
return &Collector{
MaxFailures: maxFailures,
Expand All @@ -35,6 +36,7 @@ func New(maxFailures int) *Collector {
}
}

// AddTask adds a Task to the Collector along with its corresponding exit code TypedDesc.
func (c *Collector) AddTask(shouldAdd bool, task Task, exitCode *promhelper.TypedDesc) {
if shouldAdd {
c.Tasks[task.Name()] = task
Expand Down
1 change: 1 addition & 0 deletions internal/collector/dispersion/dispersion.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/sapcc/swift-health-exporter/internal/util"
)

// GetTaskExitCodeTypedDesc returns a TypedDesc for use with dispersion report tasks.
func GetTaskExitCodeTypedDesc(r prometheus.Registerer) *promhelper.TypedDesc {
taskExitCodeGaugeVec := prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Expand Down
2 changes: 2 additions & 0 deletions internal/collector/recon/recon.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ import (
// This value is overwritten in unit tests.
var isTest = false

// TaskOpts holds common parameters that are used by all recon tasks.
type TaskOpts struct {
PathToExecutable string
HostTimeout int
CtxTimeout time.Duration
}

// GetTaskExitCodeTypedDesc returns a TypedDesc for use with recon tasks.
func GetTaskExitCodeTypedDesc(r prometheus.Registerer) *promhelper.TypedDesc {
taskExitCodeGaugeVec := prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Expand Down

0 comments on commit 30b025c

Please sign in to comment.