Skip to content

Commit

Permalink
Add proxy_url to otelcol.exporter.otlphttp (#1991)
Browse files Browse the repository at this point in the history
  • Loading branch information
wildum authored Oct 29, 2024
1 parent b72443f commit b9632e6
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions internal/component/otelcol/config_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ receivers:
exporters:
otlphttp:
endpoint: database:4318
proxy_url: http://proxy.example.com:8080

service:
pipelines:
Expand Down

0 comments on commit b9632e6

Please sign in to comment.