shell-operator
shell-operator copied to clipboard
Custom metrics not shown in the list of available metrics
Following the examples from documentation https://flant.github.io/shell-operator/metrics/METRICS_FROM_HOOKS.html#custom-metrics
When adding a metric like below:
echo '{"group":"hook1", "name":"hook_metric", "action":"add", "value":1, "labels":{"kind":"pod"}}' >> $METRICS_PATH
Expected behavior (what you expected to happen):
# HELP hook_metric hook_metric
# TYPE hook_metric counter
hook_metric{hook="hook1.sh", kind="pod"} 1
Actual behavior (what actually happened): This custom metric is not visible in the list of metrics under /metrics endpoint
Steps to reproduce:
Environment:
- Shell-operator version: shell-operator main-8d7ed98e-2023.12.21_12:27:59 jqFilter implementation: use embedded libjq-go
- Kubernetes version: Tested both in Docker and Kubernetes v1.26.6
- Installation type (kubectl apply, helm chart, etc.): Docker
Anything else we should know?:
Additional information for debugging (if necessary):
Dockerfile:
FROM ghcr.io/flant/shell-operator:latest
ADD hooks /hooks
Hook script
if [[ $1 == "--config" ]]; then cat <<EOF configVersion: v1 settings: executionMinInterval: 3s executionBurst: 3 schedule: - name: "every 10 seconds" crontab: "*/10 * * * * *" allowFailure: true EOF else echo '{"group":"hook1", "name":"hook_metric", "action":"add", "value":1, "labels":{"kind":"pod"}}' >> $METRICS_PATH fi
Logs
Hook Metrics should be available under the /metrics/hooks endpoint.