Skip to content

Commit 389f762

Browse files
authored
update docs (#10)
1 parent 8db79fe commit 389f762

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ const (
2929
help = "Pod phase (enum-style, one active per Pod)"
3030
)
3131

32+
// Creating the custom collector
3233
var PodPhase = gvs.NewGaugeVecSet(
3334
namespace, subsystem, name, help,
3435
[]string{"namespace"}, // index
3536
[]string{"pod"}, // group
3637
"phase", // extra (the enum value)
3738
)
3839

40+
// Register the collector once
3941
func init() {
4042
prometheus.MustRegister(PodPhase)
4143
}
@@ -168,20 +170,22 @@ import (
168170
// We need this variable later to create the ConditionMetricsRecorder
169171
var OperatorConditionsGauge *ocg.OperatorConditionsGauge
170172

173+
// Initialize the operator condition gauge once
171174
func init() {
172175
OperatorConditionsGauge = ocg.NewOperatorConditionsGauge("my-operator")
173176
controllermetrics.Registry.MustRegister(OperatorConditionsGauge)
174177
}
175178

176179
// Embed in existing metrics recorder
177180
type MyControllerRecorder struct {
178-
ocg.ConditionMetricRecorder
181+
ocg.ConditionMetricRecorder
179182
}
180183
```
181184

182185
When constructing your reconciler, initialize the condition metrics recorder with the
183186
operator conditions gauge and a unique name for each controller.
184187

188+
_cmd/main.go_
185189
```go
186190
package main
187191

0 commit comments

Comments
 (0)