Skip to content

Commit ada9439

Browse files
committed
doc/../service-monitor.md: Rename file and fix
1 parent 740242f commit ada9439

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

doc/user/metrics/service_monitor.md renamed to doc/user/metrics/service-monitor.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,25 @@ The `GenerateServiceMonitor` takes a `Service` object and generates a `ServiceMo
1313
### Usage example:
1414

1515
```go
16-
import "github.com/operator-framework/operator-sdk/pkg/metrics"
17-
16+
import(
17+
v1 "k8s.io/api/core/v1"
18+
"github.com/operator-framework/operator-sdk/pkg/metrics"
19+
)
20+
21+
// Populate bellow with Service(s) for which you want to create `ServiceMonitor` for.
22+
services := []*v1.Service{}
23+
24+
// Create one `ServiceMonitor` per application per namespace.
25+
// Change below value to name of the Namespace you want the `ServiceMonitor` to be created in.
26+
ns := "default"
27+
1828
// Pass the Service(s) to the helper function, which in turn returns the `ServiceMonitor` object.
19-
serviceMonitors, err := metrics.CreateServiceMonitors(restConfig, "namespace", services)
29+
serviceMonitors, err := metrics.CreateServiceMonitors(restConfig, ns, services)
2030
if err != nil {
2131
// handle error here
2232
}
2333
```
2434

25-
*Note:* Create one `ServiceMonitor` per application and per `Namespace`.
26-
2735
[prom-operator]: https://github.com/coreos/prometheus-operator
2836
[sm]: https://github.com/coreos/prometheus-operator/blob/7a25bf6b6bb2347dacb235659b73bc210117acc7/Documentation/design.md#servicemonitor
2937
[cr]: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

0 commit comments

Comments
 (0)