-
Notifications
You must be signed in to change notification settings - Fork 708
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
Use the new prometheus http API #71
Use the new prometheus http API #71
Conversation
The new recommended way of using the prometheus http handler is through the promhttp package: https://github.com/prometheus/client_golang/releases/tag/v0.8.0 (Separated HTTP exposition, allowing custom HTTP handlers (package promhttp))
Hi @juergenhoetzel, thanks for the PR! The build fails because of missing vendoring, could you add promhttp as a vendored package? |
@juergenhoetzel Good work! For the pr to land, you'll also need to commit the changes in vendor, because it is still failing on missing promhttp. Appveyour output: https://ci.appveyor.com/project/martinlindhe/wmi-exporter/build/258/job/x5ucqsbxku8huu96
|
if err := http.ListenAndServe(*listenAddress, nil); err != nil { | ||
log.Fatalf("cannot start WMI exporter: %s", err) | ||
} | ||
log.Fatalf("cannot start WMI exporter: %s", http.ListenAndServe(*listenAddress, nil)) |
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.
Not sure this is correct.
log.Fatal() simply exits the program. You'll still need to do as before, that is checking for error.
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.
Hi @martinlindhe
http.ListenAndServer
only returns when an error occured. I.e. it never returns nil. This style is also used in the official Go http documentation
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, that's all good then! I was under the wrong impression it was non-blocking
.gitignore
Outdated
VERSION | ||
vendor/*/ |
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 is wrong. We do version the vendor folder.
appveyor.yml
Outdated
@@ -21,6 +21,7 @@ install: | |||
|
|||
build_script: | |||
- ps: gitversion /output json /showvariable FullSemVer | Set-Content VERSION -PassThru | |||
- govendor sync |
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 is wrong. We commit the vendor folder for reproducible builds.
@martinlindhe Thanks for the hint. I didn't used govendor before. I removed all vendored sources and and used the sync functionality instead: https://github.com/kardianos/govendor . |
@juergenhoetzel For vendoring, all you need to do is, manually
This gives us a working snapshot of correct vendored dependencies, |
Make sense. I will revert/amend the change. |
Feel free to just commit additional changes to this branch (if that is less work), we can merge the PR as a single commit when done |
I seem to have forgotten how to use govendor. I think the proper usage is something like:
|
Thanks for your feedback. I actually used govendor.exe fetch github.com/prometheus/client_golang/prometheus/... to update all referenced packages under the What started as an small 😆 |
Thanks for your work, looks good! |
prometheus/client_golang#214
Thanks for this package! 👍