diff --git a/exporter/prometheusremotewriteexporter/exporter.go b/exporter/prometheusremotewriteexporter/exporter.go index 260790637048..79491c441b1b 100644 --- a/exporter/prometheusremotewriteexporter/exporter.go +++ b/exporter/prometheusremotewriteexporter/exporter.go @@ -332,13 +332,20 @@ func (prwe *prwExporter) execute(ctx context.Context, data []byte) error { req.Header.Add("Content-Encoding", "snappy") req.Header.Set("User-Agent", prwe.userAgentHeader) - switch prwe.RemoteWriteProtoMsg { - case config.RemoteWriteProtoMsgV1: + // If feature flag not enabled support only RW1 + // TODO remove when feature flag removed + if !prwe.enableSendingRW2 { req.Header.Set("Content-Type", "application/x-protobuf") req.Header.Set("X-Prometheus-Remote-Write-Version", "0.1.0") - case config.RemoteWriteProtoMsgV2: - req.Header.Set("Content-Type", "application/x-protobuf;proto=io.prometheus.write.v2.Request") - req.Header.Set("X-Prometheus-Remote-Write-Version", "2.0.0") + } else { + switch prwe.RemoteWriteProtoMsg { + case config.RemoteWriteProtoMsgV1: + req.Header.Set("Content-Type", "application/x-protobuf") + req.Header.Set("X-Prometheus-Remote-Write-Version", "0.1.0") + case config.RemoteWriteProtoMsgV2: + req.Header.Set("Content-Type", "application/x-protobuf;proto=io.prometheus.write.v2.Request") + req.Header.Set("X-Prometheus-Remote-Write-Version", "2.0.0") + } } resp, err := prwe.client.Do(req)