Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom metrics not shown in the list of available metrics #571

Open
julian-vp opened this issue Dec 21, 2023 · 1 comment
Open

Custom metrics not shown in the list of available metrics #571

julian-vp opened this issue Dec 21, 2023 · 1 comment

Comments

@julian-vp
Copy link

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

@adberger
Copy link

Hook Metrics should be available under the /metrics/hooks endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants