Skip to content

Commit 8f6c21c

Browse files
authored
Add docs about internal REST api and config validation (#55)
* Add docs about internal REST api and config validation Signed-off-by: Jirka Kremser <jiri.kremser@gmail.com> * add otelbin Signed-off-by: Jirka Kremser <jiri.kremser@gmail.com> --------- Signed-off-by: Jirka Kremser <jiri.kremser@gmail.com>
1 parent b5c1110 commit 8f6c21c

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,53 @@ helm upgrade -i kedify-otel oci://ghcr.io/kedify/charts/otel-add-on --version=v0
9797
```bash
9898
k apply -f examples/so.yaml
9999
```
100+
101+
## Troubleshooting
102+
103+
To figure out the actual value of a metric query, there is a simple REST api that can be used:
104+
105+
```bash
106+
(kubectl port-forward svc/keda-otel-scaler 9090&)
107+
# swagger doc: http://localhost:9090/swagger/index.html
108+
# test the existing metric query
109+
curl -X 'POST' \
110+
'http://localhost:9090/memstore/query' \
111+
-H 'accept: application/json' \
112+
-H 'Content-Type: application/json' \
113+
-d '{
114+
"operationOverTime": "last_one",
115+
"query": "kube_deployment_status_replicas_available{deployment=foo,namespace=observability}"
116+
}'
117+
{
118+
"ok": true,
119+
"operation": "query",
120+
"error": "",
121+
"value": 1
122+
}
123+
124+
# check the data if the labels are stored there correctly:
125+
curl -X 'GET' \
126+
'http://localhost:9090/memstore/data' \
127+
-H 'accept: application/json' | jq '.kube_deployment_status_replicas_available[].labels'
128+
{
129+
"deployment": "keda-operator",
130+
"namespace": "keda"
131+
}
132+
```
133+
134+
### Configuration for OTEL collector
135+
136+
This repo has the OTEL collector helm chart as a dependency and some issues in the configuration are guarded
137+
by their upstream JSON Schema, but some are not, and it's a good idea to run the validator (especially if it's part
138+
of a CI/CD pipeline):
139+
140+
```
141+
# 1) download the binary
142+
VERSION=0.117.0
143+
curl -sL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v${VERSION}/otelcol-contrib_${VERSION}_$(go env GOOS)_$(go env GOARCH).tar.gz | tar xvz - -C .
144+
145+
# 2) run the validator against your helm chart values
146+
./otel-contrib validate --config=<(cat values.yaml | yq '.opentelemetry-collector.alternateConfig')
147+
```
148+
149+
Alternatively, you may want to use online tools such as [otelbin.io](https://www.otelbin.io/).

0 commit comments

Comments
 (0)