Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion plugins/out_prometheus_remote_write/remote_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <fluent-bit/flb_output_plugin.h>
#include <fluent-bit/flb_snappy.h>
#include <fluent-bit/flb_gzip.h>
#include <fluent-bit/flb_zstd.h>
#include <fluent-bit/flb_metrics.h>
#include <fluent-bit/flb_kv.h>

Expand Down Expand Up @@ -71,6 +72,10 @@ static int http_post(struct prometheus_remote_write_context *ctx,
ret = flb_gzip_compress((void *) body, body_len,
&payload_buf, &payload_size);
}
else if (strcasecmp(ctx->compression, "zstd") == 0) {
ret = flb_zstd_compress((void *) body, body_len,
&payload_buf, &payload_size);
}
else {
payload_buf = (void *) body;
payload_size = body_len;
Expand Down Expand Up @@ -134,6 +139,13 @@ static int http_post(struct prometheus_remote_write_context *ctx,
"gzip",
strlen("gzip"));
}
else if (strcasecmp(ctx->compression, "zstd") == 0) {
flb_http_add_header(c,
"Content-Encoding",
strlen("Content-Encoding"),
"zstd",
strlen("zstd"));
}

/* Basic Auth headers */
if (ctx->http_user && ctx->http_passwd) {
Expand Down Expand Up @@ -415,7 +427,7 @@ static struct flb_config_map config_map[] = {
{
FLB_CONFIG_MAP_STR, "compression", "snappy",
0, FLB_TRUE, offsetof(struct prometheus_remote_write_context, compression),
"Compress the payload with either snappy, gzip if set"
"Compress the payload with either snappy, gzip, zstd if set"
},

#ifdef FLB_HAVE_SIGNV4
Expand Down
Loading