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

Including the varnish exporter as a go module in another binary. #49

Open
glennslaven opened this issue Aug 18, 2019 · 0 comments
Open

Comments

@glennslaven
Copy link
Contributor

glennslaven commented Aug 18, 2019

  • Varnish Any
  • prometheus_varnish_exporter 1.5.1

This is more of a question/feature request than an issue.

So, we run Varnish in a Docker container, and we have a go binary that we use as the entry point to run varnish and handle VCL updates and a few other things. One of the other things it does is provide a Prometheus exporter for some internal metrics. We were running the prometheus_varnish_exporter as a separate process, but having two exporters on different ports seemed redundant and made for overcomplicating our Prometheus scrape configs.

So we looked at how we could include the Prometheus metrics in the same exporter. I couldn't see an easy way to include the prometheus_varnish_exporter metrics in an existing exporter's registry. All the logic exists in the main module and go won't let you import another main module into your own.

So for now what I've done is to fork and move the metrics collection logic into a sub-module (see section-io@48922e4). That way we can just import the github.com/jonnenauha/prometheus_varnish_exporter/varnishexporter module (sorry, naming is hard) to then publish those metrics in the current exporter we use. This could probably be done better. I'm not thrilled with the separation of responsibilities between the main and varnishexporter modules. For example, there's no reason for the submodule to know about the HealthPath property, but I was trying to limit the changes in this first pass.

So I guess I have two questions:

  1. Is there a better way to get access to the Varnish metrics provided by this module in the context of another go binary and existing Prometheus exporter?
  2. If not, would you be interested in having this submodule pattern merged upstream into this repository?
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

1 participant