Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(cymbal): remove local processing resolution (#76531)

Hugues Pouillot7a0b1ac4b5b7
diff --git a/bin/start-rust-service b/bin/start-rust-service
index c9e9a0209cb8..06807ff1e21d 100755
--- a/bin/start-rust-service
+++ b/bin/start-rust-service
@@ -142,15 +142,7 @@ case "$RS_SVC" in
export ISSUE_BUCKETS_REDIS_URL="$DEFAULT_REDIS"
export SIGNALS_API_BASE_URL="${SIGNALS_API_BASE_URL:-http://localhost:8000}" # Used to emit signals, via the internal API
export INTERNAL_API_SECRET="${INTERNAL_API_SECRET:-posthog123}"
- # Route exception resolution through the local cymbal-resolution pod so
- # the new gRPC seam is exercised end-to-end during dev. Flip
- # CYMBAL_REMOTE_RESOLUTION_ENABLED=false to fall back to inline local
- # resolution if cymbal-resolution isn't running.
- export CYMBAL_REMOTE_RESOLUTION_ENABLED="${CYMBAL_REMOTE_RESOLUTION_ENABLED:-true}"
- # Production defaults to SAMPLE_RATE=0.0 so flipping ENABLED is a no-op
- # until rollout is ramped explicitly. In dev we want every event to
- # exercise the remote path so the seam is actually tested.
- export CYMBAL_REMOTE_RESOLUTION_SAMPLE_RATE="${CYMBAL_REMOTE_RESOLUTION_SAMPLE_RATE:-1.0}"
+ # Processing always routes exception resolution through cymbal-resolution.
export CYMBAL_REMOTE_RESOLUTION_HOST="${CYMBAL_REMOTE_RESOLUTION_HOST:-127.0.0.1}"
export CYMBAL_REMOTE_RESOLUTION_PORT="${CYMBAL_REMOTE_RESOLUTION_PORT:-50061}"
# Keep cadence tight on the dev box so routing reacts quickly to
diff --git a/rust/cymbal/README.md b/rust/cymbal/README.md
index 1eb40c0b24fa..ff54e8014951 100644
--- a/rust/cymbal/README.md
+++ b/rust/cymbal/README.md
@@ -11,12 +11,10 @@ pipeline, the `cymbal.resolution.v1` gRPC symbol-resolution service
Temporal lifecycle workflow for every issue-created, issue-reopened, or
issue-spiking notification.
-Symbol resolution can run either inline inside the processing binary (default)
-or be offloaded to resolution-mode pods via the `cymbal.resolution.v1`
-contract. The remote path is opt-in via
-`CYMBAL_REMOTE_RESOLUTION_ENABLED=true` and has **no silent local fallback**.
-See the [resolution mode README](src/modes/resolution/README.md) for rollout,
-configuration, and operator guidance.
+Symbol resolution runs in resolution-mode pods via the
+`cymbal.resolution.v1` contract. Processing has no inline fallback.
+See the [resolution mode README](src/modes/resolution/README.md) for
+configuration and operator guidance.
## Remote resolution behavior
@@ -27,17 +25,13 @@ Node.js error-tracking consumer can keep using its existing DNS routing
and HTTP body-size chunking because remote symbol resolution happens behind
the same cymbal HTTP boundary.
-When remote resolution is enabled, `CYMBAL_REMOTE_RESOLUTION_SAMPLE_RATE`
-controls a deterministic event-level rollout. Events selected for remote
-processing are flattened into exception-level `ResolveItem`s, grouped by a
+Events are flattened into exception-level `ResolveItem`s, grouped by a
symbol-set routing key when one is available, and submitted over a
bidirectional `Resolve` stream. Items without a symbol-set reference fall back
to the existing per-team key. Each item carries JSON
`metadata` bytes for resolver-specific context such as
`debug_images_json`, and each terminal `ResolveOutcome` is correlated by
-item id. Sampled remote attempts do not fall back to local resolution if the
-remote pool fails; unsampled events use the inline local exception and frame
-resolvers and then rejoin the same properties/grouping/linking pipeline.
+item id. Resolution failures do not fall back to inline processing.
Backpressure is result-only on the `Resolve` stream: overload is surfaced as
`ResolveOutcome.Error { kind: ERROR_KIND_OVERLOADED }`, which the cymbal client
@@ -56,7 +50,7 @@ Cymbal uses that load as a soft routing bias: busier endpoints are less likely t
See [`docs/compatibility.md`](docs/compatibility.md) for the Node consumer
compatibility checklist and [`src/modes/resolution/README.md`](src/modes/resolution/README.md)
-for rollout and dashboard guidance.
+for dashboard guidance.
Fetched JavaScript sources and external source maps are limited to 25 MB after HTTP decompression by default. Set `SOURCEMAP_MAX_RESPONSE_BYTES` to adjust this limit.
diff --git a/rust/cymbal/docs/compatibility.md b/rust/cymbal/docs/compatibility.md
index f8fdf51b5f83..b735e6ec8b48 100644
--- a/rust/cymbal/docs/compatibility.md
+++ b/rust/cymbal/docs/compatibility.md
@@ -14,7 +14,7 @@ The external Node.js error-tracking consumer contract stays unchanged.
## Node-side chunking
`nodejs/src/ingestion/error-tracking/cymbal/client.ts` chunks HTTP requests by estimated original event body size before they reach cymbal.
-That remains valid with remote resolution enabled because cymbal preserves the HTTP boundary and performs private exception-level gRPC work after it receives an HTTP chunk.
+That remains valid because cymbal preserves the HTTP boundary and performs private exception-level gRPC work after it receives an HTTP chunk.
No generated type changes are needed:
@@ -22,12 +22,10 @@ No generated type changes are needed:
- the Node response type remains `(CymbalResponse | null)[]`
- the internal `cymbal.resolution.v1` gRPC messages are not exposed to Node
-## Remote rollout controls behind the HTTP boundary
+## Remote resolution behind the HTTP boundary
-- `CYMBAL_REMOTE_RESOLUTION_SAMPLE_RATE` deterministically chooses remote vs local resolution per event.
-- Sampled events use the remote pool and do not silently fall back to local resolution on remote failures.
-- Unsampled events use the local exception and frame resolvers.
-- Sampled remote events are flattened into exception-level `ResolveItem`s. Items are grouped by their first symbol-set reference when available, with a per-team fallback, then submitted over per-endpoint bidirectional `Resolve` streams.
+- Events use the remote pool and do not silently fall back to inline resolution on failures.
+- Events are flattened into exception-level `ResolveItem`s. Items are grouped by their first symbol-set reference when available, with a per-team fallback, then submitted over per-endpoint bidirectional `Resolve` streams.
- Resolver-specific context is carried in `ResolveItem.metadata` as JSON bytes. The native symbolication convention uses a `debug_images_json` key.
- Per-item `ResolveOutcome.Error.kind` is the control-flow surface. `ERROR_KIND_OVERLOADED` is result-only backpressure and triggers item reroute. Accepted items emit `ResolveOutcome.Accepted` before their terminal outcome; cymbal releases its routing permit on that acceptance signal. If `CYMBAL_REMOTE_RESOLUTION_OVERLOAD_EJECTION_MS` is non-zero, the overloaded endpoint is also temporarily excluded from new routing in that cymbal process. Repeated overloads double that cooldown up to `CYMBAL_REMOTE_RESOLUTION_OVERLOAD_EJECTION_MAX_MS`, and a quiet `CYMBAL_REMOTE_RESOLUTION_OVERLOAD_EJECTION_DECAY_MS` window resets it. `CYMBAL_REMOTE_RESOLUTION_ROUTING_JITTER` controls how much routing flattens across the load-adjusted rendezvous-ranked candidate list (`0.0` strict top load-adjusted candidate, `1.0` load-weighted across candidates). `LoadEvent` carries endpoint freshness/draining state plus `in_flight` / `max_in_flight` as a soft routing load signal.
diff --git a/rust/cymbal/src/core/metric_consts.rs b/rust/cymbal/src/core/metric_consts.rs
index f9972ccce3b4..0944638a0b10 100644
--- a/rust/cymbal/src/core/metric_consts.rs
+++ b/rust/cymbal/src/core/metric_consts.rs
@@ -127,8 +127,6 @@ pub const RATE_LIMIT_METRIC_EMIT: &str = "cymbal_error_tracking_rate_limiter_met
pub const SPIKE_ALERT_STAGE: &str = "cymbal_spike_detection_time";
// Operators
-pub const FRAME_RESOLVER_OPERATOR: &str = "cymbal_frame_batch_time";
-pub const EXCEPTION_RESOLVER_OPERATOR: &str = "cymbal_exception_exception_resolver_operator";
pub const LEGACY_ORDER_RESOLVER_OPERATOR: &str = "cymbal_exception_legacy_order_resolver_operator";
pub const LEGACY_ORDER_RESOLVE_FAILED: &str = "cymbal_exception_legacy_order_resolve_failed";
pub const FINGERPRINT_LEGACY_VERSION_USED: &str = "cymbal_fingerprint_legacy_version_used";
@@ -147,7 +145,6 @@ pub const BYPASS_RULES_DISABLED: &str = "cymbal_bypass_rules_disabled";
// fixed enums rather than free-form messages.
pub const REMOTE_RESOLUTION_REQUESTS: &str = "cymbal_remote_resolution_requests_total";
pub const REMOTE_RESOLUTION_LATENCY: &str = "cymbal_remote_resolution_latency_ms";
-pub const REMOTE_RESOLUTION_SAMPLING: &str = "cymbal_remote_resolution_sampling_total";
pub const REMOTE_RESOLUTION_POOL_SIZE: &str = "cymbal_remote_resolution_pool_size";
pub const REMOTE_RESOLUTION_ENDPOINTS_BY_STATE: &str =
"cymbal_remote_resolution_endpoints_by_state";
diff --git a/rust/cymbal/src/core/resolver.rs b/rust/cymbal/src/core/resolver.rs
index c6e2605c1456..621ec1134d5e 100644
--- a/rust/cymbal/src/core/resolver.rs
+++ b/rust/cymbal/src/core/resolver.rs
@@ -48,8 +48,8 @@ pub async fn build_symbol_resolver(
}
/// Build the symbol-store [`Catalog`] from already-constructed S3 and PG
-/// handles. Shared by [`crate::app_context::AppContext::new`] and
-/// [`build_symbol_resolver`] so the provider wiring doesn't drift.
+/// handles. Kept alongside [`build_symbol_resolver`] so provider wiring stays
+/// in one place.
pub fn build_catalog(
config: &ResolverConfig,
s3_client: Arc<dyn BlobClient>,
diff --git a/rust/cymbal/src/lib.rs b/rust/cymbal/src/lib.rs
index c1041bf639a2..b81adac76c38 100644
--- a/rust/cymbal/src/lib.rs
+++ b/rust/cymbal/src/lib.rs
@@ -1,8 +1,5 @@
pub mod core;
pub mod modes;
-#[cfg(test)]
-pub mod test_utils;
-
// Compat re-exports: the shared kernel physically lives under `core/`, but much
// of the crate still imports it by the old crate-root paths. Prefer
// `crate::core::*` in new code.
diff --git a/rust/cymbal/src/modes/processing/app_context.rs b/rust/cymbal/src/modes/processing/app_context.rs
index b4332752a16e..47b2f1411746 100644
--- a/rust/cymbal/src/modes/processing/app_context.rs
+++ b/rust/cymbal/src/modes/processing/app_context.rs
@@ -10,8 +10,7 @@ use tracing::info;
use uuid::Uuid;
use crate::{
- core::config::{build_pg_pool, get_aws_config},
- core::resolver::build_catalog,
+ core::config::build_pg_pool,
error::UnhandledError,
modes::processing::config::{init_global_state, ProcessingConfig},
stages::rate_limiting::RedisRateLimiter,
@@ -19,8 +18,6 @@ use crate::{
dns::TokioDnsResolver, pool::EndpointPool, resolver::RemoteResolutionContext,
RemoteResolutionConfig,
},
- symbolication::symbol::{local::LocalSymbolResolver, SymbolResolver},
- symbolication::symbol_store::{BlobClient, Catalog, S3Client},
teams::TeamManager,
types::operator::TeamId,
};
@@ -36,14 +33,9 @@ pub struct AppContext {
// The primary producer's cluster (warpstream-shared) does not carry that topic.
pub app_metrics_producer: FutureProducer<KafkaContext>,
pub posthog_pool: PgPool,
- pub catalog: Arc<Catalog>,
- pub symbol_resolver: Arc<dyn SymbolResolver>,
- pub symbol_resolution_limiter: Arc<Semaphore>,
pub process_request_limiter: Arc<Semaphore>,
- /// When set, cymbal's resolution stage routes exception resolution to the
- /// remote `cymbal-resolution` service pool instead of running the local
- /// resolver. Built once at startup; the endpoint pool refreshes itself in
- /// the background.
+ /// The `cymbal-resolution` service pool. Built once at startup; the
+ /// endpoint pool refreshes itself in the background.
pub remote_resolution: Option<RemoteResolutionContext>,
remote_resolution_refresh_task: Option<JoinHandle<()>>,
pub config: ProcessingConfig,
@@ -79,10 +71,6 @@ impl AppContext {
"cymbal_processing",
)?;
- let s3_client = aws_sdk_s3::Client::from_conf(get_aws_config(&config.resolver).await);
- let s3_client = S3Client::new(s3_client);
- let s3_client = Arc::new(s3_client);
-
let issue_buckets_redis_client = RedisClient::with_config(
config.issue_buckets_redis_url.clone(),
common_redis::CompressionConfig::disabled(),
@@ -103,15 +91,20 @@ impl AppContext {
let issue_buckets_redis_client: Arc<dyn RedisClientTrait + Send + Sync> =
Arc::new(issue_buckets_redis_client);
- AppContext::new(config, s3_client, posthog_pool, issue_buckets_redis_client).await
+ AppContext::new(config, posthog_pool, issue_buckets_redis_client).await
}
pub async fn new(
config: &ProcessingConfig,
- s3_client: Arc<dyn BlobClient>,
posthog_pool: PgPool,
issue_buckets_redis_client: Arc<dyn RedisClientTrait + Send + Sync>,
) -> Result<Self, UnhandledError> {
+ if config.remote_resolution_host.trim().is_empty() {
+ return Err(UnhandledError::Other(
+ "CYMBAL_REMOTE_RESOLUTION_HOST is empty".to_string(),
+ ));
+ }
+
init_global_state(config);
let health_registry = HealthRegistry::new("liveness");
@@ -157,24 +150,10 @@ impl AppContext {
_ => immediate_producer.clone(),
};
- s3_client
- .ping_bucket(&config.resolver.object_storage_bucket)
- .await?;
-
- let catalog = build_catalog(&config.resolver, s3_client, posthog_pool.clone());
-
info!("AppContext initialized");
let team_manager = TeamManager::new(config);
- let symbol_resolver = Arc::new(LocalSymbolResolver::new(
- &config.resolver,
- catalog.clone(),
- posthog_pool.clone(),
- ));
- let symbol_resolution_limiter = Arc::new(Semaphore::new(
- config.resolver.symbol_resolution_concurrency.max(1),
- ));
let process_request_limiter =
Arc::new(Semaphore::new(config.process_max_in_flight_requests.max(1)));
@@ -195,15 +174,12 @@ impl AppContext {
cyclotron_producer,
app_metrics_producer,
posthog_pool,
- catalog,
config: config.clone(),
- symbol_resolution_limiter,
process_request_limiter,
team_manager,
issue_buckets_redis_client,
rate_limiter,
rate_limiter_enabled_team_ids,
- symbol_resolver,
issue_cache,
remote_resolution,
remote_resolution_refresh_task,
@@ -263,10 +239,6 @@ fn parse_team_id_allowlist(value: &str) -> Option<HashSet<i32>> {
async fn build_remote_resolution(
config: &ProcessingConfig,
) -> Result<(Option<RemoteResolutionContext>, Option<JoinHandle<()>>), UnhandledError> {
- if !config.remote_resolution_enabled {
- return Ok((None, None));
- }
-
let remote_config = RemoteResolutionConfig::from_config(config)?;
info!(
host = %remote_config.host,
@@ -274,8 +246,7 @@ async fn build_remote_resolution(
deadline_ms = remote_config.request_deadline.as_millis() as u64,
dns_refresh_secs = remote_config.dns_refresh.as_secs(),
max_retries = remote_config.max_retries,
- sample_rate = remote_config.sample_rate,
- "remote resolution enabled, building endpoint pool"
+ "building remote resolution endpoint pool"
);
let resolver = Arc::new(TokioDnsResolver);
diff --git a/rust/cymbal/src/modes/processing/config.rs b/rust/cymbal/src/modes/processing/config.rs
index b2ef3abeef46..fc5fdfc80336 100644
--- a/rust/cymbal/src/modes/processing/config.rs
+++ b/rust/cymbal/src/modes/processing/config.rs
@@ -182,18 +182,8 @@ pub struct ProcessingConfig {
pub spike_alert_enabled_team_ids: String,
// ----------------------------------------------------------------------
- // Remote resolution (cymbal.resolution.v1) — Batch 3 client integration.
- //
- // When `remote_resolution_enabled` is true, cymbal routes exception-level
- // symbol resolution through the configured `cymbal-resolution` service
- // pool instead of running the local resolver inline. There is no silent
- // local fallback: if the pool can't satisfy the request, the stage
- // surfaces the failure to its caller. Local mode (the default) is
- // unchanged.
+ // Remote resolution (cymbal.resolution.v1).
// ----------------------------------------------------------------------
- #[envconfig(from = "CYMBAL_REMOTE_RESOLUTION_ENABLED", default = "false")]
- pub remote_resolution_enabled: bool,
-
/// Hostname of the cymbal-resolution service. Resolved via DNS, then each
/// returned address gets its own gRPC channel in the endpoint pool.
#[envconfig(from = "CYMBAL_REMOTE_RESOLUTION_HOST", default = "")]
@@ -262,15 +252,6 @@ pub struct ProcessingConfig {
)]
pub remote_resolution_overload_ejection_decay_ms: u64,
- /// Deterministic event-level rollout sample for remote resolution.
- /// Defaults to `0.0` so flipping `CYMBAL_REMOTE_RESOLUTION_ENABLED=true`
- /// alone does not start sending traffic — the rollout has to be ramped
- /// explicitly. Values outside 0.0..=1.0 are clamped by
- /// `RemoteResolutionConfig`, matching the defensive normalization used
- /// by adjacent duration knobs.
- #[envconfig(from = "CYMBAL_REMOTE_RESOLUTION_SAMPLE_RATE", default = "0.0")]
- pub remote_resolution_sample_rate: f64,
-
/// Flattens remote resolution routing across the rendezvous-ranked candidate
/// list. `0.0` sends all traffic to the top-ranked endpoint, `1.0` is
/// uniform across all candidates, and intermediate values decay by rank.
diff --git a/rust/cymbal/src/modes/processing/rules/grouping.rs b/rust/cymbal/src/modes/processing/rules/grouping.rs
index bf38979c1c8c..502cc5956f5c 100644
--- a/rust/cymbal/src/modes/processing/rules/grouping.rs
+++ b/rust/cymbal/src/modes/processing/rules/grouping.rs
@@ -190,7 +190,7 @@ mod test {
use sqlx::PgPool;
use uuid::Uuid;
- use crate::test_utils::create_test_context;
+ use crate::{modes::processing::config::ProcessingConfig, teams::TeamManager};
use super::{evaluate_grouping_rules, GroupingRule};
@@ -234,7 +234,7 @@ mod test {
#[sqlx::test(migrations = "./tests/test_migrations")]
async fn test_grouping_rules(db: PgPool) {
- let ctx = create_test_context(db).await;
+ let team_manager = TeamManager::new(&ProcessingConfig::init_with_defaults().unwrap());
let test_team_id = 1;
let props = test_props(JsonValue::from("test_value"));
@@ -242,26 +242,19 @@ mod test {
let rule = get_test_rule();
let expected_rule_id = rule.id;
// Insert the rule, so we skip the DB lookup
- ctx.team_manager
- .grouping_rules
- .insert(test_team_id, vec![rule]);
+ team_manager.grouping_rules.insert(test_team_id, vec![rule]);
let matched =
- evaluate_grouping_rules(&ctx.posthog_pool, test_team_id, &ctx.team_manager, || {
- Ok(props.clone())
- })
- .await
- .unwrap();
+ evaluate_grouping_rules(&db, test_team_id, &team_manager, || Ok(props.clone()))
+ .await
+ .unwrap();
assert_eq!(matched.expect("rule should match").id, expected_rule_id);
// Insert a different value - simply removing the value would cause the rule to be disabled, since it
// tries to access an undefined global
let props = test_props(JsonValue::from("no_match"));
- let matched =
- evaluate_grouping_rules(&ctx.posthog_pool, test_team_id, &ctx.team_manager, || {
- Ok(props)
- })
+ let matched = evaluate_grouping_rules(&db, test_team_id, &team_manager, || Ok(props))
.await
.unwrap();
diff --git a/rust/cymbal/src/modes/processing/stages/resolution/exception.rs b/rust/cymbal/src/modes/processing/stages/resolution/exception.rs
index 293e487de789..93758f8c8889 100644
--- a/rust/cymbal/src/modes/processing/stages/resolution/exception.rs
+++ b/rust/cymbal/src/modes/processing/stages/resolution/exception.rs
@@ -1,15 +1,4 @@
-use crate::{
- error::UnhandledError,
- frames::RawFrame,
- metric_consts::EXCEPTION_RESOLVER_OPERATOR,
- stages::{pipeline::HandledError, resolution::ResolutionStage},
- types::{
- batch::Batch,
- exception_event::{ExceptionEvent, Parsed},
- operator::{OperatorResult, ValueOperator},
- Exception, ExceptionList,
- },
-};
+use crate::{frames::RawFrame, types::Exception};
#[derive(Clone)]
pub struct ExceptionResolver;
@@ -30,62 +19,6 @@ impl ExceptionResolver {
// Checking if the exception is a Dart exception
exc.exception_type.starts_with("minified:")
}
-
- pub async fn resolve_exception_list(
- team_id: i32,
- list: ExceptionList,
- ctx: ResolutionStage,
- ) -> Result<ExceptionList, UnhandledError> {
- let resolved = Batch::from(list.0)
- .apply_func(
- move |exc, ctx| async move {
- let ctx = ctx.clone();
- if ExceptionResolver::is_java_exception(&exc) {
- let _permit = ctx.acquire_symbol_resolution_permit().await?;
- ctx.symbol_resolver
- .resolve_java_exception(team_id, exc)
- .await
- } else if ExceptionResolver::is_dart_exception(&exc) {
- let _permit = ctx.acquire_symbol_resolution_permit().await?;
- ctx.symbol_resolver
- .resolve_dart_exception(team_id, exc)
- .await
- } else {
- Ok(exc)
- }
- },
- ctx,
- )
- .await?;
- Ok(ExceptionList::from(Vec::from(resolved)))
- }
-}
-
-impl ValueOperator for ExceptionResolver {
- type Context = ResolutionStage;
- type Item = ExceptionEvent<Parsed>;
- type HandledError = HandledError;
- type UnhandledError = UnhandledError;
-
- fn name(&self) -> &'static str {
- EXCEPTION_RESOLVER_OPERATOR
- }
-
- async fn execute_value(
- &self,
- mut evt: ExceptionEvent<Parsed>,
- ctx: ResolutionStage,
- ) -> OperatorResult<Self> {
- let team_id = evt.team_id;
- evt.exception_list = ExceptionResolver::resolve_exception_list(
- team_id,
- std::mem::take(&mut evt.exception_list),
- ctx,
- )
- .await?;
-
- Ok(Ok(evt))
- }
}
#[cfg(test)]
diff --git a/rust/cymbal/src/modes/processing/stages/resolution/frame.rs b/rust/cymbal/src/modes/processing/stages/resolution/frame.rs
index 45238a297f63..7eb4373854de 100644
--- a/rust/cymbal/src/modes/processing/stages/resolution/frame.rs
+++ b/rust/cymbal/src/modes/processing/stages/resolution/frame.rs
@@ -4,46 +4,20 @@ use crate::{
error::UnhandledError,
frames::{Frame, RawFrame},
langs::native::DebugImage,
- metric_consts::{FRAME_RESOLVER_OPERATOR, NATIVE_INLINE_GROUPS},
- stages::{pipeline::HandledError, resolution::ResolutionStage},
- types::{
- batch::Batch,
- exception_event::{ExceptionEvent, Parsed},
- operator::{OperatorResult, ValueOperator},
- Exception, ExceptionList, Stacktrace,
- },
+ metric_consts::NATIVE_INLINE_GROUPS,
+ stages::resolution::LocalResolutionContext,
+ types::{batch::Batch, Exception, Stacktrace},
};
#[derive(Clone, Default)]
pub struct FrameResolver;
impl FrameResolver {
- pub async fn resolve_exception_list_frames(
- team_id: i32,
- list: ExceptionList,
- debug_images: Arc<Vec<DebugImage>>,
- ctx: ResolutionStage,
- ) -> Result<ExceptionList, UnhandledError> {
- let res = Batch::from(list.0)
- .apply_func(
- move |exc, ctx| {
- let debug_images = debug_images.clone();
- async move {
- FrameResolver::resolve_exception_frames(team_id, exc, debug_images, ctx)
- .await
- }
- },
- ctx,
- )
- .await?;
- Ok(Vec::from(res).into())
- }
-
pub async fn resolve_exception_frames(
team_id: i32,
mut exc: Exception,
debug_images: Arc<Vec<DebugImage>>,
- ctx: ResolutionStage,
+ ctx: LocalResolutionContext,
) -> Result<Exception, UnhandledError> {
exc.stack = match exc.stack {
Some(Stacktrace::Raw { frames }) => {
@@ -94,7 +68,7 @@ impl FrameResolver {
team_id: i32,
unit: &[RawFrame],
debug_images: &[DebugImage],
- ctx: ResolutionStage,
+ ctx: LocalResolutionContext,
) -> Result<Vec<Frame>, UnhandledError> {
let (lead, members) = unit.split_first().expect("partition units are non-empty");
@@ -140,7 +114,7 @@ impl FrameResolver {
team_id: i32,
frame: &RawFrame,
debug_images: &[DebugImage],
- ctx: ResolutionStage,
+ ctx: LocalResolutionContext,
) -> Result<Vec<Frame>, UnhandledError> {
let _permit = ctx.acquire_symbol_resolution_permit().await?;
@@ -193,36 +167,6 @@ fn partition_into_units(frames: Vec<RawFrame>) -> Vec<Vec<RawFrame>> {
units
}
-impl ValueOperator for FrameResolver {
- type Context = ResolutionStage;
- type Item = ExceptionEvent<Parsed>;
- type HandledError = HandledError;
- type UnhandledError = UnhandledError;
-
- fn name(&self) -> &'static str {
- FRAME_RESOLVER_OPERATOR
- }
-
- async fn execute_value(
- &self,
- mut evt: ExceptionEvent<Parsed>,
- ctx: ResolutionStage,
- ) -> OperatorResult<Self> {
- // Clone rather than take: `$debug_images` is serialized back onto the
- // event after resolution (rules eval and the /process response), so the
- // field must survive this stage.
- let debug_images = Arc::new(evt.debug_images.clone());
- evt.exception_list = FrameResolver::resolve_exception_list_frames(
- evt.team_id,
- evt.exception_list,
- debug_images,
- ctx,
- )
- .await?;
- Ok(Ok(evt))
- }
-}
-
#[cfg(test)]
mod test {
use std::sync::Arc;
@@ -338,17 +282,16 @@ mod test {
// inlined_leaf as inlined (via inner_function) into outer_function.
const INLINE_ADDR: u64 = SLIDE_BASE + 0x1475;
- fn resolution_stage(db: &sqlx::PgPool, catalog: Catalog) -> ResolutionStage {
+ fn resolution_stage(db: &sqlx::PgPool, catalog: Catalog) -> LocalResolutionContext {
let mut config = ProcessingConfig::init_with_defaults().unwrap();
config.resolver.object_storage_bucket = "test-bucket".to_string();
- ResolutionStage {
+ LocalResolutionContext {
symbol_resolver: Arc::new(LocalSymbolResolver::new(
&config.resolver,
Arc::new(catalog),
db.clone(),
)),
symbol_resolution_limiter: Arc::new(Semaphore::new(4)),
- remote: None,
}
}
diff --git a/rust/cymbal/src/modes/processing/stages/resolution/legacy.rs b/rust/cymbal/src/modes/processing/stages/resolution/legacy.rs
deleted file mode 100644
index c4ef7250865b..000000000000
--- a/rust/cymbal/src/modes/processing/stages/resolution/legacy.rs
+++ /dev/null
@@ -1,78 +0,0 @@
-use std::sync::Arc;
-
-use tracing::debug;
-
-use crate::{
- error::UnhandledError,
- metric_consts::{LEGACY_ORDER_RESOLVER_OPERATOR, LEGACY_ORDER_RESOLVE_FAILED},
- stages::{
- pipeline::HandledError,
- resolution::{exception::ExceptionResolver, frame::FrameResolver, ResolutionStage},
- },
- types::{
- exception_event::{ExceptionEvent, Parsed},
- operator::{OperatorResult, ValueOperator},
- ExceptionList,
- },
-};
-
-/// Resolves the legacy-order snapshot through the local exception + frame
-/// resolvers, in the same order the canonical list is resolved.
-async fn resolve_legacy(
- evt: &ExceptionEvent<Parsed>,
- legacy: ExceptionList,
- ctx: ResolutionStage,
-) -> Result<ExceptionList, UnhandledError> {
- let team_id = evt.team_id();
- // Match the canonical pipeline order: exception resolution (java/dart
- // reshaping) then frame resolution.
- let legacy = ExceptionResolver::resolve_exception_list(team_id, legacy, ctx.clone()).await?;
- let debug_images = Arc::new(evt.debug_images().to_vec());
- FrameResolver::resolve_exception_list_frames(team_id, legacy, debug_images, ctx).await
-}
-
-/// Resolves the retained legacy-order snapshot (set by wire-order
-/// normalization) so grouping can compute the legacy fingerprint for issue
-/// continuity. Runs after the canonical exception list is resolved, and always
-/// through the local resolvers — so continuity holds on both the local and
-/// remote resolution paths. The snapshot carries the same raw frames as the
-/// canonical list, so the resolver cache serves them and this is nearly free.
-#[derive(Clone, Default)]
-pub struct LegacyOrderResolver;
-
-impl ValueOperator for LegacyOrderResolver {
- type Item = ExceptionEvent<Parsed>;
- type Context = ResolutionStage;
- type HandledError = HandledError;
- type UnhandledError = UnhandledError;
-
- fn name(&self) -> &'static str {
- LEGACY_ORDER_RESOLVER_OPERATOR
- }
-
- async fn execute_value(
- &self,
- mut evt: ExceptionEvent<Parsed>,
- ctx: ResolutionStage,
- ) -> OperatorResult<Self> {
- let Some(legacy) = evt.take_legacy_order_exception_list() else {
- return Ok(Ok(evt));
- };
-
- // Legacy resolution only powers best-effort issue-continuity aliasing,
- // so it must never fail the event. On the remote path especially, this
- // runs through the local resolver even though the canonical list was
- // resolved remotely, so local storage/DB access can fail here where the
- // canonical resolution succeeded. Swallow any error: a missing legacy
- // fingerprint just falls back to the pre-normalization behavior of
- // creating a fresh issue.
- match resolve_legacy(&evt, legacy, ctx).await {
- Ok(resolved) => evt.set_legacy_order_resolved(resolved),
- Err(e) => {
- metrics::counter!(LEGACY_ORDER_RESOLVE_FAILED).increment(1);
- debug!(event = %evt.uuid(), "legacy-order resolution failed, skipping alias: {e}");
- }
- }
- Ok(Ok(evt))
- }
-}
diff --git a/rust/cymbal/src/modes/processing/stages/resolution/mod.rs b/rust/cymbal/src/modes/processing/stages/resolution/mod.rs
index 0558844d73d1..2e2a63bfbea3 100644
--- a/rust/cymbal/src/modes/processing/stages/resolution/mod.rs
+++ b/rust/cymbal/src/modes/processing/stages/resolution/mod.rs
@@ -4,7 +4,6 @@ use tokio::sync::{OwnedSemaphorePermit, Semaphore};
pub mod exception;
pub mod frame;
-pub mod legacy;
pub mod remote;
use crate::{
@@ -12,12 +11,7 @@ use crate::{
error::UnhandledError,
metric_consts::RESOLUTION_STAGE,
stages::pipeline::{ParsedPipelineItem, ResolvedPipelineItem},
- stages::resolution::{
- exception::ExceptionResolver,
- frame::FrameResolver,
- legacy::LegacyOrderResolver,
- remote::resolver::{resolve_batch, RemoteResolutionContext},
- },
+ stages::resolution::remote::resolver::{resolve_batch, RemoteResolutionContext},
symbolication::symbol::SymbolResolver,
types::{
batch::Batch,
@@ -27,27 +21,28 @@ use crate::{
#[derive(Clone)]
pub struct ResolutionStage {
+ pub remote: RemoteResolutionContext,
+}
+
+#[derive(Clone)]
+pub struct LocalResolutionContext {
pub symbol_resolver: Arc<dyn SymbolResolver>,
pub symbol_resolution_limiter: Arc<Semaphore>,
- /// When `Some`, the resolution stage can route sampled events through the
- /// remote `cymbal.resolution.v1` client path. Unsampled events still use
- /// local exception+frame resolution. There is no local fallback for events
- /// selected for remote processing: if the remote pool can't serve the
- /// request, the orchestration layer surfaces an unhandled error.
- pub remote: Option<RemoteResolutionContext>,
}
impl From<&Arc<AppContext>> for ResolutionStage {
fn from(app_context: &Arc<AppContext>) -> Self {
Self {
- symbol_resolver: app_context.as_ref().symbol_resolver.clone(),
- symbol_resolution_limiter: app_context.as_ref().symbol_resolution_limiter.clone(),
- remote: app_context.as_ref().remote_resolution.clone(),
+ remote: app_context
+ .as_ref()
+ .remote_resolution
+ .clone()
+ .expect("processing app context requires remote resolution"),
}
}
}
-impl ResolutionStage {
+impl LocalResolutionContext {
pub async fn acquire_symbol_resolution_permit(
&self,
) -> Result<OwnedSemaphorePermit, UnhandledError> {
@@ -68,26 +63,7 @@ impl Stage for ResolutionStage {
}
async fn process(self, batch: Batch<Self::Input>) -> StageResult<Self> {
- if let Some(remote) = self.remote.clone() {
- // Remote mode: the stage owns orchestration across the incoming
- // batch, including deterministic rollout sampling. Sampled events
- // use grouped exception-level Resolve items, and unsampled events use
- // the local exception/frame operators. Both paths materialize the
- // resolved event metadata before returning.
- let resolved = resolve_batch(batch, remote, self.clone())
- .await?
- .apply_operator(LegacyOrderResolver, self.clone())
- .await?;
- return Ok(resolved.map(|item, ()| item.map(|event| event.into_resolved()), &mut ()));
- }
-
- let resolved = batch
- .apply_operator(ExceptionResolver, self.clone())
- .await?
- .apply_operator(FrameResolver, self.clone())
- .await?
- .apply_operator(LegacyOrderResolver, self.clone())
- .await?;
+ let resolved = resolve_batch(batch, self.remote).await?;
Ok(resolved.map(|item, ()| item.map(|event| event.into_resolved()), &mut ()))
}
}
diff --git a/rust/cymbal/src/modes/processing/stages/resolution/remote/config.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/config.rs
index 077676e3b412..c5f02d8bbc2c 100644
--- a/rust/cymbal/src/modes/processing/stages/resolution/remote/config.rs
+++ b/rust/cymbal/src/modes/processing/stages/resolution/remote/config.rs
@@ -27,10 +27,6 @@ pub struct RemoteResolutionConfig {
pub overload_ejection_max: Duration,
/// Quiet window after which endpoint ejection backs off to the initial duration.
pub overload_ejection_decay: Duration,
- /// Event-level deterministic sample rate for sending eligible events to
- /// cymbal-resolution. Defaults to 0.0 in [`Config`] so enabling remote mode
- /// alone does not start sending traffic until rollout is ramped explicitly.
- pub sample_rate: f64,
/// Rank-distribution factor for selecting among rendezvous-ranked candidates.
/// `0.0` is fully sticky to rank 0; `1.0` is uniform across candidates.
pub routing_jitter: f64,
@@ -54,12 +50,12 @@ impl RemoteResolutionConfig {
pub fn from_config(config: &ProcessingConfig) -> Result<Self, UnhandledError> {
if config.remote_resolution_host.trim().is_empty() {
return Err(UnhandledError::Other(
- "remote resolution enabled but CYMBAL_REMOTE_RESOLUTION_HOST is empty".to_string(),
+ "CYMBAL_REMOTE_RESOLUTION_HOST is empty".to_string(),
));
}
if config.resolver.internal_api_secret.trim().is_empty() {
return Err(UnhandledError::Other(
- "remote resolution enabled but INTERNAL_API_SECRET is empty".to_string(),
+ "INTERNAL_API_SECRET is empty".to_string(),
));
}
Ok(Self {
@@ -89,7 +85,6 @@ impl RemoteResolutionConfig {
overload_ejection_decay: Duration::from_millis(
config.remote_resolution_overload_ejection_decay_ms,
),
- sample_rate: normalized_probability(config.remote_resolution_sample_rate),
routing_jitter: normalized_probability(config.remote_resolution_routing_jitter),
routing_acceptance_concurrency: config
.remote_resolution_routing_acceptance_concurrency
diff --git a/rust/cymbal/src/modes/processing/stages/resolution/remote/mod.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/mod.rs
index c6ac973adb4a..f84644887609 100644
--- a/rust/cymbal/src/modes/processing/stages/resolution/remote/mod.rs
+++ b/rust/cymbal/src/modes/processing/stages/resolution/remote/mod.rs
@@ -1,13 +1,7 @@
//! Remote `cymbal.resolution.v1` client integration.
//!
-//! When `Config::remote_resolution_enabled` is set, the resolution stage
-//! routes exception-level symbol resolution through the `cymbal-resolution`
-//! service via a caller-owned endpoint pool instead of running
-//! [`crate::symbolication::symbol::local::LocalSymbolResolver`] inline.
-//!
-//! There is intentionally no silent local fallback: if the pool cannot
-//! satisfy a request, the stage surfaces an unhandled error for the batch
-//! instead of falling back to local resolution.
+//! The processing resolution stage routes exception-level work through the
+//! `cymbal-resolution` service via a caller-owned endpoint pool.
pub mod client;
pub mod config;
diff --git a/rust/cymbal/src/modes/processing/stages/resolution/remote/pool.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/pool.rs
index 9bce8d3441be..411cda8cd30c 100644
--- a/rust/cymbal/src/modes/processing/stages/resolution/remote/pool.rs
+++ b/rust/cymbal/src/modes/processing/stages/resolution/remote/pool.rs
@@ -974,7 +974,6 @@ mod test {
max_retries: 2,
retry_backoff: Duration::from_millis(1),
retry_max_backoff: Duration::from_millis(2),
- sample_rate: 1.0,
routing_jitter: 0.0,
routing_acceptance_concurrency: 10,
overload_ejection_initial: Duration::ZERO,
diff --git a/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver.rs
index 3ee12ce127f9..62aba2a4003a 100644
--- a/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver.rs
+++ b/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver.rs
@@ -8,13 +8,7 @@ use tokio::sync::Semaphore;
use crate::{
error::UnhandledError,
- stages::{
- pipeline::ParsedPipelineItem,
- resolution::{
- exception::ExceptionResolver, frame::FrameResolver, remote::pool::EndpointPool,
- ResolutionStage,
- },
- },
+ stages::{pipeline::ParsedPipelineItem, resolution::remote::pool::EndpointPool},
types::{
batch::Batch,
exception_event::{ExceptionEvent, Parsed},
@@ -59,9 +53,8 @@ impl RemoteResolutionContext {
/// Resolve a whole stage batch through the remote pool.
///
/// Flow:
-/// 1. Partition the batch into errored / empty-passthrough / local / remote.
-/// 2. Resolve local events inline (same path as no-remote mode).
-/// 3. Build one logical work item per exception, grouped by routing key for
+/// 1. Partition the batch into errored / empty-passthrough / remote.
+/// 2. Build one logical work item per exception, grouped by routing key for
/// deterministic submission, and let each item reroute independently
/// through the mux.
/// 4. Assemble back into the original batch order.
@@ -71,19 +64,16 @@ impl RemoteResolutionContext {
pub async fn resolve_batch(
batch: Batch<ParsedPipelineItem>,
ctx: RemoteResolutionContext,
- local_stage: ResolutionStage,
) -> Result<Batch<ParsedPipelineItem>, UnhandledError> {
let batch_len = batch.len();
- let partition = partition_batch(batch, ctx.config.sample_rate)?;
+ let partition = partition_batch(batch)?;
- let local_resolved = resolve_local_events(partition.local, local_stage).await?;
let remote_resolved = resolve_remote_events(&ctx, partition.remote).await?;
assemble_output(
batch_len,
partition.errors,
partition.empty,
- local_resolved,
remote_resolved,
)
}
@@ -92,11 +82,10 @@ fn assemble_output(
batch_len: usize,
errors: Vec<(usize, ParsedPipelineItem)>,
empty: Vec<(usize, ParsedPipelineItem)>,
- local: Vec<(usize, ParsedPipelineItem)>,
remote: Vec<(usize, ParsedPipelineItem)>,
) -> Result<Batch<ParsedPipelineItem>, UnhandledError> {
let mut output: Vec<Option<ParsedPipelineItem>> = (0..batch_len).map(|_| None).collect();
- for (idx, item) in errors.into_iter().chain(empty).chain(local).chain(remote) {
+ for (idx, item) in errors.into_iter().chain(empty).chain(remote) {
output[idx] = Some(item);
}
let resolved: Vec<ParsedPipelineItem> = output
@@ -115,7 +104,7 @@ fn assemble_output(
// Shared data types: an event, exception work item, and resolved slot
// ─────────────────────────────────────────────────────────────────────────────
-/// A sampled-remote event with its wire payloads pre-serialized.
+/// An event with its wire payloads pre-serialized for remote resolution.
///
/// Owning the serialized bytes alongside the event means each `RemoteEvent`
/// moves through the work-item → RPC → apply pipeline by value. No shared
@@ -126,6 +115,9 @@ struct RemoteEvent {
evt: ExceptionEvent<Parsed>,
/// One serialized exception per `evt.exception_list` entry, in order.
exception_jsons: Vec<Vec<u8>>,
+ /// The byte-exact pre-normalization order, when wire-order normalization
+ /// changed the event. Resolving it separately preserves legacy fingerprints.
+ legacy_exception_jsons: Option<Vec<Vec<u8>>>,
/// Shared across this event's exceptions on the wire. The proto carries
/// it per-item; this is the per-event source bytes we clone from.
metadata: Vec<u8>,
@@ -141,6 +133,13 @@ struct RemoteEventSlot {
batch_index: usize,
evt: ExceptionEvent<Parsed>,
resolved: Vec<Option<Exception>>,
+ legacy_resolved: Option<Vec<Option<Exception>>>,
+}
+
+#[derive(Clone, Copy)]
+enum ResolutionTarget {
+ Canonical,
+ Legacy,
}
/// One logical exception-level item. `token` is client-side only: the mux may
@@ -150,6 +149,7 @@ struct RemoteWorkItem {
routing_key: String,
event_slot: usize,
exception_slot: usize,
+ target: ResolutionTarget,
item: ResolveItem,
}
@@ -165,30 +165,10 @@ impl RemoteWorkItem {
struct ResolvedRemoteItem {
event_slot: usize,
exception_slot: usize,
+ target: ResolutionTarget,
exception: Exception,
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Local resolution path (passthrough to the inline stage)
-// ─────────────────────────────────────────────────────────────────────────────
-
-async fn resolve_local_events(
- local_events: Vec<(usize, ExceptionEvent<Parsed>)>,
- local_stage: ResolutionStage,
-) -> Result<Vec<(usize, ParsedPipelineItem)>, UnhandledError> {
- if local_events.is_empty() {
- return Ok(Vec::new());
- }
- let (indexes, events): (Vec<usize>, Vec<ExceptionEvent<Parsed>>) =
- local_events.into_iter().unzip();
- let batch = Batch::from(events.into_iter().map(Ok).collect::<Vec<_>>())
- .apply_operator(ExceptionResolver, local_stage.clone())
- .await?
- .apply_operator(FrameResolver, local_stage)
- .await?;
- Ok(indexes.into_iter().zip(batch.into_iter()).collect())
-}
-
// ─────────────────────────────────────────────────────────────────────────────
// Remote resolution path: group → flatten → reroute independently → apply
// ─────────────────────────────────────────────────────────────────────────────
@@ -221,7 +201,16 @@ async fn resolve_remote_events(
item.event_slot
)));
};
- let Some(slot) = event_slot.resolved.get_mut(item.exception_slot) else {
+ let slots = match item.target {
+ ResolutionTarget::Canonical => &mut event_slot.resolved,
+ ResolutionTarget::Legacy => event_slot.legacy_resolved.as_mut().ok_or_else(|| {
+ UnhandledError::Other(format!(
+ "remote resolution returned legacy result for event slot {} without a legacy snapshot",
+ item.event_slot
+ ))
+ })?,
+ };
+ let Some(slot) = slots.get_mut(item.exception_slot) else {
return Err(UnhandledError::Other(format!(
"remote resolution returned invalid exception slot {} for event slot {}",
item.exception_slot, item.event_slot
@@ -254,6 +243,23 @@ async fn resolve_remote_events(
event
.evt
.replace_exception_list(ExceptionList::from(exceptions));
+ if let Some(legacy) = event.legacy_resolved {
+ let legacy = legacy
+ .into_iter()
+ .enumerate()
+ .map(|(exception_slot, slot)| {
+ slot.ok_or_else(|| {
+ UnhandledError::Other(format!(
+ "remote resolution left legacy event slot {} exception slot {exception_slot} unfilled",
+ event.batch_index
+ ))
+ })
+ })
+ .collect::<Result<Vec<_>, _>>()?;
+ event
+ .evt
+ .set_legacy_order_resolved(ExceptionList::from(legacy));
+ }
Ok((event.batch_index, Ok(event.evt)))
})
.collect()
@@ -290,6 +296,7 @@ fn build_work_items(
routing_key,
event_slot,
exception_slot,
+ target: ResolutionTarget::Canonical,
item: ResolveItem {
id: token,
team_id,
@@ -300,10 +307,45 @@ fn build_work_items(
});
}
+ if let Some(legacy_exception_jsons) = &event.legacy_exception_jsons {
+ for (exception_slot, exception_json) in
+ legacy_exception_jsons.iter().cloned().enumerate()
+ {
+ let routing_key = format!("team:{team_id}");
+ let token = next_token;
+ next_token = next_token.checked_add(1).ok_or_else(|| {
+ UnhandledError::Other(
+ "remote resolution work item token overflowed".to_string(),
+ )
+ })?;
+ work_items_by_key
+ .entry(routing_key.clone())
+ .or_default()
+ .push(RemoteWorkItem {
+ token,
+ routing_key,
+ event_slot,
+ exception_slot,
+ target: ResolutionTarget::Legacy,
+ item: ResolveItem {
+ id: token,
+ team_id,
+ exception_json,
+ metadata: event.metadata.clone(),
+ deadline_ms: 0,
+ },
+ });
+ }
+ }
+
event_slots.push(RemoteEventSlot {
batch_index: event.batch_index,
evt: event.evt,
resolved: (0..item_count).map(|_| None).collect(),
+ legacy_resolved: event
+ .legacy_exception_jsons
+ .as_ref()
+ .map(|items| (0..items.len()).map(|_| None).collect()),
});
}
@@ -399,6 +441,31 @@ mod tests {
);
}
+ #[test]
+ fn build_work_items_resolves_legacy_snapshot_separately() {
+ let mut event = fake_remote_event(2, 3, 2);
+ event.legacy_exception_jsons = Some(event.exception_jsons.clone());
+
+ let (event_slots, work_items) = build_work_items(vec![event]).expect("build work items");
+
+ assert_eq!(work_items.len(), 4);
+ assert_eq!(
+ work_items
+ .iter()
+ .filter(|item| matches!(item.target, ResolutionTarget::Legacy))
+ .count(),
+ 2
+ );
+ assert_eq!(
+ event_slots[0]
+ .legacy_resolved
+ .as_ref()
+ .expect("legacy result slots")
+ .len(),
+ 2
+ );
+ }
+
fn fake_remote_event(team_id: i32, batch_index: usize, n_exceptions: usize) -> RemoteEvent {
fake_remote_event_from_exceptions(
team_id,
@@ -438,6 +505,7 @@ mod tests {
batch_index,
evt,
exception_jsons,
+ legacy_exception_jsons: None,
metadata: Vec::new(),
}
}
diff --git a/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/partition.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/partition.rs
index a51fa7065818..a15f0c6d8276 100644
--- a/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/partition.rs
+++ b/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/partition.rs
@@ -1,10 +1,6 @@
-//! Split a stage batch into errored / empty / local / remote buckets and
-//! decide, per event, whether it samples into remote resolution.
-
-use sha2::{Digest, Sha256};
+//! Split a stage batch into errored / empty / remote buckets.
use crate::error::UnhandledError;
-use crate::metric_consts::REMOTE_RESOLUTION_SAMPLING;
use crate::stages::pipeline::ParsedPipelineItem;
use crate::types::{
batch::Batch,
@@ -16,17 +12,14 @@ use super::RemoteEvent;
pub(super) struct Partition {
pub(super) errors: Vec<(usize, ParsedPipelineItem)>,
pub(super) empty: Vec<(usize, ParsedPipelineItem)>,
- pub(super) local: Vec<(usize, ExceptionEvent<Parsed>)>,
pub(super) remote: Vec<RemoteEvent>,
}
pub(super) fn partition_batch(
batch: Batch<ParsedPipelineItem>,
- sample_rate: f64,
) -> Result<Partition, UnhandledError> {
let mut errors = Vec::new();
let mut empty = Vec::new();
- let mut local = Vec::new();
let mut remote = Vec::new();
for (batch_index, item) in batch.into_iter().enumerate() {
@@ -43,32 +36,34 @@ pub(super) fn partition_batch(
continue;
}
- if should_route_event_to_remote(&evt, sample_rate) {
- metrics::counter!(REMOTE_RESOLUTION_SAMPLING, "decision" => "remote").increment(1);
- remote.push(prepare_remote_event(batch_index, evt)?);
- } else {
- metrics::counter!(REMOTE_RESOLUTION_SAMPLING, "decision" => "local").increment(1);
- local.push((batch_index, evt));
- }
+ remote.push(prepare_remote_event(batch_index, evt)?);
}
Ok(Partition {
errors,
empty,
- local,
remote,
})
}
fn prepare_remote_event(
batch_index: usize,
- evt: ExceptionEvent<Parsed>,
+ mut evt: ExceptionEvent<Parsed>,
) -> Result<RemoteEvent, UnhandledError> {
let exception_jsons: Vec<Vec<u8>> = evt
.exception_list
.iter()
.map(|exc| serde_json::to_vec(exc).map_err(UnhandledError::from))
.collect::<Result<_, _>>()?;
+ let legacy_exception_jsons = evt
+ .take_legacy_order_exception_list()
+ .map(|exceptions| {
+ exceptions
+ .iter()
+ .map(|exc| serde_json::to_vec(exc).map_err(UnhandledError::from))
+ .collect::<Result<Vec<_>, _>>()
+ })
+ .transpose()?;
let metadata = if evt.debug_images.is_empty() {
Vec::new()
} else {
@@ -81,69 +76,7 @@ fn prepare_remote_event(
batch_index,
evt,
exception_jsons,
+ legacy_exception_jsons,
metadata,
})
}
-
-fn should_route_event_to_remote(evt: &ExceptionEvent<Parsed>, sample_rate: f64) -> bool {
- if sample_rate <= 0.0 {
- return false;
- }
- if sample_rate >= 1.0 {
- return true;
- }
-
- let mut hasher = Sha256::new();
- hasher.update(evt.team_id().to_be_bytes());
- hasher.update(evt.uuid().as_bytes());
- let digest = hasher.finalize();
- let bucket_bytes: [u8; 8] = digest[..8]
- .try_into()
- .expect("sha256 digest always contains at least 8 bytes");
- let bucket = u64::from_be_bytes(bucket_bytes) as f64 / ((u64::MAX as f64) + 1.0);
- bucket < sample_rate
-}
-
-#[cfg(test)]
-mod tests {
- use std::collections::HashMap;
-
- use serde_json::json;
- use uuid::Uuid;
-
- use super::*;
- use crate::types::event::AnyEvent;
-
- fn event() -> ExceptionEvent<Parsed> {
- AnyEvent {
- uuid: Uuid::from_u128(0x123456789abcdef),
- event: "$exception".to_string(),
- team_id: 123,
- timestamp: String::new(),
- properties: json!({
- "$exception_list": [{ "type": "Error", "value": "boom" }]
- }),
- others: HashMap::new(),
- }
- .try_into()
- .expect("valid exception properties")
- }
-
- #[test]
- fn sampling_decision_is_stable_for_same_team_and_event_uuid() {
- let evt = event();
-
- let first = should_route_event_to_remote(&evt, 0.37);
- for _ in 0..100 {
- assert_eq!(should_route_event_to_remote(&evt, 0.37), first);
- }
- }
-
- #[test]
- fn sampling_decision_respects_rate_boundaries() {
- let evt = event();
-
- assert!(!should_route_event_to_remote(&evt, 0.0));
- assert!(should_route_event_to_remote(&evt, 1.0));
- }
-}
diff --git a/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/retry.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/retry.rs
index efbdc5475c62..826b2d8a7e4d 100644
--- a/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/retry.rs
+++ b/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/retry.rs
@@ -157,6 +157,7 @@ pub(super) async fn resolve_work_item(
return Ok(ResolvedRemoteItem {
event_slot: work_item.event_slot,
exception_slot: work_item.exception_slot,
+ target: work_item.target,
exception,
});
}
@@ -353,7 +354,7 @@ fn classify_outcome(
fn terminal_item_error(token: u64, message: String) -> UnhandledError {
metrics::counter!(REMOTE_RESOLUTION_REQUESTS, "outcome" => "items_failed").increment(1);
UnhandledError::Other(format!(
- "remote resolution item {token} failed terminally; failing batch under all-or-nothing rollout policy ({message})"
+ "remote resolution item {token} failed terminally; failing batch ({message})"
))
}
@@ -513,6 +514,7 @@ mod tests {
routing_key: "team:1".to_string(),
event_slot: 0,
exception_slot: 0,
+ target: super::super::ResolutionTarget::Canonical,
item: cymbal_proto::cymbal::resolution::v1::ResolveItem {
id: token,
team_id: 1,
diff --git a/rust/cymbal/src/modes/resolution/README.md b/rust/cymbal/src/modes/resolution/README.md
index 588fed4fd80f..0bf1bdfd2caa 100644
--- a/rust/cymbal/src/modes/resolution/README.md
+++ b/rust/cymbal/src/modes/resolution/README.md
@@ -3,7 +3,7 @@
gRPC service that owns exception-level symbol resolution for PostHog error tracking.
It is a run mode of the `cymbal` binary, selected with `CYMBAL_MODE=resolution`.
It speaks `cymbal.resolution.v1` and is used by cymbal's processing mode (the client lives in
-[`stages/resolution/remote`](../../stages/resolution/remote)) when remote resolution is enabled.
+[`stages/resolution/remote`](../../stages/resolution/remote)).
## Architecture
@@ -14,10 +14,9 @@ events ──HTTP─────▶│ cymbal
│ │
│ ┌──────────────────────────────────────────────┐ │
│ │ ResolutionStage │ │
- │ │ - partitions events into local/remote │ │
│ │ - builds ResolveItems at resolution time │ │
│ └──────────────────────┬───────────────────────┘ │
- │ │ sampled remote events │
+ │ │ exception events │
│ ┌──────────────────────▼───────────────────────┐ │
│ │ EndpointPool │ │
│ │ - DNS-discovered endpoints │ │
@@ -58,17 +57,11 @@ The contract is intentionally split across two streams:
The proto lives at [`proto/cymbal/resolution/v1/resolution.proto`](../../../../../proto/cymbal/resolution/v1/resolution.proto).
-## Rollout model
+## Deployment model
-Remote resolution is opt-in on the cymbal side. There is intentionally **no silent local fallback** for events sampled into the remote path: when the pool cannot satisfy a sampled remote item, cymbal surfaces an `UnhandledError` for that event so the failure is visible rather than masked. Events not selected by `CYMBAL_REMOTE_RESOLUTION_SAMPLE_RATE` are not remote attempts; they run through the inline local exception/frame resolvers.
+Processing always resolves exceptions through the `cymbal-resolution` pool. There is no silent inline fallback: when the pool cannot satisfy an item, cymbal surfaces an `UnhandledError` so the failure is visible rather than masked.
-| Mode | Cymbal env vars | Resolution path |
-| ---- | --------------- | --------------- |
-| Local | `CYMBAL_REMOTE_RESOLUTION_ENABLED=false` (default) | Inline local resolver inside `cymbal` |
-| Sampled remote | `CYMBAL_REMOTE_RESOLUTION_ENABLED=true`, sampled by `CYMBAL_REMOTE_RESOLUTION_SAMPLE_RATE` | gRPC to the `cymbal-resolution` pool, no fallback |
-| Unsampled local | `CYMBAL_REMOTE_RESOLUTION_ENABLED=true`, not sampled by `CYMBAL_REMOTE_RESOLUTION_SAMPLE_RATE` | Inline local resolver inside `cymbal` |
-
-### Enabling remote mode
+### Deploying resolution mode
1. Deploy `cymbal-resolution` pods behind a headless Kubernetes service so each pod is reachable by IP. `cymbal` resolves the service hostname via DNS and opens one channel per returned address.
2. Confirm the pods are serving:
@@ -76,8 +69,6 @@ Remote resolution is opt-in on the cymbal side. There is intentionally **no sile
- `/_readiness` returns `ok`
- `cymbal_remote_resolution_pool_size` becomes non-zero on cymbal pods once they are pointed at the service.
3. Set on `cymbal` pods:
- - `CYMBAL_REMOTE_RESOLUTION_ENABLED=true`
- - `CYMBAL_REMOTE_RESOLUTION_SAMPLE_RATE=<0.0..=1.0>` (defaults to `0.0`, so enabling alone routes no traffic)
- `CYMBAL_REMOTE_RESOLUTION_HOST=<service-hostname>`
- `CYMBAL_REMOTE_RESOLUTION_PORT=50061` (default)
4. Roll cymbal pods. Startup eagerly resolves DNS and fails loudly if the host is empty, no addresses come back, or no endpoint produces a fresh non-draining `LoadEvent` during the readiness window.
@@ -94,13 +85,7 @@ symbol stores. The rendezvous score is adjusted by the latest server load
snapshot and the caller's own local in-flight count, so highly loaded pods
become less likely to receive new work before they return overload outcomes.
-Each endpoint owns one bidirectional Resolve mux with a bounded outbound queue and one waiter per in-flight item. Queue admission failure, stream break, endpoint drain, and endpoint eviction all fail affected items as `ERROR_KIND_OVERLOADED`; the per-item retry layer excludes that endpoint and reroutes only those items. A `Retry` outcome uses the generic retry policy. Cymbal also holds a process-local routing semaphore for items trying to find an accepting pod; a permit is acquired before routing, released on `Accepted`, and otherwise held until routing exhausts or fails terminally. Terminal `ErrorKind`s fail the current all-or-nothing rollout path.
-
-### Disabling / rolling back
-
-Set `CYMBAL_REMOTE_RESOLUTION_ENABLED=false` on the cymbal pods and roll. That fully reverts to local resolution; no data-plane state needs to be flushed and the `cymbal-resolution` pods can keep running without harm.
-
-For a partial rollback, lower `CYMBAL_REMOTE_RESOLUTION_SAMPLE_RATE`. The decision is deterministic by `(team_id, event_uuid)`, so the same event keeps the same local/remote decision across retries, pods, and process restarts.
+Each endpoint owns one bidirectional Resolve mux with a bounded outbound queue and one waiter per in-flight item. Queue admission failure, stream break, endpoint drain, and endpoint eviction all fail affected items as `ERROR_KIND_OVERLOADED`; the per-item retry layer excludes that endpoint and reroutes only those items. A `Retry` outcome uses the generic retry policy. Cymbal also holds a process-local routing semaphore for items trying to find an accepting pod; a permit is acquired before routing, released on `Accepted`, and otherwise held until routing exhausts or fails terminally. Terminal `ErrorKind`s fail the batch.
### Compatibility with the Node error-tracking consumer
@@ -114,17 +99,15 @@ All variables are prefixed `CYMBAL_REMOTE_RESOLUTION_` and live on `cymbal::conf
| Env var | Default | Purpose |
| ------- | ------- | ------- |
-| `CYMBAL_REMOTE_RESOLUTION_ENABLED` | `false` | Master switch. `true` routes sampled exception resolution through the remote pool. |
-| `CYMBAL_REMOTE_RESOLUTION_HOST` | _empty_ | Service hostname resolved via DNS. Required when enabled; empty value fails boot. |
+| `CYMBAL_REMOTE_RESOLUTION_HOST` | _empty_ | Service hostname resolved via DNS. Required; empty value fails boot. |
| `CYMBAL_REMOTE_RESOLUTION_PORT` | `50061` | gRPC port the pods listen on. Must match the server-side `GRPC_ADDRESS` port. |
-| `INTERNAL_API_SECRET` | _empty_ | Shared secret sent as `X-Internal-Api-Secret` on every `Resolve` and `Subscribe` RPC. Required when remote mode is enabled. |
+| `INTERNAL_API_SECRET` | _empty_ | Shared secret sent as `X-Internal-Api-Secret` on every `Resolve` and `Subscribe` RPC. Required. |
| `CYMBAL_REMOTE_RESOLUTION_DNS_REFRESH_SECS` | `30` | How often DNS is re-resolved and the pool reconciled. |
| `CYMBAL_REMOTE_RESOLUTION_DEADLINE_MS` | `15000` | Shared per-event remote deadline used by all item reroutes. |
| `CYMBAL_REMOTE_RESOLUTION_CONNECT_TIMEOUT_MS` | `1000` | Per-endpoint TCP/HTTP2 connect timeout. |
| `CYMBAL_REMOTE_RESOLUTION_MAX_RETRIES` | `2` | Caller-side reroutes after transport, overload, or `Retry` outcomes. |
| `CYMBAL_REMOTE_RESOLUTION_RETRY_BACKOFF_MS` | `50` | Base retry backoff before jitter. |
| `CYMBAL_REMOTE_RESOLUTION_RETRY_MAX_BACKOFF_MS` | `1000` | Maximum retry backoff after exponential scaling and jitter. |
-| `CYMBAL_REMOTE_RESOLUTION_SAMPLE_RATE` | `0.0` | Deterministic event-level remote rollout rate. |
| `CYMBAL_REMOTE_RESOLUTION_ROUTING_ACCEPTANCE_CONCURRENCY` | `10` | Maximum number of items per cymbal process that can wait concurrently for a pod to emit `Accepted`. |
| `CYMBAL_REMOTE_RESOLUTION_SUBSCRIBE_TICK_HINT_MS` | `1000` | Cadence hint sent on `SubscribeRequest`; snapshots are considered fresh for two ticks. |
| `CYMBAL_REMOTE_RESOLUTION_SUBSCRIBE_RECONNECT_BACKOFF_MS` | `500` | Backoff between subscription reconnect attempts when a stream terminates. |
@@ -163,7 +146,6 @@ Shared-secret callers are service-scoped today, so authenticated cymbal pods are
These metric names are exported by the cymbal client unless noted. Definitions live in [`cymbal/src/metric_consts.rs`](../cymbal/src/metric_consts.rs) and the server's Resolve/LoadMonitor modules.
-- **Rollout decisions**: `cymbal_remote_resolution_sampling_total{decision="remote"|"local"}`. `local` during a partial rollout is expected and is not fallback.
- **Item attempts and latency**: `cymbal_remote_resolution_requests_total{outcome, reason?}` and `cymbal_remote_resolution_latency_ms`. The counter is emitted on logical item attempts; `reason` is only a bounded transport status tag.
- **Reroute shape**: `cymbal_remote_resolution_reroute_depth{outcome}` records how many endpoint changes happened before the terminal item result. The legacy attempts histogram may still be emitted for dashboard continuity, but new alerts should use reroute depth.
- **Protocol error taxonomy**: client-observed `cymbal_remote_resolution_error_kinds_total{kind}` and server-emitted `cymbal_remote_resolution_server_error_kinds_total{kind}` count `ErrorKind` values with bounded labels.
@@ -176,10 +158,9 @@ These metric names are exported by the cymbal client unless noted. Definitions l
| Symptom | Likely cause | Suggested response |
| ------- | ------------ | ------------------ |
-| `pool_empty` spikes after cymbal startup | DNS refresh removed every endpoint, Subscribe has not produced fresh snapshots, or every endpoint reports draining | Inspect the `reason` label (`no_endpoints`, `no_fresh_load_snapshots`, `all_endpoints_draining`); startup fails for these states while remote resolution is enabled. |
-| `sampling_total{decision="local"}` rises while remote errors stay flat | Expected partial rollout or lower sample rate | No action unless the configured sample rate is wrong. |
+| `pool_empty` spikes after cymbal startup | DNS refresh removed every endpoint, Subscribe has not produced fresh snapshots, or every endpoint reports draining | Inspect the `reason` label (`no_endpoints`, `no_fresh_load_snapshots`, `all_endpoints_draining`); startup fails for these states. |
| `transport_retry{reason="unavailable"}` + `grpc_server_load_shed_total` | Server is at `MAX_CONCURRENT_REQUESTS` | Scale server pods or raise the cap after capacity-checking. |
-| `error_kinds_total{kind="overloaded"}` + rising reroute depth | Item-level overload backpressure | Scale server pods, tune item concurrency, or lower sample rate. |
+| `error_kinds_total{kind="overloaded"}` + rising reroute depth | Item-level overload backpressure | Scale server pods or tune item concurrency. |
| `endpoint_admission_rejections_total{reason="queue_full"}` | Local mux queue saturated before the item reached gRPC | Scale endpoints or increase the mux queue only after checking memory. |
| `transport_retry{reason="deadline_exceeded"}` with low load | Caller-side deadline shorter than worst-case resolution | Raise `CYMBAL_REMOTE_RESOLUTION_DEADLINE_MS`. |
| `error_kinds_total{kind="invalid_payload"}` | Wire-format or metadata mismatch | Check deploy skew and the metadata JSON convention. |
@@ -226,4 +207,4 @@ Logs intentionally do not include raw routing keys as metric labels. Routing key
## Tests
- `cargo test -p cymbal-proto` — proto contract round-trips for `ResolveItem`, `ResolveOutcome`, `ErrorKind`, `Retry`, and `LoadEvent`.
-- `cargo test -p cymbal` — resolution-mode service tests (`tests/resolution_service_tests.rs`: bidirectional streaming, accounting, overload, invalid payload, unhandled errors, Subscribe freshness/draining) plus client-side endpoint pool, mux, end-to-end Subscribe routing, and parity vs local mode.
+- `cargo test -p cymbal` — resolution-mode service tests (`tests/resolution_service_tests.rs`: bidirectional streaming, accounting, overload, invalid payload, unhandled errors, Subscribe freshness/draining) plus client-side endpoint pool, mux, and end-to-end Subscribe routing.
diff --git a/rust/cymbal/src/modes/resolution/service.rs b/rust/cymbal/src/modes/resolution/service.rs
index a6c87fd0fef3..4919c9f57424 100644
--- a/rust/cymbal/src/modes/resolution/service.rs
+++ b/rust/cymbal/src/modes/resolution/service.rs
@@ -3,7 +3,7 @@ use std::sync::{
Arc,
};
-use crate::stages::resolution::ResolutionStage;
+use crate::stages::resolution::LocalResolutionContext;
use crate::symbolication::symbol::SymbolResolver;
use std::pin::Pin;
@@ -61,14 +61,10 @@ impl CymbalResolutionService {
}
}
- fn resolution_stage(&self) -> ResolutionStage {
- ResolutionStage {
+ fn resolution_stage(&self) -> LocalResolutionContext {
+ LocalResolutionContext {
symbol_resolver: self.symbol_resolver.clone(),
symbol_resolution_limiter: self.symbol_resolution_limiter.clone(),
- // The cymbal-resolution server never enables remote mode itself;
- // it is the server side that cymbal talks to. Local resolution is
- // the only valid path here.
- remote: None,
}
}
}
diff --git a/rust/cymbal/src/modes/resolution/service/resolve.rs b/rust/cymbal/src/modes/resolution/service/resolve.rs
index 5f0aecfe37f3..c9b341af054a 100644
--- a/rust/cymbal/src/modes/resolution/service/resolve.rs
+++ b/rust/cymbal/src/modes/resolution/service/resolve.rs
@@ -11,7 +11,7 @@ use crate::error::UnhandledError;
use crate::langs::native::DebugImage;
use crate::stages::resolution::exception::ExceptionResolver;
use crate::stages::resolution::frame::FrameResolver;
-use crate::stages::resolution::ResolutionStage;
+use crate::stages::resolution::LocalResolutionContext;
use crate::types::Exception;
use cymbal_proto::cymbal::resolution::v1::{
resolve_outcome, Accepted, Done, Error as ItemError, ResolveItem, ResolveOutcome,
@@ -27,7 +27,7 @@ const SERVER_ITEMS_TOTAL: &str = "cymbal_remote_resolution_server_items_total";
pub(super) async fn run_resolve(
mut input: Streaming<ResolveItem>,
- stage: ResolutionStage,
+ stage: LocalResolutionContext,
tx: mpsc::Sender<Result<ResolveOutcome, Status>>,
load_monitor: LoadMonitor,
) {
@@ -139,7 +139,7 @@ impl Drop for InFlightGuard {
}
async fn process_item(
- stage: ResolutionStage,
+ stage: LocalResolutionContext,
item: ResolveItem,
in_flight_guard: InFlightGuard,
) -> ProcessedItem {
@@ -230,7 +230,10 @@ enum ItemFailure {
Unhandled(String),
}
-async fn resolve_item(stage: &ResolutionStage, item: &ResolveItem) -> Result<Vec<u8>, ItemFailure> {
+async fn resolve_item(
+ stage: &LocalResolutionContext,
+ item: &ResolveItem,
+) -> Result<Vec<u8>, ItemFailure> {
let exception: Exception = serde_json::from_slice(&item.exception_json)
.map_err(|e| ItemFailure::InvalidPayload(format!("invalid exception_json: {e}")))?;
@@ -270,7 +273,7 @@ enum ResolveOneError {
}
async fn resolve_one_exception(
- stage: ResolutionStage,
+ stage: LocalResolutionContext,
team_id: i32,
exception: Exception,
debug_images: Vec<DebugImage>,
@@ -299,7 +302,7 @@ async fn resolve_one_exception(
}
async fn acquire_permit(
- stage: &ResolutionStage,
+ stage: &LocalResolutionContext,
) -> Result<tokio::sync::OwnedSemaphorePermit, ResolveOneError> {
stage
.acquire_symbol_resolution_permit()
diff --git a/rust/cymbal/src/test_utils.rs b/rust/cymbal/src/test_utils.rs
deleted file mode 100644
index 4c8a86f987cb..000000000000
--- a/rust/cymbal/src/test_utils.rs
+++ /dev/null
@@ -1,74 +0,0 @@
-//! Test utilities for creating mock AppContext and related helpers.
-//! This module is only available when the `test-utils` feature is enabled or during tests.
-
-use std::sync::Arc;
-
-use async_trait::async_trait;
-use bytes::Bytes;
-use common_redis::MockRedisClient;
-use mockall::mock;
-use sqlx::PgPool;
-
-use crate::{
- app_context::AppContext, error::UnhandledError, modes::processing::config::ProcessingConfig,
- symbolication::symbol_store::BlobClient,
-};
-
-mock! {
- pub S3Client {}
-
- #[async_trait]
- impl BlobClient for S3Client {
- async fn get(&self, bucket: &str, key: &str) -> Result<Option<Bytes>, UnhandledError>;
- async fn put(&self, bucket: &str, key: &str, data: Bytes) -> Result<(), UnhandledError>;
- async fn delete(&self, bucket: &str, key: &str) -> Result<(), UnhandledError>;
- async fn ping_bucket(&self, bucket: &str) -> Result<(), UnhandledError>;
- }
-}
-
-pub async fn create_test_context(db: PgPool) -> Arc<AppContext> {
- create_test_context_with_config(db, ProcessingConfig::init_with_defaults().unwrap()).await
-}
-
-pub async fn create_test_context_with_config(
- db: PgPool,
- config: ProcessingConfig,
-) -> Arc<AppContext> {
- let mut mock_s3 = MockS3Client::new();
- mock_s3.expect_ping_bucket().returning(|_| Ok(()));
- let s3_client = Arc::new(mock_s3);
-
- let issue_buckets_redis_client = Arc::new(MockRedisClient::new());
-
- let app_ctx = AppContext::new(&config, s3_client, db.clone(), issue_buckets_redis_client)
- .await
- .unwrap();
-
- Arc::new(app_ctx)
-}
-
-pub async fn create_test_context_with_s3(
- db: PgPool,
- s3_client: Arc<MockS3Client>,
-) -> Arc<AppContext> {
- create_test_context_with_s3_and_config(
- db,
- s3_client,
- ProcessingConfig::init_with_defaults().unwrap(),
- )
- .await
-}
-
-pub async fn create_test_context_with_s3_and_config(
- db: PgPool,
- s3_client: Arc<MockS3Client>,
- config: ProcessingConfig,
-) -> Arc<AppContext> {
- let issue_buckets_redis_client = Arc::new(MockRedisClient::new());
-
- let app_ctx = AppContext::new(&config, s3_client, db.clone(), issue_buckets_redis_client)
- .await
- .unwrap();
-
- Arc::new(app_ctx)
-}
diff --git a/rust/cymbal/tests/common/mod.rs b/rust/cymbal/tests/common/mod.rs
index 56e5a05fa989..5ab9dd917ca6 100644
--- a/rust/cymbal/tests/common/mod.rs
+++ b/rust/cymbal/tests/common/mod.rs
@@ -46,7 +46,6 @@ use cymbal_proto::cymbal::resolution::v1::{
};
use futures::{Stream, StreamExt};
use tokio::sync::mpsc;
-use tokio::sync::Semaphore;
use tokio_stream::wrappers::ReceiverStream;
use tonic::{Request, Response, Status};
use uuid::Uuid;
@@ -335,14 +334,6 @@ pub fn unbound_addr() -> SocketAddr {
}
pub fn make_config(max_retries: u32, deadline: Duration) -> RemoteResolutionConfig {
- make_config_with_sample_rate(max_retries, deadline, 1.0)
-}
-
-pub fn make_config_with_sample_rate(
- max_retries: u32,
- deadline: Duration,
- sample_rate: f64,
-) -> RemoteResolutionConfig {
RemoteResolutionConfig {
host: "test-only".to_string(),
port: 0,
@@ -355,7 +346,6 @@ pub fn make_config_with_sample_rate(
// production defaults are tuned for thundering-herd mitigation.
retry_backoff: Duration::from_millis(1),
retry_max_backoff: Duration::from_millis(2),
- sample_rate,
routing_jitter: 0.0,
routing_acceptance_concurrency: 10,
overload_ejection_initial: Duration::ZERO,
@@ -382,20 +372,6 @@ pub async fn make_ctx(
RemoteResolutionContext::new(pool, config)
}
-pub async fn make_ctx_with_sample_rate(
- addrs: &[SocketAddr],
- max_retries: u32,
- deadline: Duration,
- sample_rate: f64,
-) -> RemoteResolutionContext {
- let config = make_config_with_sample_rate(max_retries, deadline, sample_rate);
- let pool = EndpointPool::from_addrs(config.clone(), addrs).expect("build pool");
- if !addrs.is_empty() {
- wait_until_routable(&pool).await;
- }
- RemoteResolutionContext::new(pool, config)
-}
-
/// Wait until the pool has at least one routable endpoint (a fresh
/// `LoadEvent` snapshot has arrived). Snapshot-required routing means an
/// empty pool persists until the per-endpoint Subscribe stream delivers its
@@ -448,19 +424,7 @@ impl SymbolResolver for NoopResolver {
}
pub fn remote_stage(ctx: RemoteResolutionContext) -> ResolutionStage {
- ResolutionStage {
- symbol_resolver: Arc::new(NoopResolver),
- symbol_resolution_limiter: Arc::new(Semaphore::new(4)),
- remote: Some(ctx),
- }
-}
-
-pub fn local_stage() -> ResolutionStage {
- ResolutionStage {
- symbol_resolver: Arc::new(NoopResolver),
- symbol_resolution_limiter: Arc::new(Semaphore::new(4)),
- remote: None,
- }
+ ResolutionStage { remote: ctx }
}
pub async fn process_one(
diff --git a/rust/cymbal/tests/event.rs b/rust/cymbal/tests/event.rs
index 92da4d14257d..3267c46223f9 100644
--- a/rust/cymbal/tests/event.rs
+++ b/rust/cymbal/tests/event.rs
@@ -205,9 +205,8 @@ impl TestHarness {
.body(Body::from(serde_json::to_vec(&events).unwrap()))
.unwrap()
},
- Arc::new(Self::create_s3_mock()),
+ Arc::new(MockS3Client::new()),
|config| {
- config.remote_resolution_enabled = true;
config.remote_resolution_host = "127.0.0.1".to_string();
config.remote_resolution_port = addr.port();
config.resolver.internal_api_secret = "test-secret".to_string();
@@ -220,7 +219,6 @@ impl TestHarness {
// Fast tick so the snapshot arrives within the first retry
// window even when the stub server runs at default cadence.
config.remote_resolution_subscribe_tick_hint_ms = 25;
- config.remote_resolution_sample_rate = 1.0;
config.remote_resolution_dns_refresh_secs = 3600;
},
)
diff --git a/rust/cymbal/tests/posthog_capture.rs b/rust/cymbal/tests/posthog_capture.rs
index 608d715f4ab8..8cf264341d4d 100644
--- a/rust/cymbal/tests/posthog_capture.rs
+++ b/rust/cymbal/tests/posthog_capture.rs
@@ -5,16 +5,13 @@ use axum::{body::Body, http::Request};
use common_redis::MockRedisClient;
use cymbal::{app_context::AppContext, modes::processing::ProcessingConfig, router::get_router};
use httpmock::prelude::*;
-use mockall::predicate;
use serde_json::json;
use sqlx::PgPool;
use tower::ServiceExt;
use uuid::Uuid;
+mod common;
mod utils;
-use utils::MockS3Client;
-
-const STORAGE_BUCKET: &str = "test-bucket";
// One test per binary: common_posthog::init configures a process-wide global
// client, so a second init with a different mock server would be ignored.
@@ -45,23 +42,15 @@ async fn pipeline_failure_is_captured_as_posthog_exception(db: PgPool) {
.await
.expect("posthog init");
+ let (addr, _) = common::spawn_stub_server(common::ServerBehavior::Happy).await;
let mut config = ProcessingConfig::init_with_defaults().unwrap();
- config.resolver.object_storage_bucket = STORAGE_BUCKET.to_string();
-
- let mut s3_client = MockS3Client::new();
- s3_client
- .expect_ping_bucket()
- .with(predicate::eq(STORAGE_BUCKET.to_string()))
- .returning(|_| Ok(()));
-
- let app_ctx = AppContext::new(
- &config,
- Arc::new(s3_client),
- db.clone(),
- Arc::new(MockRedisClient::new()),
- )
- .await
- .unwrap();
+ config.remote_resolution_host = "127.0.0.1".to_string();
+ config.remote_resolution_port = addr.port();
+ config.resolver.internal_api_secret = "test-secret".to_string();
+ config.remote_resolution_subscribe_tick_hint_ms = 25;
+ let app_ctx = AppContext::new(&config, db.clone(), Arc::new(MockRedisClient::new()))
+ .await
+ .unwrap();
let router = get_router(Arc::new(app_ctx));
// With the pool closed, the pipeline's first database access fails with
diff --git a/rust/cymbal/tests/remote_resolution.rs b/rust/cymbal/tests/remote_resolution.rs
index f798a53c83af..7bf6e3a4168e 100644
--- a/rust/cymbal/tests/remote_resolution.rs
+++ b/rust/cymbal/tests/remote_resolution.rs
@@ -14,8 +14,8 @@ use std::time::Duration;
use async_trait::async_trait;
use common::{
- build_event, build_event_with, local_stage, make_ctx, make_ctx_with_sample_rate, process_one,
- remote_stage, spawn_recording_stub_server, spawn_stub_server, ServerBehavior,
+ build_event, build_event_with, make_ctx, process_one, remote_stage,
+ spawn_recording_stub_server, spawn_stub_server, ServerBehavior,
};
use cymbal::error::{ResolveError, UnhandledError};
@@ -30,10 +30,8 @@ use cymbal::types::event::AnyEvent;
use cymbal::types::exception_event::{ExceptionEvent, Parsed};
use cymbal::types::operator::TeamId;
use cymbal::types::stage::Stage;
-use cymbal::types::Stacktrace;
use serde_json::json;
-use sha2::{Digest, Sha256};
-use tokio::sync::Semaphore;
+
use uuid::Uuid;
#[derive(Default)]
@@ -76,13 +74,9 @@ impl SymbolResolver for CountingResolver {
fn remote_stage_with_resolver(
ctx: cymbal::stages::resolution::remote::resolver::RemoteResolutionContext,
- resolver: Arc<CountingResolver>,
+ _resolver: Arc<CountingResolver>,
) -> ResolutionStage {
- ResolutionStage {
- symbol_resolver: resolver,
- symbol_resolution_limiter: Arc::new(Semaphore::new(4)),
- remote: Some(ctx),
- }
+ ResolutionStage { remote: ctx }
}
fn parsed_event(uuid: Uuid, properties: serde_json::Value) -> ExceptionEvent<Parsed> {
@@ -151,27 +145,6 @@ fn build_event_with_symbol_refs(uuid: Uuid, symbol_refs: &[&str]) -> ExceptionEv
)
}
-fn sampling_bucket(team_id: i32, uuid: Uuid) -> f64 {
- let mut hasher = Sha256::new();
- hasher.update(team_id.to_be_bytes());
- hasher.update(uuid.as_bytes());
- let digest = hasher.finalize();
- let bucket_bytes: [u8; 8] = digest[..8]
- .try_into()
- .expect("sha256 digest always contains at least 8 bytes");
- u64::from_be_bytes(bucket_bytes) as f64 / ((u64::MAX as f64) + 1.0)
-}
-
-fn uuid_for_sampling_decision(team_id: i32, sample_rate: f64, want_remote: bool) -> Uuid {
- for candidate in 1..10_000u128 {
- let uuid = Uuid::from_u128(candidate);
- if (sampling_bucket(team_id, uuid) < sample_rate) == want_remote {
- return uuid;
- }
- }
- panic!("failed to find deterministic sampling fixture");
-}
-
#[tokio::test]
async fn happy_path_preserves_batch_event_and_exception_order() {
let (addr, _) = spawn_stub_server(ServerBehavior::Happy).await;
@@ -221,65 +194,9 @@ async fn happy_path_preserves_batch_event_and_exception_order() {
}
#[tokio::test]
-async fn local_mode_ignores_remote_pool_when_remote_is_disabled() {
- let (_addr, hits) = spawn_stub_server(ServerBehavior::AlwaysInvalidArgument).await;
- let evt = build_event(3);
- let original_types: Vec<_> = evt
- .exception_list()
- .iter()
- .map(|e| e.exception_type.clone())
- .collect();
-
- let resolved = process_one(local_stage(), evt)
- .await
- .expect("no unhandled error");
-
- assert_eq!(resolved.exception_list().len(), 3);
- let resolved_types: Vec<_> = resolved
- .exception_list()
- .iter()
- .map(|e| e.exception_type.clone())
- .collect();
- assert_eq!(resolved_types, original_types);
- let mut expected_properties = original_types.clone();
- expected_properties.sort();
- let mut resolved_properties = resolved.metadata().types.clone();
- resolved_properties.sort();
- assert_eq!(resolved_properties, expected_properties);
- assert!(
- hits.lock().unwrap().is_empty(),
- "disabled remote mode must not call the remote pool"
- );
-}
-
-#[tokio::test]
-async fn sample_rate_zero_routes_eligible_events_locally_without_remote_calls() {
- let (addr, hits) = spawn_stub_server(ServerBehavior::Happy).await;
- let ctx = make_ctx_with_sample_rate(&[addr], 0, Duration::from_secs(5), 0.0).await;
- let evt = build_event(1);
-
- let resolved = process_one(remote_stage(ctx), evt)
- .await
- .expect("sampled-local event should resolve locally");
-
- assert!(
- hits.lock().unwrap().is_empty(),
- "sample_rate=0.0 must not call cymbal-resolution"
- );
- assert!(matches!(
- resolved
- .exception_list()
- .first()
- .and_then(|e| e.stack.as_ref()),
- Some(Stacktrace::Resolved { .. })
- ));
- assert_eq!(resolved.metadata().types, vec!["Boom0".to_string()]);
-}
-
-#[tokio::test]
-async fn sample_rate_one_routes_all_eligible_events_remotely() {
+async fn all_eligible_events_route_remotely() {
let (addr, hits) = spawn_stub_server(ServerBehavior::Happy).await;
- let ctx = make_ctx_with_sample_rate(&[addr], 0, Duration::from_secs(5), 1.0).await;
+ let ctx = make_ctx(&[addr], 0, Duration::from_secs(5)).await;
let evt_a = build_event(1);
let evt_b = build_event(2);
@@ -292,7 +209,7 @@ async fn sample_rate_one_routes_all_eligible_events_remotely() {
assert_eq!(
hits.lock().unwrap().len(),
3,
- "sample_rate=1.0 should submit one streamed item per exception"
+ "remote resolution should submit one streamed item per exception"
);
}
@@ -344,7 +261,7 @@ async fn distinct_symbol_sets_are_streamed_as_independent_items_under_team_routi
#[tokio::test]
async fn load_events_do_not_shrink_streamed_item_submission() {
let (addr, _streams, items) = spawn_recording_stub_server(ServerBehavior::Happy).await;
- let ctx = make_ctx_with_sample_rate(&[addr], 0, Duration::from_secs(5), 1.0).await;
+ let ctx = make_ctx(&[addr], 0, Duration::from_secs(5)).await;
let events: Vec<_> = (0..10)
.map(|i| {
Ok(build_event_with_symbol_refs(
@@ -369,7 +286,7 @@ async fn accepted_outcomes_release_routing_slots_before_terminal_completion() {
delay: Duration::from_millis(300),
})
.await;
- let ctx = make_ctx_with_sample_rate(&[addr], 0, Duration::from_secs(5), 1.0).await;
+ let ctx = make_ctx(&[addr], 0, Duration::from_secs(5)).await;
let events: Vec<_> = (0..11)
.map(|i| {
Ok(build_event_with_symbol_refs(
@@ -449,63 +366,9 @@ async fn per_item_overloaded_outcomes_reroute_independently() {
}
#[tokio::test]
-async fn mixed_sampled_remote_and_unsampled_local_events_preserve_output_ordering() {
- let (addr, hits) = spawn_stub_server(ServerBehavior::Happy).await;
- let sample_rate = 0.5;
- let remote_uuid = uuid_for_sampling_decision(7, sample_rate, true);
- let local_uuid = uuid_for_sampling_decision(7, sample_rate, false);
- let ctx = make_ctx_with_sample_rate(&[addr], 0, Duration::from_secs(5), sample_rate).await;
- let resolver = Arc::new(CountingResolver::default());
- let local_evt = build_dart_event(local_uuid);
- let remote_evt = build_event_with_symbol_refs(remote_uuid, &["remote-bundle"]);
-
- let result = remote_stage_with_resolver(ctx, resolver.clone())
- .process(Batch::from(vec![
- Ok(local_evt.clone()),
- Ok(remote_evt.clone()),
- ]))
- .await
- .expect("stage processed");
- let resolved: Vec<_> = result
- .into_iter()
- .map(|item| item.expect("event must not be EventError"))
- .collect();
-
- assert_eq!(resolved.len(), 2);
- assert_eq!(resolved[0].uuid(), local_uuid);
- assert_eq!(resolved[1].uuid(), remote_uuid);
- assert_eq!(hits.lock().unwrap().len(), 1);
- assert_eq!(resolver.dart_name_calls.load(Ordering::SeqCst), 1);
- assert_eq!(
- resolved[0].exception_list()[0].exception_type,
- "ResolvedDart"
- );
- assert_eq!(resolved[1].exception_list()[0].exception_type, "Boom0");
-}
-
-#[tokio::test]
-async fn partial_sample_rate_is_deterministic_for_same_event() {
- let (addr, hits) = spawn_stub_server(ServerBehavior::Happy).await;
- let ctx = make_ctx_with_sample_rate(&[addr], 0, Duration::from_secs(5), 0.5).await;
- let evt = build_event_with(1, 77, Uuid::from_u128(0x1234), Vec::new());
-
- for _ in 0..8 {
- let _resolved = process_one(remote_stage(ctx.clone()), evt.clone())
- .await
- .expect("stage processed");
- }
-
- let remote_calls = hits.lock().unwrap().len();
- assert!(
- remote_calls == 0 || remote_calls == 8,
- "same team_id + event UUID must make the same sampling decision across retries; got {remote_calls} remote calls"
- );
-}
-
-#[tokio::test]
-async fn sampled_remote_failure_does_not_fall_back_to_local_resolution() {
+async fn remote_failure_does_not_fall_back_to_local_resolution() {
let (addr, hits) = spawn_stub_server(ServerBehavior::AlwaysUnavailable).await;
- let ctx = make_ctx_with_sample_rate(&[addr], 0, Duration::from_secs(5), 1.0).await;
+ let ctx = make_ctx(&[addr], 0, Duration::from_secs(5)).await;
let resolver = Arc::new(CountingResolver::default());
let err = process_one(
@@ -513,7 +376,7 @@ async fn sampled_remote_failure_does_not_fall_back_to_local_resolution() {
build_dart_event(Uuid::from_u128(42)),
)
.await
- .expect_err("sampled remote failure must surface");
+ .expect_err("remote failure must surface");
assert!(format!("{err}").contains("exhausted"));
assert!(hits.lock().unwrap().is_empty());
@@ -521,30 +384,6 @@ async fn sampled_remote_failure_does_not_fall_back_to_local_resolution() {
assert_eq!(resolver.raw_frame_calls.load(Ordering::SeqCst), 0);
}
-#[tokio::test]
-async fn unsampled_events_run_local_exception_frame_and_properties_resolvers() {
- let (addr, hits) = spawn_stub_server(ServerBehavior::Happy).await;
- let ctx = make_ctx_with_sample_rate(&[addr], 0, Duration::from_secs(5), 0.0).await;
- let resolver = Arc::new(CountingResolver::default());
-
- let resolved = process_one(
- remote_stage_with_resolver(ctx, resolver.clone()),
- build_dart_event(Uuid::from_u128(42)),
- )
- .await
- .expect("unsampled event should resolve locally");
-
- assert!(hits.lock().unwrap().is_empty());
- assert_eq!(resolver.dart_name_calls.load(Ordering::SeqCst), 1);
- assert_eq!(resolver.raw_frame_calls.load(Ordering::SeqCst), 1);
- assert_eq!(resolved.exception_list()[0].exception_type, "ResolvedDart");
- assert!(matches!(
- resolved.exception_list()[0].stack.as_ref(),
- Some(Stacktrace::Resolved { .. })
- ));
- assert_eq!(resolved.metadata().types, vec!["ResolvedDart".to_string()]);
-}
-
#[tokio::test]
async fn transport_unavailable_retries_against_another_endpoint() {
// Use a single Unavailable endpoint so the very first attempt fails; the
diff --git a/rust/cymbal/tests/remote_resolution_parity.rs b/rust/cymbal/tests/remote_resolution_parity.rs
deleted file mode 100644
index 7281ce8f11d0..000000000000
--- a/rust/cymbal/tests/remote_resolution_parity.rs
+++ /dev/null
@@ -1,171 +0,0 @@
-//! Parity tests for Batch 4.
-//!
-//! These tests stand up an in-process `cymbal-resolution` service backed by a
-//! shared fake `SymbolResolver`, run the same exception through both the
-//! local `ResolutionStage` (`remote = None`) and the remote stage
-//! (`remote = Some(ctx)`), and assert the resulting `ExceptionList` is
-//! byte-for-byte identical after JSON round-tripping. Parity is the v1
-//! correctness guarantee: when remote mode is enabled, callers must observe
-//! the same resolved frames they would have seen locally.
-//!
-//! Fixtures live in `tests/common/mod.rs`. Add new resolution types here as
-//! they become supported by the remote service.
-
-mod common;
-
-use std::net::SocketAddr;
-use std::sync::atomic::AtomicBool;
-use std::sync::Arc;
-use std::time::Duration;
-
-use async_trait::async_trait;
-use common::{build_event, make_ctx};
-use cymbal::error::{ResolveError, UnhandledError};
-use cymbal::frames::{Frame, RawFrame};
-use cymbal::langs::native::DebugImage;
-use cymbal::modes::resolution::load_monitor::LoadMonitor;
-use cymbal::modes::resolution::service::{CymbalResolutionService, ServiceConfig};
-use cymbal::stages::resolution::ResolutionStage;
-use cymbal::symbolication::symbol::SymbolResolver;
-use cymbal::symbolication::symbol_store::chunk_id::OrChunkId;
-use cymbal::symbolication::symbol_store::proguard::ProguardRef;
-use cymbal::types::batch::Batch;
-use cymbal::types::exception_event::{ExceptionEvent, Parsed, Resolved};
-use cymbal::types::operator::TeamId;
-use cymbal::types::stage::Stage;
-use cymbal_proto::cymbal::resolution::v1::cymbal_resolution_server::CymbalResolutionServer;
-use tokio::sync::Semaphore;
-
-/// Fake symbol resolver shared by both sides of the parity comparison. Every
-/// resolution method is deterministic and produces the same output for the
-/// same input — the point is that any divergence in the resolved
-/// `ExceptionList` must come from plumbing differences, not from non-determinism.
-#[derive(Default)]
-struct FakeResolver;
-
-#[async_trait]
-impl SymbolResolver for FakeResolver {
- async fn resolve_raw_frame(
- &self,
- _team_id: TeamId,
- _frame: &RawFrame,
- _debug_images: &[DebugImage],
- ) -> Result<Vec<Frame>, UnhandledError> {
- Ok(Vec::new())
- }
-
- async fn resolve_java_class(
- &self,
- _team_id: TeamId,
- _symbolset_ref: OrChunkId<ProguardRef>,
- _class: String,
- ) -> Result<String, ResolveError> {
- unreachable!("parity fixtures do not exercise Java class resolution")
- }
-
- async fn resolve_dart_minified_name(
- &self,
- _team_id: TeamId,
- _symbolset_ref: String,
- _minified_name: &str,
- ) -> Result<String, ResolveError> {
- unreachable!("parity fixtures do not exercise Dart name resolution")
- }
-}
-
-async fn spawn_cymbal_resolution_with_resolver(resolver: Arc<dyn SymbolResolver>) -> SocketAddr {
- let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
- let addr = listener.local_addr().unwrap();
- drop(listener);
- let limiter = Arc::new(Semaphore::new(4));
- let service_config = ServiceConfig {
- default_tick_interval: Duration::from_millis(50),
- min_tick_interval: Duration::from_millis(10),
- max_tick_interval: Duration::from_secs(1),
- };
- let service = CymbalResolutionService::new(
- resolver,
- limiter,
- LoadMonitor::new(4),
- "parity-stub",
- service_config,
- Arc::new(AtomicBool::new(false)),
- );
-
- tokio::spawn(async move {
- let _outcome = tonic::transport::Server::builder()
- .add_service(CymbalResolutionServer::new(service))
- .serve(addr)
- .await;
- });
-
- for _ in 0..40 {
- if std::net::TcpStream::connect_timeout(&addr, Duration::from_millis(50)).is_ok() {
- return addr;
- }
- tokio::time::sleep(Duration::from_millis(25)).await;
- }
- panic!("cymbal-resolution server failed to come up at {addr}");
-}
-
-fn local_stage(resolver: Arc<dyn SymbolResolver>) -> ResolutionStage {
- ResolutionStage {
- symbol_resolver: resolver,
- symbol_resolution_limiter: Arc::new(Semaphore::new(4)),
- remote: None,
- }
-}
-
-fn remote_stage(
- resolver: Arc<dyn SymbolResolver>,
- remote: cymbal::stages::resolution::remote::resolver::RemoteResolutionContext,
-) -> ResolutionStage {
- ResolutionStage {
- // The symbol_resolver field is unused in remote mode, but
- // ResolutionStage requires one. Pass the same fake so any accidental
- // local fallback would still produce parity-matching output.
- symbol_resolver: resolver,
- symbol_resolution_limiter: Arc::new(Semaphore::new(4)),
- remote: Some(remote),
- }
-}
-
-async fn run_stage(
- stage: ResolutionStage,
- evt: ExceptionEvent<Parsed>,
-) -> ExceptionEvent<Resolved> {
- let batch: Batch<cymbal::stages::pipeline::ParsedPipelineItem> = Batch::from(vec![Ok(evt)]);
- let result = stage.process(batch).await.expect("stage processed");
- let mut items: Vec<_> = result.into_iter().collect();
- assert_eq!(items.len(), 1, "single-event batch must produce one output");
- items.remove(0).expect("event must not be EventError")
-}
-
-#[tokio::test]
-async fn local_and_remote_stages_produce_identical_exception_list_for_empty_stacks() {
- let resolver: Arc<dyn SymbolResolver> = Arc::new(FakeResolver);
- let addr = spawn_cymbal_resolution_with_resolver(resolver.clone()).await;
- let ctx = make_ctx(&[addr], 0, Duration::from_secs(5)).await;
-
- let evt = build_event(3);
- let local_out = run_stage(local_stage(resolver.clone()), evt.clone()).await;
- let remote_out = run_stage(remote_stage(resolver, ctx), evt).await;
-
- // Compare via JSON round-trip so the test stays robust against
- // Exception's #[serde(skip_serializing_if = "Option::is_none")] fields and
- // the difference in how `Stacktrace::Raw` vs `Stacktrace::Resolved`
- // serialize.
- let local_json = serde_json::to_value(local_out.exception_list()).unwrap();
- let remote_json = serde_json::to_value(remote_out.exception_list()).unwrap();
- assert_eq!(local_json, remote_json, "exception_list parity");
-
- // Derived properties should also match in both paths, since they're
- // computed from the parity-checked exception list.
- // `unique_by` preserves exception_list order, so compare directly.
- assert_eq!(local_out.metadata().types, remote_out.metadata().types);
- assert_eq!(
- local_out.metadata().messages,
- remote_out.metadata().messages
- );
- assert_eq!(local_out.metadata().handled, remote_out.metadata().handled);
-}
diff --git a/rust/cymbal/tests/remote_resolution_subscribe.rs b/rust/cymbal/tests/remote_resolution_subscribe.rs
index 27943e97180c..5d0ee7190537 100644
--- a/rust/cymbal/tests/remote_resolution_subscribe.rs
+++ b/rust/cymbal/tests/remote_resolution_subscribe.rs
@@ -119,7 +119,6 @@ fn pool_config(host: &str, tick_hint: Duration) -> RemoteResolutionConfig {
max_retries: 0,
retry_backoff: Duration::from_millis(1),
retry_max_backoff: Duration::from_millis(2),
- sample_rate: 1.0,
routing_jitter: 0.0,
routing_acceptance_concurrency: 10,
overload_ejection_initial: Duration::ZERO,
diff --git a/rust/cymbal/tests/utils.rs b/rust/cymbal/tests/utils.rs
index cbf3a008edfb..31b97f820521 100644
--- a/rust/cymbal/tests/utils.rs
+++ b/rust/cymbal/tests/utils.rs
@@ -1,13 +1,27 @@
-use std::sync::Arc;
+use std::{
+ sync::{atomic::AtomicBool, Arc},
+ time::Duration,
+};
use axum::{body::Body, http::Request};
use bytes::Bytes;
use common_redis::MockRedisClient;
use cymbal::{
- app_context::AppContext, error::UnhandledError, modes::processing::ProcessingConfig,
- router::get_router, symbolication::symbol_store::BlobClient,
+ app_context::AppContext,
+ core::resolver::build_catalog,
+ error::UnhandledError,
+ modes::{
+ processing::ProcessingConfig,
+ resolution::{
+ load_monitor::LoadMonitor,
+ service::{CymbalResolutionService, ServiceConfig},
+ },
+ },
+ router::get_router,
+ symbolication::{symbol::local::LocalSymbolResolver, symbol_store::BlobClient},
};
+use cymbal_proto::cymbal::resolution::v1::cymbal_resolution_server::CymbalResolutionServer;
use async_trait::async_trait;
use mockall::mock;
@@ -15,6 +29,8 @@ use rdkafka::message::ToBytes;
use reqwest::StatusCode;
use serde::Deserialize;
use sqlx::PgPool;
+use tokio::sync::Semaphore;
+use tonic::transport::Server;
use tower::ServiceExt;
mock! {
@@ -51,9 +67,11 @@ pub(crate) async fn get_response_with_config<T: for<'de> Deserialize<'de>>(
config.resolver.object_storage_bucket = storage_bucket.clone();
configure(&mut config);
+ ensure_remote_resolution(&mut config, s3_client, db.clone()).await;
+
let issue_buckets_redis_client = Arc::new(MockRedisClient::new());
- let app_ctx = AppContext::new(&config, s3_client, db.clone(), issue_buckets_redis_client)
+ let app_ctx = AppContext::new(&config, db.clone(), issue_buckets_redis_client)
.await
.unwrap();
@@ -75,6 +93,55 @@ pub(crate) async fn get_response_with_config<T: for<'de> Deserialize<'de>>(
(status, body)
}
+async fn ensure_remote_resolution(
+ config: &mut ProcessingConfig,
+ s3_client: Arc<MockS3Client>,
+ db: PgPool,
+) {
+ if config.remote_resolution_host.is_empty() {
+ let listener = tokio::net::TcpListener::bind("127.0.0.1:0")
+ .await
+ .expect("bind test resolution server");
+ let addr = listener.local_addr().expect("test resolution server addr");
+ let incoming = futures::stream::unfold(listener, |listener| async {
+ Some((listener.accept().await.map(|(stream, _)| stream), listener))
+ });
+ s3_client
+ .ping_bucket(&config.resolver.object_storage_bucket)
+ .await
+ .expect("test symbol store is available");
+ let catalog = build_catalog(&config.resolver, s3_client, db.clone());
+ let resolver = Arc::new(LocalSymbolResolver::new(
+ &config.resolver,
+ catalog,
+ db.clone(),
+ ));
+ let service = CymbalResolutionService::new(
+ resolver,
+ Arc::new(Semaphore::new(4)),
+ LoadMonitor::new(64),
+ "test-instance",
+ ServiceConfig {
+ default_tick_interval: Duration::from_millis(25),
+ min_tick_interval: Duration::from_millis(10),
+ max_tick_interval: Duration::from_millis(100),
+ },
+ Arc::new(AtomicBool::new(false)),
+ );
+ tokio::spawn(async move {
+ Server::builder()
+ .add_service(CymbalResolutionServer::new(service))
+ .serve_with_incoming(incoming)
+ .await
+ .expect("test resolution server exits cleanly");
+ });
+ config.remote_resolution_host = "127.0.0.1".to_string();
+ config.remote_resolution_port = addr.port();
+ config.resolver.internal_api_secret = "test-secret".to_string();
+ config.remote_resolution_subscribe_tick_hint_ms = 25;
+ }
+}
+
#[allow(dead_code)]
pub(crate) async fn get_raw_response(
db: PgPool,
@@ -85,9 +152,11 @@ pub(crate) async fn get_raw_response(
let mut config = ProcessingConfig::init_with_defaults().unwrap();
config.resolver.object_storage_bucket = storage_bucket.clone();
+ ensure_remote_resolution(&mut config, s3_client, db.clone()).await;
+
let issue_buckets_redis_client = Arc::new(MockRedisClient::new());
- let app_ctx = AppContext::new(&config, s3_client, db.clone(), issue_buckets_redis_client)
+ let app_ctx = AppContext::new(&config, db.clone(), issue_buckets_redis_client)
.await
.unwrap();