Skip to content

Commit

Permalink
out_prometheus_exporter: respond with 200 even with no metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauri Tirkkonen committed Jan 5, 2024
1 parent cd497e3 commit 79598c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/out_prometheus_exporter/prom_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,17 @@ static void cb_metrics(mk_request_t *request, void *data)
struct prom_http_buf *buf;
(void) data;

mk_http_status(request, 200);
flb_hs_add_content_type_to_req(request, FLB_HS_CONTENT_TYPE_PROMETHEUS);

buf = metrics_get_latest();
if (!buf) {
mk_http_status(request, 404);
mk_http_done(request);
return;
}

buf->users++;

mk_http_status(request, 200);
flb_hs_add_content_type_to_req(request, FLB_HS_CONTENT_TYPE_PROMETHEUS);
mk_http_send(request, buf->buf_data, buf->buf_size, NULL);
mk_http_done(request);

Expand Down

0 comments on commit 79598c5

Please sign in to comment.