-
Notifications
You must be signed in to change notification settings - Fork 469
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 exposition of the Metrics #114
Comments
A possible solution is to add the following function to // Handler creates a prometheus handler to serve the metrics
func Handler(metrics *tusd.Metrics) http.Handler {
prometheus.MustRegister(New(metrics))
return prometheus.Handler()
} But it does not allow to add custom metrics. |
We encountered the exact same problem with the S3Store and ConsulLocker structs. The only proper way to address this is to actually remove the packages from the vendor directory. For example, you will not find github.com/aws/aws-go-sdk or github.com/hashicorp/consul there. I will probably go with a same route to tackle this issue. |
Do you want a PR for this? |
Thank you for offering your help here! I took care of it now because it also requires a few adjustments using govendor (our dependency manager) and the test scripts for Travis/AppVeyor. Please try the above commit :) |
The
prometheuscollector
sub-package gives a short example to make a custom exposition of the metrics:It does however not work when used in an other package (
main
in my case), becausegithub.com/prometheus/client_golang/prometheus
is vendored insidetusd
:If I try to import
"github.com/tus/tusd/vendor/github.com/prometheus/client_golang/prometheus"
instead, it fails withuse of vendored package not allowed
.The text was updated successfully, but these errors were encountered: