-
Notifications
You must be signed in to change notification settings - Fork 37
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
Report the running version as a metric #163
Conversation
Allows one to display (or superimpose) the version onto grafana graphs, to cross-reference with deployments.
cmd/syncv3/main.go
Outdated
Namespace: "sliding-sync", | ||
Name: "build-info", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be underscores. If not, runtime error.
Need to enable prometheus metrics endpoint in the E2E tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have an entire file called metrics_test.go in integration which do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah but it hooks in further down the stack when making the handlers, not in the cmd binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be as trivial as starting the binary with the SYNCV3_PROM env var set then ensuring /metrics 200 OKs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending E2E tests to check it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't what I was expecting. I would rather we didn't bundle this with end-to-end tests, as it just complicates things.
I was expecting more a simple metrics
job which built, ran and curled /metrics to verify that it returns some data.
For example, we currently have:
where #!/bin/bash -eu
export SYNCV3_BINDADDR=0.0.0.0:8844
# Run the binary and stop it afterwards.
./syncv3 &
SYNCV3_PID=$!
trap "kill $SYNCV3_PID" EXIT
# wait for the server to be listening, we want this endpoint to 404 instead of connrefused
until [ \
"$(curl -s -w '%{http_code}' -o /dev/null "http://localhost:8844/idonotexist")" \
-eq 404 ]
do
echo 'Waiting for server to start...'
sleep 1
done
echo 'Checking client is reachable...'
curl -f -LI "http://localhost:8844/client/" We could easily extend this to check /metrics. |
Oh, I've only just noticed the word
in your comment. I can make this one script if you'd prefer. |
Gonna drop this for now. |
Allows one to display (or superimpose) the version onto grafana graphs, to cross-reference with deployments.