Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Populate gen_ai.response.model from gen_ai.request.model if not already set. ([#5654](https://github.com/getsentry/relay/pull/5654))
- Add support for Unix domain sockets for statsd metrics. ([#5668](https://github.com/getsentry/relay/pull/5668))
- Support `deployment.environment` OTLP resource attribute for setting the Sentry environment. ([#5691](https://github.com/getsentry/relay/pull/5691))
- Allow users to opt-out of DNS caching. ([#5700](https://github.com/getsentry/relay/pull/5700))

**Internal**:

Expand Down
10 changes: 10 additions & 0 deletions relay-config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,10 @@ pub struct Http {
///
/// The forward endpoint forwards unknown API requests to the upstream.
pub forward: bool,
/// Enables an async DNS resolver through the `hickory-dns` crate, which uses an LRU cache for
/// the resolved entries. This helps to limit the amount of requests made to the upstream DNS
/// server (important for K8s infrastructure).
pub dns_cache: bool,
}

impl Default for Http {
Expand All @@ -899,6 +903,7 @@ impl Default for Http {
encoding: HttpEncoding::Zstd,
global_metrics: false,
forward: true,
dns_cache: true,
}
}
}
Expand Down Expand Up @@ -2226,6 +2231,11 @@ impl Config {
Duration::from_secs(self.values.http.max_retry_interval.into())
}

/// Returns `true` if relay should use an in-process cache for DNS lookups.
pub fn http_dns_cache(&self) -> bool {
self.values.http.dns_cache
}

/// Returns the expiry timeout for cached projects.
pub fn project_cache_expiry(&self) -> Duration {
Duration::from_secs(self.values.cache.project_expiry.into())
Expand Down
5 changes: 1 addition & 4 deletions relay-server/src/services/upstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,10 +862,7 @@ impl SharedClient {
// In the forward endpoint, this means that content negotiation is done twice, and the
// response body is first decompressed by the client, then re-compressed by the server.
.gzip(true)
// Enables async resolver through the `hickory-dns` crate, which uses an LRU cache for
// the resolved entries. This helps to limit the amount of requests made to upstream DNS
// server (important for K8s infrastructure).
.hickory_dns(true)
.hickory_dns(config.http_dns_cache())
.build()
.unwrap();

Expand Down
Loading