2 * collectd - src/write_prometheus.c
3 * Copyright (C) 2016 Florian octo Forster
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * Florian octo Forster <octo at collectd.org>
31 #include "utils_avltree.h"
32 #include "utils_complain.h"
33 #include "utils_time.h"
35 #include "prometheus.pb-c.h"
37 #include <microhttpd.h>
39 #ifndef PROMETHEUS_DEFAULT_STALENESS_DELTA
40 #define PROMETHEUS_DEFAULT_STALENESS_DELTA TIME_T_TO_CDTIME_T(300)
43 #define VARINT_UINT32_BYTES 5
45 #define CONTENT_TYPE_PROTO \
46 "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; " \
48 #define CONTENT_TYPE_TEXT "text/plain; version=0.0.4"
50 static c_avl_tree_t *metrics;
51 static pthread_mutex_t metrics_lock = PTHREAD_MUTEX_INITIALIZER;
53 static unsigned short httpd_port = 9103;
54 static struct MHD_Daemon *httpd;
56 static cdtime_t staleness_delta = PROMETHEUS_DEFAULT_STALENESS_DELTA;
58 /* Unfortunately, protoc-c doesn't export it's implementation of varint, so we
59 * need to implement our own. */
60 static size_t varint(uint8_t buffer[static VARINT_UINT32_BYTES],
62 for (size_t i = 0; i < VARINT_UINT32_BYTES; i++) {
63 buffer[i] = (uint8_t)(value & 0x7f);
75 /* format_protobuf iterates over all metric families in "metrics" and adds them
76 * to a buffer in ProtoBuf format. It prefixes each protobuf with its encoded
77 * size, the so called "delimited" format. */
78 static void format_protobuf(ProtobufCBuffer *buffer) {
79 pthread_mutex_lock(&metrics_lock);
82 Io__Prometheus__Client__MetricFamily *fam;
83 c_avl_iterator_t *iter = c_avl_get_iterator(metrics);
84 while (c_avl_iterator_next(iter, (void *)&unused_name, (void *)&fam) == 0) {
85 /* Prometheus uses a message length prefix to determine where one
86 * MetricFamily ends and the next begins. This delimiter is encoded as a
87 * "varint", which is common in Protobufs. */
88 uint8_t delim[VARINT_UINT32_BYTES] = {0};
89 size_t delim_len = varint(
91 (uint32_t)io__prometheus__client__metric_family__get_packed_size(fam));
92 buffer->append(buffer, delim_len, delim);
94 io__prometheus__client__metric_family__pack_to_buffer(fam, buffer);
96 c_avl_iterator_destroy(iter);
98 pthread_mutex_unlock(&metrics_lock);
101 /* format_labels formats a metric's labels in Prometheus-compatible format. This
102 * format looks like this:
104 * key0="value0",key1="value1"
106 static char *format_labels(char *buffer, size_t buffer_size,
107 Io__Prometheus__Client__Metric const *m) {
108 /* our metrics always have at least one and at most three labels. */
109 assert(m->n_label >= 1);
110 assert(m->n_label <= 3);
112 #define LABEL_BUFFER_SIZE (2 * DATA_MAX_NAME_LEN + 4)
115 (char[LABEL_BUFFER_SIZE]){0}, (char[LABEL_BUFFER_SIZE]){0},
116 (char[LABEL_BUFFER_SIZE]){0},
119 for (size_t i = 0; i < m->n_label; i++)
120 ssnprintf(labels[i], LABEL_BUFFER_SIZE, "%s=\"%s\"", m->label[i]->name,
123 strjoin(buffer, buffer_size, labels, m->n_label, ",");
127 /* format_protobuf iterates over all metric families in "metrics" and adds them
128 * to a buffer in plain text format. */
129 static void format_text(ProtobufCBuffer *buffer) {
130 pthread_mutex_lock(&metrics_lock);
133 Io__Prometheus__Client__MetricFamily *fam;
134 c_avl_iterator_t *iter = c_avl_get_iterator(metrics);
135 while (c_avl_iterator_next(iter, (void *)&unused_name, (void *)&fam) == 0) {
136 char line[1024]; /* 4x DATA_MAX_NAME_LEN? */
138 ssnprintf(line, sizeof(line), "# HELP %s %s\n", fam->name, fam->help);
139 buffer->append(buffer, strlen(line), (uint8_t *)line);
141 ssnprintf(line, sizeof(line), "# TYPE %s %s\n", fam->name,
142 (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__GAUGE)
145 buffer->append(buffer, strlen(line), (uint8_t *)line);
147 for (size_t i = 0; i < fam->n_metric; i++) {
148 Io__Prometheus__Client__Metric *m = fam->metric[i];
152 char timestamp_ms[24] = "";
153 if (m->has_timestamp_ms)
154 ssnprintf(timestamp_ms, sizeof(timestamp_ms), " %" PRIi64,
157 if (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__GAUGE)
158 ssnprintf(line, sizeof(line), "%s{%s} " GAUGE_FORMAT "%s\n", fam->name,
159 format_labels(labels, sizeof(labels), m), m->gauge->value,
161 else /* if (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__COUNTER) */
162 ssnprintf(line, sizeof(line), "%s{%s} %.0f%s\n", fam->name,
163 format_labels(labels, sizeof(labels), m), m->counter->value,
166 buffer->append(buffer, strlen(line), (uint8_t *)line);
169 c_avl_iterator_destroy(iter);
172 ssnprintf(server, sizeof(server), "\n# collectd/write_prometheus %s at %s\n",
173 PACKAGE_VERSION, hostname_g);
174 buffer->append(buffer, strlen(server), (uint8_t *)server);
176 pthread_mutex_unlock(&metrics_lock);
179 /* http_handler is the callback called by the microhttpd library. It essentially
180 * handles all HTTP request aspects and creates an HTTP response. */
181 static int http_handler(void *cls, struct MHD_Connection *connection,
182 const char *url, const char *method,
183 const char *version, const char *upload_data,
184 size_t *upload_data_size, void **connection_state) {
185 if (strcmp(method, MHD_HTTP_METHOD_GET) != 0) {
189 /* On the first call for each connection, return without anything further.
190 * Apparently not everything has been initialized yet or so; the docs are not
191 * very specific on the issue. */
192 if (*connection_state == NULL) {
193 /* set to a random non-NULL pointer. */
194 *connection_state = &(int){42};
198 char const *accept = MHD_lookup_connection_value(connection, MHD_HEADER_KIND,
199 MHD_HTTP_HEADER_ACCEPT);
202 (strstr(accept, "application/vnd.google.protobuf") != NULL);
204 uint8_t scratch[4096] = {0};
205 ProtobufCBufferSimple simple = PROTOBUF_C_BUFFER_SIMPLE_INIT(scratch);
206 ProtobufCBuffer *buffer = (ProtobufCBuffer *)&simple;
209 format_protobuf(buffer);
213 struct MHD_Response *res = MHD_create_response_from_data(
214 simple.len, simple.data, /* must_free = */ 0, /* must_copy = */ 1);
215 MHD_add_response_header(res, MHD_HTTP_HEADER_CONTENT_TYPE,
216 want_proto ? CONTENT_TYPE_PROTO : CONTENT_TYPE_TEXT);
218 int status = MHD_queue_response(connection, MHD_HTTP_OK, res);
220 MHD_destroy_response(res);
221 PROTOBUF_C_BUFFER_SIMPLE_CLEAR(&simple);
226 * Functions for manipulating the global state in "metrics". This is organized
227 * in two tiers: the global "metrics" tree holds "metric families", which are
228 * identified by a name (a string). Each metric family has one or more
229 * "metrics", which are identified by a unique set of key-value-pairs. For
233 * {cpu="0",type="idle"}
234 * {cpu="0",type="user"}
241 /* label_pair_destroy frees the memory used by a label pair. */
242 static void label_pair_destroy(Io__Prometheus__Client__LabelPair *msg) {
252 /* label_pair_clone allocates and initializes a new label pair. */
253 static Io__Prometheus__Client__LabelPair *
254 label_pair_clone(Io__Prometheus__Client__LabelPair const *orig) {
255 Io__Prometheus__Client__LabelPair *copy = calloc(1, sizeof(*copy));
258 io__prometheus__client__label_pair__init(copy);
260 copy->name = strdup(orig->name);
261 copy->value = strdup(orig->value);
262 if ((copy->name == NULL) || (copy->value == NULL)) {
263 label_pair_destroy(copy);
270 /* metric_destroy frees the memory used by a metric. */
271 static void metric_destroy(Io__Prometheus__Client__Metric *msg) {
275 for (size_t i = 0; i < msg->n_label; i++) {
276 label_pair_destroy(msg->label[i]);
286 /* metric_cmp compares two metrics. It's prototype makes it easy to use with
287 * qsort(3) and bsearch(3). */
288 static int metric_cmp(void const *a, void const *b) {
289 Io__Prometheus__Client__Metric const *m_a =
290 *((Io__Prometheus__Client__Metric **)a);
291 Io__Prometheus__Client__Metric const *m_b =
292 *((Io__Prometheus__Client__Metric **)b);
294 if (m_a->n_label < m_b->n_label)
296 else if (m_a->n_label > m_b->n_label)
299 /* Prometheus does not care about the order of labels. All labels in this
300 * plugin are created by METRIC_ADD_LABELS(), though, and therefore always
301 * appear in the same order. We take advantage of this and simplify the check
302 * by making sure all labels are the same in each position.
304 * We also only need to check the label values, because the label names are
305 * the same for all metrics in a metric family.
308 * [0] $plugin="$plugin_instance" => $plugin is the same within a family
309 * [1] type="$type_instance" => "type" is a static string
310 * [2] instance="$host" => "instance" is a static string
312 * 2 labels, variant 1:
313 * [0] $plugin="$plugin_instance" => $plugin is the same within a family
314 * [1] instance="$host" => "instance" is a static string
316 * 2 labels, variant 2:
317 * [0] $plugin="$type_instance" => $plugin is the same within a family
318 * [1] instance="$host" => "instance" is a static string
321 * [1] instance="$host" => "instance" is a static string
323 for (size_t i = 0; i < m_a->n_label; i++) {
324 int status = strcmp(m_a->label[i]->value, m_b->label[i]->value);
329 assert(strcmp(m_a->label[i]->name, m_b->label[i]->name) == 0);
336 #define METRIC_INIT \
337 &(Io__Prometheus__Client__Metric) { \
339 (Io__Prometheus__Client__LabelPair *[]){ \
340 &(Io__Prometheus__Client__LabelPair){ \
343 &(Io__Prometheus__Client__LabelPair){ \
346 &(Io__Prometheus__Client__LabelPair){ \
353 #define METRIC_ADD_LABELS(m, vl) \
355 if (strlen((vl)->plugin_instance) != 0) { \
356 (m)->label[(m)->n_label]->name = (char *)(vl)->plugin; \
357 (m)->label[(m)->n_label]->value = (char *)(vl)->plugin_instance; \
361 if (strlen((vl)->type_instance) != 0) { \
362 (m)->label[(m)->n_label]->name = "type"; \
363 if (strlen((vl)->plugin_instance) == 0) \
364 (m)->label[(m)->n_label]->name = (char *)(vl)->plugin; \
365 (m)->label[(m)->n_label]->value = (char *)(vl)->type_instance; \
369 (m)->label[(m)->n_label]->name = "instance"; \
370 (m)->label[(m)->n_label]->value = (char *)(vl)->host; \
374 /* metric_clone allocates and initializes a new metric based on orig. */
375 static Io__Prometheus__Client__Metric *
376 metric_clone(Io__Prometheus__Client__Metric const *orig) {
377 Io__Prometheus__Client__Metric *copy = calloc(1, sizeof(*copy));
380 io__prometheus__client__metric__init(copy);
382 copy->n_label = orig->n_label;
383 copy->label = calloc(copy->n_label, sizeof(*copy->label));
384 if (copy->label == NULL) {
389 for (size_t i = 0; i < copy->n_label; i++) {
390 copy->label[i] = label_pair_clone(orig->label[i]);
391 if (copy->label[i] == NULL) {
392 metric_destroy(copy);
400 /* metric_update stores the new value and timestamp in m. */
401 static int metric_update(Io__Prometheus__Client__Metric *m, value_t value,
402 int ds_type, cdtime_t t, cdtime_t interval) {
403 if (ds_type == DS_TYPE_GAUGE) {
405 if (m->gauge == NULL) {
406 m->gauge = calloc(1, sizeof(*m->gauge));
407 if (m->gauge == NULL)
409 io__prometheus__client__gauge__init(m->gauge);
412 m->gauge->value = (double)value.gauge;
413 m->gauge->has_value = 1;
414 } else { /* not gauge */
416 if (m->counter == NULL) {
417 m->counter = calloc(1, sizeof(*m->counter));
418 if (m->counter == NULL)
420 io__prometheus__client__counter__init(m->counter);
424 case DS_TYPE_ABSOLUTE:
425 m->counter->value = (double)value.absolute;
427 case DS_TYPE_COUNTER:
428 m->counter->value = (double)value.counter;
431 m->counter->value = (double)value.derive;
434 m->counter->has_value = 1;
437 /* Prometheus has a globally configured timeout after which metrics are
438 * considered stale. This causes problems when metrics have an interval
439 * exceeding that limit. We emulate the behavior of "pushgateway" and *not*
440 * send a timestamp value – Prometheus will fill in the current time. */
441 if (interval <= staleness_delta) {
442 m->timestamp_ms = CDTIME_T_TO_MS(t);
443 m->has_timestamp_ms = 1;
445 static c_complain_t long_metric = C_COMPLAIN_INIT_STATIC;
447 LOG_NOTICE, &long_metric,
448 "write_prometheus plugin: You have metrics with an interval exceeding "
449 "\"StalenessDelta\" setting (%.3fs). This is suboptimal, please check "
450 "the collectd.conf(5) manual page to understand what's going on.",
451 CDTIME_T_TO_DOUBLE(staleness_delta));
454 m->has_timestamp_ms = 0;
460 /* metric_family_add_metric adds m to the metric list of fam. */
461 static int metric_family_add_metric(Io__Prometheus__Client__MetricFamily *fam,
462 Io__Prometheus__Client__Metric *m) {
463 Io__Prometheus__Client__Metric **tmp =
464 realloc(fam->metric, (fam->n_metric + 1) * sizeof(*fam->metric));
469 fam->metric[fam->n_metric] = m;
472 /* Sort the metrics so that lookup is fast. */
473 qsort(fam->metric, fam->n_metric, sizeof(*fam->metric), metric_cmp);
478 /* metric_family_delete_metric looks up and deletes the metric corresponding to
481 metric_family_delete_metric(Io__Prometheus__Client__MetricFamily *fam,
482 value_list_t const *vl) {
483 Io__Prometheus__Client__Metric *key = METRIC_INIT;
484 METRIC_ADD_LABELS(key, vl);
487 for (i = 0; i < fam->n_metric; i++) {
488 if (metric_cmp(&key, &fam->metric[i]) == 0)
492 if (i >= fam->n_metric)
495 metric_destroy(fam->metric[i]);
496 if ((fam->n_metric - 1) > i)
497 memmove(&fam->metric[i], &fam->metric[i + 1],
498 ((fam->n_metric - 1) - i) * sizeof(fam->metric[i]));
501 Io__Prometheus__Client__Metric **tmp =
502 realloc(fam->metric, fam->n_metric * sizeof(*fam->metric));
503 if ((tmp != NULL) || (fam->n_metric == 0))
509 /* metric_family_get_metric looks up the matching metric in a metric family,
510 * allocating it if necessary. */
511 static Io__Prometheus__Client__Metric *
512 metric_family_get_metric(Io__Prometheus__Client__MetricFamily *fam,
513 value_list_t const *vl) {
514 Io__Prometheus__Client__Metric *key = METRIC_INIT;
515 METRIC_ADD_LABELS(key, vl);
517 /* Metrics are sorted in metric_family_add_metric() so that we can do a binary
519 Io__Prometheus__Client__Metric **m = bsearch(
520 &key, fam->metric, fam->n_metric, sizeof(*fam->metric), metric_cmp);
526 Io__Prometheus__Client__Metric *new_metric = metric_clone(key);
527 if (new_metric == NULL)
530 DEBUG("write_prometheus plugin: created new metric in family");
531 int status = metric_family_add_metric(fam, new_metric);
533 metric_destroy(new_metric);
540 /* metric_family_update looks up the matching metric in a metric family,
541 * allocating it if necessary, and updates the metric to the latest value. */
542 static int metric_family_update(Io__Prometheus__Client__MetricFamily *fam,
543 data_set_t const *ds, value_list_t const *vl,
545 Io__Prometheus__Client__Metric *m = metric_family_get_metric(fam, vl);
549 return metric_update(m, vl->values[ds_index], ds->ds[ds_index].type, vl->time,
553 /* metric_family_destroy frees the memory used by a metric family. */
554 static void metric_family_destroy(Io__Prometheus__Client__MetricFamily *msg) {
561 for (size_t i = 0; i < msg->n_metric; i++) {
562 metric_destroy(msg->metric[i]);
569 /* metric_family_create allocates and initializes a new metric family. */
570 static Io__Prometheus__Client__MetricFamily *
571 metric_family_create(char *name, data_set_t const *ds, value_list_t const *vl,
573 Io__Prometheus__Client__MetricFamily *msg = calloc(1, sizeof(*msg));
576 io__prometheus__client__metric_family__init(msg);
583 "write_prometheus plugin: '%s' Type: '%s', Dstype: '%s', Dsname: '%s'",
584 vl->plugin, vl->type, DS_TYPE_TO_STRING(ds->ds[ds_index].type),
585 ds->ds[ds_index].name);
586 msg->help = strdup(help);
588 msg->type = (ds->ds[ds_index].type == DS_TYPE_GAUGE)
589 ? IO__PROMETHEUS__CLIENT__METRIC_TYPE__GAUGE
590 : IO__PROMETHEUS__CLIENT__METRIC_TYPE__COUNTER;
596 /* metric_family_name creates a metric family's name from a data source. This is
597 * done in the same way as done by the "collectd_exporter" for best possible
598 * compatibility. In essence, the plugin, type and data source name go in the
599 * metric family name, while hostname, plugin instance and type instance go into
600 * the labels of a metric. */
601 static char *metric_family_name(data_set_t const *ds, value_list_t const *vl,
603 char const *fields[5] = {"collectd"};
604 size_t fields_num = 1;
606 if (strcmp(vl->plugin, vl->type) != 0) {
607 fields[fields_num] = vl->plugin;
610 fields[fields_num] = vl->type;
613 if (strcmp("value", ds->ds[ds_index].name) != 0) {
614 fields[fields_num] = ds->ds[ds_index].name;
618 /* Prometheus best practices:
619 * cumulative metrics should have a "total" suffix. */
620 if ((ds->ds[ds_index].type == DS_TYPE_COUNTER) ||
621 (ds->ds[ds_index].type == DS_TYPE_DERIVE)) {
622 fields[fields_num] = "total";
626 char name[5 * DATA_MAX_NAME_LEN];
627 strjoin(name, sizeof(name), (char **)fields, fields_num, "_");
631 /* metric_family_get looks up the matching metric family, allocating it if
633 static Io__Prometheus__Client__MetricFamily *
634 metric_family_get(data_set_t const *ds, value_list_t const *vl,
636 char *name = metric_family_name(ds, vl, ds_index);
638 ERROR("write_prometheus plugin: Allocating metric family name failed.");
642 Io__Prometheus__Client__MetricFamily *fam = NULL;
643 if (c_avl_get(metrics, name, (void *)&fam) == 0) {
649 fam = metric_family_create(name, ds, vl, ds_index);
651 ERROR("write_prometheus plugin: Allocating metric family failed.");
656 /* If successful, "name" is owned by "fam", i.e. don't free it here. */
657 DEBUG("write_prometheus plugin: metric family \"%s\" has been created.",
661 int status = c_avl_insert(metrics, fam->name, fam);
663 ERROR("write_prometheus plugin: Adding \"%s\" failed.", name);
664 metric_family_destroy(fam);
675 static int prom_config(oconfig_item_t *ci) {
676 for (int i = 0; i < ci->children_num; i++) {
677 oconfig_item_t *child = ci->children + i;
679 if (strcasecmp("Port", child->key) == 0) {
680 int status = cf_util_get_port_number(child);
682 httpd_port = (unsigned short)status;
683 } else if (strcasecmp("StalenessDelta", child->key) == 0) {
684 cf_util_get_cdtime(child, &staleness_delta);
686 WARNING("write_prometheus plugin: Ignoring unknown configuration option "
695 static int prom_init() {
696 if (metrics == NULL) {
697 metrics = c_avl_create((void *)strcmp);
698 if (metrics == NULL) {
699 ERROR("write_prometheus plugin: c_avl_create() failed.");
705 unsigned int flags = MHD_USE_THREAD_PER_CONNECTION;
706 #if MHD_VERSION >= 0x00093300
707 flags |= MHD_USE_DUAL_STACK;
710 httpd = MHD_start_daemon(flags, httpd_port,
711 /* MHD_AcceptPolicyCallback = */ NULL,
712 /* MHD_AcceptPolicyCallback arg = */ NULL,
713 http_handler, NULL, MHD_OPTION_END);
715 ERROR("write_prometheus plugin: MHD_start_daemon() failed.");
718 DEBUG("write_prometheus plugin: Successfully started microhttpd %s",
725 static int prom_write(data_set_t const *ds, value_list_t const *vl,
726 __attribute__((unused)) user_data_t *ud) {
727 pthread_mutex_lock(&metrics_lock);
729 for (size_t i = 0; i < ds->ds_num; i++) {
730 Io__Prometheus__Client__MetricFamily *fam = metric_family_get(ds, vl, i);
734 int status = metric_family_update(fam, ds, vl, i);
736 ERROR("write_prometheus plugin: Updating metric \"%s\" failed with "
743 pthread_mutex_unlock(&metrics_lock);
747 static int prom_missing(value_list_t const *vl,
748 __attribute__((unused)) user_data_t *ud) {
749 data_set_t const *ds = plugin_get_ds(vl->type);
753 pthread_mutex_lock(&metrics_lock);
755 for (size_t i = 0; i < ds->ds_num; i++) {
756 Io__Prometheus__Client__MetricFamily *fam = metric_family_get(ds, vl, i);
760 int status = metric_family_delete_metric(fam, vl);
762 ERROR("write_prometheus plugin: Deleting a metric in family \"%s\" "
763 "failed with status %d",
768 if (fam->n_metric == 0) {
769 int status = c_avl_remove(metrics, fam->name, NULL, NULL);
771 ERROR("write_prometheus plugin: Deleting metric family \"%s\" failed "
776 metric_family_destroy(fam);
780 pthread_mutex_unlock(&metrics_lock);
784 static int prom_shutdown() {
786 MHD_stop_daemon(httpd);
790 pthread_mutex_lock(&metrics_lock);
791 if (metrics != NULL) {
793 Io__Prometheus__Client__MetricFamily *fam;
794 while (c_avl_pick(metrics, (void *)&name, (void *)&fam) == 0) {
795 assert(name == fam->name);
798 metric_family_destroy(fam);
800 c_avl_destroy(metrics);
803 pthread_mutex_unlock(&metrics_lock);
808 void module_register() {
809 plugin_register_complex_config("write_prometheus", prom_config);
810 plugin_register_init("write_prometheus", prom_init);
811 plugin_register_write("write_prometheus", prom_write,
812 /* user data = */ NULL);
813 plugin_register_missing("write_prometheus", prom_missing,
814 /* user data = */ NULL);
815 plugin_register_shutdown("write_prometheus", prom_shutdown);
818 /* vim: set sw=2 sts=2 et fdm=marker : */