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

expose prometheus metrics #99

Closed
djs55 opened this issue May 17, 2017 · 4 comments
Closed

expose prometheus metrics #99

djs55 opened this issue May 17, 2017 · 4 comments

Comments

@djs55
Copy link
Member

djs55 commented May 17, 2017

Now that metrics have been defined for things like

  • bytes read/written/discarded
  • bytes of user data
  • bytes erased/copied/flushed/referenced

It would be nice to be able to easily expose the metrics via the connect API. For example, if the metrics are scraped by prometheus and graphed by grafana:

screenshot

@talex5
Copy link

talex5 commented May 17, 2017

Why does connect need changing? The metrics should be exposed automatically by the prometheus library.

@djs55
Copy link
Member Author

djs55 commented May 17, 2017

I'm looking for a nice place to put this code:

            let module Server = Prometheus_app.Cohttp(Cohttp_lwt_unix.Server) in
            let mode = `TCP (`Port 9090) in (* FIXME: Unix socket *)
            let callback = Server.callback in
            let server = Cohttp_lwt_unix.Server.make ~callback () in
            Lwt.async (fun () -> Cohttp_lwt_unix.Server.create ~mode server);

My particular use-case is a bit funny because the main application (moby/hyperkit) is written in C and uses this code via an OCaml function calling shim.

Maybe I should think of the OCaml shim as being more like a main function rather than just a means of calling read and write and stick the initialisation code there.

(Partly I wanted to create an issue somewhere with a screenshot that I can point people at since I think it looks quite nice!)

@talex5
Copy link

talex5 commented May 17, 2017

Yes, makes sense to keep this out of the API I think.

djs55 added a commit to djs55/hyperkit that referenced this issue May 18, 2017
The qcow library gathers a set of metrics in prometheus format
including

- read, write, discard rate
- bytes used, file size
- bytes erased, deallocated and in various GC states

It's useful to be able to expose these for monitoring, see for example
the Grafana dashboard here:

  mirage/ocaml-qcow#99

This patch adds an optional qcow-stats-config= argument which supports
values

- unix:/path/to/socket -- listen on a Unix domain socket
- tcp:port -- listen on 0.0.0.0:port

(unfortunately the Mirage conduit library doesn't allow the bind address
to be customised, so care must be taken with the tcp: option)

By default nothing is exposed.

Signed-off-by: David Scott <[email protected]>
djs55 added a commit to djs55/hyperkit that referenced this issue May 18, 2017
The qcow library gathers a set of metrics in prometheus format
including

- read, write, discard rate
- bytes used, file size
- bytes erased, deallocated and in various GC states

It's useful to be able to expose these for monitoring, see for example
the Grafana dashboard here:

  mirage/ocaml-qcow#99

This patch adds an optional qcow-stats-config= argument which supports
values

- unix:/path/to/socket -- listen on a Unix domain socket
- tcp:port -- listen on 0.0.0.0:port

(unfortunately the Mirage conduit library doesn't allow the bind address
to be customised, so care must be taken with the tcp: option)

By default nothing is exposed.

Signed-off-by: David Scott <[email protected]>
djs55 added a commit to djs55/hyperkit that referenced this issue May 18, 2017
The qcow library gathers a set of metrics in prometheus format
including

- read, write, discard rate
- bytes used, file size
- bytes erased, deallocated and in various GC states

It's useful to be able to expose these for monitoring, see for example
the Grafana dashboard here:

  mirage/ocaml-qcow#99

This patch adds an optional qcow-stats-config= argument which supports
values

- unix:/path/to/socket -- listen on a Unix domain socket
- tcp:port -- listen on 0.0.0.0:port

(unfortunately the Mirage conduit library doesn't allow the bind address
to be customised, so care must be taken with the tcp: option)

By default nothing is exposed.

Signed-off-by: David Scott <[email protected]>
@samoht
Copy link
Member

samoht commented May 18, 2017

(Partly I wanted to create an issue somewhere with a screenshot that I can point people at since I think it looks quite nice!)

This looks indeed very nice :-)

djs55 added a commit to djs55/hyperkit that referenced this issue May 19, 2017
The qcow library gathers a set of metrics in prometheus format
including

- read, write, discard rate
- bytes used, file size
- bytes erased, deallocated and in various GC states

It's useful to be able to expose these for monitoring, see for example
the Grafana dashboard here:

  mirage/ocaml-qcow#99

This patch adds an optional qcow-stats-config= argument which supports
values

- unix:/path/to/socket -- listen on a Unix domain socket
- tcp:port -- listen on 0.0.0.0:port

(unfortunately the Mirage conduit library doesn't allow the bind address
to be customised, so care must be taken with the tcp: option)

By default nothing is exposed.

Signed-off-by: David Scott <[email protected]>
djs55 added a commit to djs55/ocaml-qcow that referenced this issue Jun 6, 2017
This describes how to turn the metrics on, how to scrape them and
how to render them into a dashboard.

Fixes mirage#99

Signed-off-by: David Scott <[email protected]>
@djs55 djs55 closed this as completed in #100 Dec 7, 2017
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

3 participants