Fix prometheus remote write header (#10560)
Vladimir Kobal committed
Jan 27, 2021 at 15:46 UTC
85bb0bc70bac35665f353811d4a33a8c650dbc22
2 files changed
+6
-2
exporting/prometheus/remote_write/remote_write.c
+3
-1
@@ -25,9 +25,11 @@ void prometheus_remote_write_prepare_header(struct instance *instance)
25
"POST %s HTTP/1.1\r\n"
26
"Host: %s\r\n"
27
"Accept: */*\r\n"
28
+ "Content-Encoding: snappy\r\n"
29
+ "Content-Type: application/x-protobuf\r\n"
30
"X-Prometheus-Remote-Write-Version: 0.1.0\r\n"
31
"Content-Length: %zu\r\n"
30
- "Content-Type: application/x-www-form-urlencoded\r\n\r\n",
32
+ "\r\n",
33
connector_specific_config->remote_write_path,
34
instance->config.destination,
35
buffer_strlen(simple_connector_data->last_buffer->buffer));
exporting/tests/test_exporting_engine.c
+3
-1
@@ -1179,9 +1179,11 @@ static void test_prometheus_remote_write_prepare_header(void **state)
1179
"POST /receive HTTP/1.1\r\n"
1180
"Host: localhost\r\n"
1181
"Accept: */*\r\n"
1182
+ "Content-Encoding: snappy\r\n"
1183
+ "Content-Type: application/x-protobuf\r\n"
1184
"X-Prometheus-Remote-Write-Version: 0.1.0\r\n"
1185
"Content-Length: 11\r\n"
1184
- "Content-Type: application/x-www-form-urlencoded\r\n\r\n");
1186
+ "\r\n");
1187
1188
free(connector_specific_config->remote_write_path);
1189