libprom  1.2.0
C based libraries to expose metrics in Promtheus exposition format
Functions
promhttp.h File Reference

Provides a HTTP endpoint for metric exposition References: More...

#include <string.h>
#include "microhttpd.h"
#include "prom_collector_registry.h"
Include dependency graph for promhttp.h:

Go to the source code of this file.

Functions

void promhttp_set_active_collector_registry (pcr_t *registry)
 Sets the active registry for metric scraping. More...
 
struct MHD_Daemon * promhttp_start_daemon (unsigned int flags, unsigned short port, MHD_AcceptPolicyCallback apc, void *apc_cls)
 Start a daemon in the background and return a reference to it. More...
 
void promhttp_stop_daemon (struct MHD_Daemon *daemon)
 Shutdown the given HTTP daemon. More...
 

Detailed Description

Provides a HTTP endpoint for metric exposition References:

Function Documentation

◆ promhttp_set_active_collector_registry()

void promhttp_set_active_collector_registry ( pcr_t registry)

Sets the active registry for metric scraping.

Parameters
registryThe target prom registry to generate the report to send in Prometheus exposition format. If NULL is passed, the default registry will be used.
Note
The registry MUST be initialized.

◆ promhttp_start_daemon()

struct MHD_Daemon* promhttp_start_daemon ( unsigned int  flags,
unsigned short  port,
MHD_AcceptPolicyCallback  apc,
void *  apc_cls 
)

Start a daemon in the background and return a reference to it.

References:

Returns
A reference to the started daemon.

◆ promhttp_stop_daemon()

void promhttp_stop_daemon ( struct MHD_Daemon *  daemon)

Shutdown the given HTTP daemon.

This is actually just a 1:1 wrapper around MHD_stop_daemon(daemon). Thus applications using just promhttp_start_daemon() and promhttp_stop_daemon() do not need to be linked against libmicrohttpd (against libpromhttp, only) and thus have only a loose/indirect dependency to libmicrohttpd, what may ease app maintenance.

Parameters
daemonThe daemon to stop.