server package:ekg

A handle that can be used to control the monitoring server. Created by forkServer.
The metric store associated with the server. If you want to add metric to the default store created by forkServer you need to use this function to retrieve it.
The thread ID of the server. You can kill the server by killing this thread (i.e. by throwing it an asynchronous exception.)
Like forkServerWith, but creates a default metric store with some predefined metrics. The predefined metrics are those given in registerGcMetrics.
Create a server with prefined metrics from registerGcMetrics, listening on all interfaces. If you are running EKG on a private network (including virtual private network), it may be appropriate to bind to all interfaces, not only localhost.
Start an HTTP server in a new thread, with the specified metrics store, listening on all interfaces. Other than accepting requests to any hostname, this is the same as forkServerWith.
Start an HTTP server in a new thread. The server replies to GET requests to the given host and port. The host argument can be either a numeric network address (dotted quad for IPv4, colon-separated hex for IPv6) or a hostname (e.g. "localhost".) The client can control the Content-Type used in responses by setting the Accept header. At the moment two content types are available: "application/json" and "text/html". Registers the following counter, used by the UI:
  • ekg.server_time_ms The server time when the sample was taken, in milliseconds.
Note that this function, unlike forkServer, doesn't register any other predefined metrics. This allows other libraries to create and provide a metric store for use with this library. If the metric store isn't created by you and the creator doesn't register the metrics registered by forkServer, you might want to register them yourself.