Skip to content

Commit fe957bc

Browse files
Merge pull request #456 from supreeth7/monitoring-doc
Add how to view metrics section
2 parents bc353f0 + 7f80ff4 commit fe957bc

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ This command will:
115115
make setup-addon-operator-crds
116116

117117
# Make sure we run against the new kind cluster.
118-
export KUBECONFIG=$PWD/.cache/integration/kubeconfig
118+
export KUBECONFIG=$PWD/.cache/dev-env/kubeconfig
119119

120120
# Set Addon operator namespace environment variable
121121
export ADDON_OPERATOR_NAMESPACE=addon-operator
@@ -153,7 +153,7 @@ Make sure to:
153153

154154
## Monitoring and metrics
155155

156-
The AddonOperator is instrumented with the prometheus-client provided by controller-runtime to record some useful Addon metrics.
156+
The Addon Operator is instrumented with the prometheus-client provided by controller-runtime to record some useful Addon metrics.
157157

158158
| Metric name | Type | Description |
159159
|---------------------------------------------|------------|-----------------------------------------------------------------------------------------|
@@ -164,6 +164,36 @@ The AddonOperator is instrumented with the prometheus-client provided by control
164164

165165
See [Quickstart](https://github.com/openshift/addon-operator#quickstart--develop-integration-tests) for instructions on how to setup a local monitoring stack for development / testing.
166166

167+
## How to: Test metrics locally
168+
169+
The Addon Operator metrics can be exposed locally by port forwarding the `addon-operator-metrics` service which allows users to access the service running inside a Kubernetes cluster from their local machine.
170+
171+
- Run Addon Operator locally:
172+
173+
```bash
174+
export ENABLE_MONITORING=true
175+
176+
➜ make test-setup
177+
```
178+
179+
- Ensure you have the `KUBECONFIG` environment variable setup:
180+
181+
```bash
182+
export KUBECONFIG=/.cache/dev-env/kubeconfig.yaml
183+
```
184+
185+
- Forward traffic from port `8443` on the `addon-operator-metrics` service:
186+
187+
```bash
188+
➜ kubectl port-forward service/addon-operator-metrics -n addon-operator 8443:8443
189+
```
190+
191+
- Fetch the metrics:
192+
193+
```bash
194+
➜ curl -k https://localhost:8443/metrics
195+
```
196+
167197
## Releasing
168198

169199
```sh

0 commit comments

Comments
 (0)