diff --git a/CHANGELOG.md b/CHANGELOG.md index df3b31c1dd..1c0e15ca9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,8 @@ Main (unreleased) - Add Prometheus bearer authentication to a `prometheus.write.queue` component (@freak12techno) +- Add `proxy_url` to `otelcol.exporter.otlphttp`. (@wildum) + ### Bugfixes - Fixed a bug in `import.git` which caused a `"non-fast-forward update"` error message. (@ptodev) diff --git a/docs/sources/reference/components/otelcol/otelcol.exporter.otlphttp.md b/docs/sources/reference/components/otelcol/otelcol.exporter.otlphttp.md index 0e9a0914f1..c6dd0c857a 100644 --- a/docs/sources/reference/components/otelcol/otelcol.exporter.otlphttp.md +++ b/docs/sources/reference/components/otelcol/otelcol.exporter.otlphttp.md @@ -73,6 +73,7 @@ The following arguments are supported: Name | Type | Description | Default | Required --------------------------|----------------------------|--------------------------------------------------------------------------------------------------------------------|------------|--------- `endpoint` | `string` | The target URL to send telemetry data to. | | yes +`proxy_url` | `string` | HTTP proxy to send requests through. | | `read_buffer_size` | `string` | Size of the read buffer the HTTP client uses for reading server responses. | `0` | no `write_buffer_size` | `string` | Size of the write buffer the HTTP client uses for writing requests. | `"512KiB"` | no `timeout` | `duration` | Time to wait before marking a request as failed. | `"30s"` | no diff --git a/internal/component/otelcol/config_http.go b/internal/component/otelcol/config_http.go index 4bc2d905fb..4c305bfe15 100644 --- a/internal/component/otelcol/config_http.go +++ b/internal/component/otelcol/config_http.go @@ -87,6 +87,8 @@ func (args *CORSArguments) Convert() *otelconfighttp.CORSConfig { type HTTPClientArguments struct { Endpoint string `alloy:"endpoint,attr"` + ProxyUrl string `alloy:"proxy_url,attr,optional"` + Compression CompressionType `alloy:"compression,attr,optional"` TLS TLSClientArguments `alloy:"tls,block,optional"` @@ -130,6 +132,8 @@ func (args *HTTPClientArguments) Convert() *otelconfighttp.ClientConfig { return &otelconfighttp.ClientConfig{ Endpoint: args.Endpoint, + ProxyURL: args.ProxyUrl, + Compression: args.Compression.Convert(), TLSSetting: *args.TLS.Convert(), diff --git a/internal/converter/internal/otelcolconvert/converter_otlphttpexporter.go b/internal/converter/internal/otelcolconvert/converter_otlphttpexporter.go index ced2a49027..12c6f6fcc9 100644 --- a/internal/converter/internal/otelcolconvert/converter_otlphttpexporter.go +++ b/internal/converter/internal/otelcolconvert/converter_otlphttpexporter.go @@ -83,6 +83,7 @@ func toHTTPClientArguments(cfg confighttp.ClientConfig) otelcol.HTTPClientArgume } return otelcol.HTTPClientArguments{ Endpoint: cfg.Endpoint, + ProxyUrl: cfg.ProxyURL, Compression: otelcol.CompressionType(cfg.Compression), TLS: toTLSClientArguments(cfg.TLSSetting), ReadBufferSize: units.Base2Bytes(cfg.ReadBufferSize), diff --git a/internal/converter/internal/otelcolconvert/testdata/otlphttp.alloy b/internal/converter/internal/otelcolconvert/testdata/otlphttp.alloy index c8bd19e387..e07350478a 100644 --- a/internal/converter/internal/otelcolconvert/testdata/otlphttp.alloy +++ b/internal/converter/internal/otelcolconvert/testdata/otlphttp.alloy @@ -17,6 +17,7 @@ otelcol.receiver.otlp "default" { otelcol.exporter.otlphttp "default" { client { endpoint = "database:4318" + proxy_url = "http://proxy.example.com:8080" http2_ping_timeout = "0s" } } diff --git a/internal/converter/internal/otelcolconvert/testdata/otlphttp.yaml b/internal/converter/internal/otelcolconvert/testdata/otlphttp.yaml index 0d57cfe2d5..2773c547e6 100644 --- a/internal/converter/internal/otelcolconvert/testdata/otlphttp.yaml +++ b/internal/converter/internal/otelcolconvert/testdata/otlphttp.yaml @@ -7,6 +7,7 @@ receivers: exporters: otlphttp: endpoint: database:4318 + proxy_url: http://proxy.example.com:8080 service: pipelines: