Skip to content

Conversation

tobias-wilfert
Copy link
Member

@tobias-wilfert tobias-wilfert commented Sep 19, 2025

Introduces the ProxyProcessorService which is a simplified version of the EnvelopeProcessorService to use if Relay is run in the Proxy mode. Also does some changes to the HealthCheckService, AutoscalingMetricService and RelayStats to make these compatible.

Fixes: https://linear.app/getsentry/issue/INGEST-581/simplify-proxy-mode

@tobias-wilfert tobias-wilfert self-assigned this Sep 19, 2025
@tobias-wilfert tobias-wilfert changed the title WIP: Simplify Proxy Mode ref(relay_mode): Simplify Proxy Mode Oct 14, 2025
@tobias-wilfert tobias-wilfert changed the title ref(relay_mode): Simplify Proxy Mode feat(relay): Simplify Proxy Mode Oct 14, 2025
)
.collect();
let worker_pool_utilization = self.async_pool.metrics().total_utilization();
let worker_pool_utilization = self.async_pool.as_ref().map_or(0, |pool| pool.metrics().total_utilization());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it is better here to make the runtime_utilization in AutoscalingData an option rather than setting 0 here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intuitively using 0 here makes sense to me.

@tobias-wilfert tobias-wilfert marked this pull request as ready for review October 17, 2025 09:21
@tobias-wilfert tobias-wilfert requested a review from a team as a code owner October 17, 2025 09:21
Copy link

linear bot commented Oct 17, 2025

)
.collect();
let worker_pool_utilization = self.async_pool.metrics().total_utilization();
let worker_pool_utilization = self.async_pool.as_ref().map_or(0, |pool| pool.metrics().total_utilization());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intuitively using 0 here makes sense to me.

Comment on lines +25 to +33
pub struct ProxyProcessorService {
inner: InnerProxyProcessor,
}

struct InnerProxyProcessor {
config: Arc<Config>,
project_cache: ProjectCacheHandle,
addrs: ProxyAddrs,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for the inner struct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As Sebastian mentions, this looks like a leftover from when it was still multi-threaded.

envelope_buffer: PartitionedEnvelopeBuffer,
handle: Handle,
async_pool: EnvelopeProcessorServicePool,
async_pool: Option<EnvelopeProcessorServicePool>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mh, we could also disable the service and not run it at all in Proxy mode.

impl ProcessingGroup {
/// Splits provided envelope into list of tuples of groups with associated envelopes.
fn split_envelope(
pub fn split_envelope(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be necessary.

Comment on lines 3393 to 3399
#[derive(Debug)]
pub struct SendEnvelope {
envelope: TypedEnvelope<Processed>,
body: Bytes,
http_encoding: HttpEncoding,
project_cache: ProjectCacheHandle,
pub envelope: TypedEnvelope<Processed>,
pub body: Bytes,
pub http_encoding: HttpEncoding,
pub project_cache: ProjectCacheHandle,
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the reader, we discussed what to do here and decided to just make it public for this PR, we can clean up visibility and types in a follow up

Comment on lines +25 to +33
pub struct ProxyProcessorService {
inner: InnerProxyProcessor,
}

struct InnerProxyProcessor {
config: Arc<Config>,
project_cache: ProjectCacheHandle,
addrs: ProxyAddrs,
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As Sebastian mentions, this looks like a leftover from when it was still multi-threaded.

Comment on lines +37 to +38
pub outcome_aggregator: Addr<TrackOutcome>,
pub upstream_relay: Addr<UpstreamRelay>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally we want docs on public fields, even if they are just very basic.

}

impl ProxyProcessorService {
/// Creates a multi-threaded proxy processor.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not multi threaded.

let mut envelope = Envelope::from_request(None, RequestMeta::outbound(dsn));
for client_report in client_reports {
let mut item = Item::new(ItemType::ClientReport);
item.set_payload(ContentType::Json, client_report.serialize().unwrap()); // TODO: unwrap OK?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unwraps (with a TODO) are never okay, that todo should've been cleaned up a while ago in the other processor 🙈

Fine to leave it for now, we can do that in a follow up.

Comment on lines +98 to +99
fn submit_upstream(&self, envelope: ManagedEnvelope) {
let mut envelope = envelope;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fn submit_upstream(&self, envelope: ManagedEnvelope) {
let mut envelope = envelope;
fn submit_upstream(&self, mut envelope: ManagedEnvelope) {


**Breaking Changes**:

- Simplify proxy mode to forward without processing ([#5165](https://github.com/getsentry/relay/pull/5165))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Simplify proxy mode to forward without processing ([#5165](https://github.com/getsentry/relay/pull/5165))
- Simplify proxy mode to forward without processing. ([#5165](https://github.com/getsentry/relay/pull/5165))


## Unreleased

**Breaking Changes**:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a large fundamental change of how Relay operates in Proxy mode it's a good idea to call that out.

Ideally the PR description then goes into details why this is a breaking change and/or what users are expected to do when they encounter this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants