: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
refactor(cymbal): carve core/ kernel and modes/ layout (#64882)
Hugues Pouillot6d6b927330d9
diff --git a/rust/cymbal/src/posthog_utils.rs b/rust/cymbal/src/core/analytics.rssimilarity index 62%rename from rust/cymbal/src/posthog_utils.rsrename to rust/cymbal/src/core/analytics.rsindex fa8539e79681..ed382421b4b6 100644--- a/rust/cymbal/src/posthog_utils.rs+++ b/rust/cymbal/src/core/analytics.rs@@ -1,29 +1,12 @@+//! PostHog analytics capture for the shared symbolication kernel (symbol-set+//! lifecycle). Issue-lifecycle captures live in `crate::modes::processing::analytics`.+use posthog_rs::Event;use tracing::error;-use uuid::Uuid;-const ISSUE_CREATED: &str = "error_tracking_issue_created";-const ISSUE_REOPENED: &str = "error_tracking_issue_reopened";const SYMBOL_SET_SAVED: &str = "error_tracking_symbol_set_saved";const SYMBOL_SET_DELETED: &str = "error_tracking_symbol_set_deleted";-pub fn capture_issue_created(team_id: i32, issue_id: Uuid, sentry_integration: bool) {- let mut event = Event::new_anon(ISSUE_CREATED);- event.insert_prop("team_id", team_id).unwrap();- event.insert_prop("issue_id", issue_id.to_string()).unwrap();- event- .insert_prop("sentry_integration", sentry_integration)- .unwrap();- spawning_capture(ISSUE_CREATED, event);-}--pub fn capture_issue_reopened(team_id: i32, issue_id: Uuid) {- let mut event = Event::new_anon(ISSUE_REOPENED);- event.insert_prop("team_id", team_id).unwrap();- event.insert_prop("issue_id", issue_id.to_string()).unwrap();- spawning_capture(ISSUE_REOPENED, event);-}-pub fn capture_symbol_set_saved(team_id: i32, set_ref: &str, storage_ptr: &str, was_retry: bool) {let mut event = Event::new_anon(SYMBOL_SET_SAVED);event.insert_prop("team_id", team_id).unwrap();diff --git a/rust/cymbal/src/core/config.rs b/rust/cymbal/src/core/config.rsnew file mode 100644index 000000000000..9f4b2f6dfc99--- /dev/null+++ b/rust/cymbal/src/core/config.rs@@ -0,0 +1,114 @@+use aws_config::{BehaviorVersion, Region};+use envconfig::Envconfig;+use tracing::{info, warn};++/// Configuration for the shared symbol-resolution stack. Both run modes parse+/// this slice; processing mode nests it on [`crate::modes::processing::ProcessingConfig`], and+/// resolution mode reads it alongside its own service config. Keeping it in+/// `core` means the resolver (and a future `cymbal-core` crate) never needs the+/// processing-only knobs (Kafka, Redis, rules, remote-resolution client).+#[derive(Envconfig, Clone)]+pub struct ResolverConfig {+ #[envconfig(default = "postgres://posthog:posthog@localhost:5432/posthog")]+ pub database_url: String,++ // Rust services connect directly to postgres, not via pgbouncer, so we keep this low+ #[envconfig(default = "4")]+ pub max_pg_connections: u32,++ // cymbal makes HTTP get requests to auto-resolve sourcemaps - and follows redirects. To protect against SSRF, we only allow requests to public URLs by default+ #[envconfig(default = "false")]+ pub allow_internal_ips: bool,++ #[envconfig(default = "30")]+ pub sourcemap_timeout_seconds: u64,++ #[envconfig(default = "5")]+ pub sourcemap_connect_timeout_seconds: u64,++ #[envconfig(default = "100000000")] // 100MB - in prod, we should use closer to 1-10GB+ pub symbol_store_cache_max_bytes: usize,++ #[envconfig(default = "http://127.0.0.1:19000")] // minio+ pub object_storage_endpoint: String,++ #[envconfig(default = "symbol_sets")]+ pub object_storage_bucket: String,++ #[envconfig(default = "us-east-1")]+ pub object_storage_region: String,++ #[envconfig(default = "object_storage_root_user")]+ pub object_storage_access_key_id: String,++ #[envconfig(default = "object_storage_root_password")]+ pub object_storage_secret_access_key: String,++ #[envconfig(default = "false")] // Enable for MinIO compatibility+ pub object_storage_force_path_style: bool,++ #[envconfig(default = "symbolsets")]+ pub ss_prefix: String,++ #[envconfig(default = "100000")]+ pub frame_cache_size: u64,++ // Used by cymbal and cymbal-resolution through the shared symbol resolver config.+ // Resolved frame results are relatively stable, while unresolved results can become+ // resolvable after a user uploads missing symbols, so keep them shorter.+ #[envconfig(default = "1800")]+ pub frame_resolved_ttl_seconds: u64,++ #[envconfig(default = "300")]+ pub frame_unresolved_ttl_seconds: u64,++ // Maximum number of lines of pre and post context to get per frame+ #[envconfig(default = "15")]+ pub context_line_count: usize,++ // Global maximum number of concurrent symbol resolution operations.+ // This limiter is shared across frame and exception symbol resolution paths.+ #[envconfig(default = "64")]+ pub symbol_resolution_concurrency: usize,++ // Shared secret authenticating the cymbal <-> cymbal-resolution gRPC seam.+ #[envconfig(default = "")]+ pub internal_api_secret: String,+}++impl ResolverConfig {+ pub fn init_with_defaults() -> Result<Self, envconfig::Error> {+ Self::init_from_env()+ }+}++pub async fn get_aws_config(config: &ResolverConfig) -> aws_sdk_s3::Config {+ // If we have a role ARN and token file, which are added to the container due to the SA annotation we use in prod+ if std::env::var("AWS_ROLE_ARN").is_ok() && std::env::var("AWS_WEB_IDENTITY_TOKEN_FILE").is_ok()+ {+ info!("AWS role and token file detected, config loaded from environment variables");+ // Use default aws config loading behaviour, which should pick up the role-based credentials. We+ // assume region and endpoint will be properly set due to SA annotation. Behaviour version will+ // be latest due to config crate feature flag+ aws_sdk_s3::config::Builder::from(&aws_config::load_from_env().await)+ .force_path_style(config.object_storage_force_path_style)+ .build()+ } else {+ warn!("Falling back to building config from explicit environment variables");+ // Fall back to building our config from the explicit environment variables we use in local dev+ let env_credentials = aws_sdk_s3::config::Credentials::new(+ &config.object_storage_access_key_id,+ &config.object_storage_secret_access_key,+ None,+ None,+ "environment",+ );+ aws_sdk_s3::config::Builder::new()+ .region(Region::new(config.object_storage_region.clone()))+ .endpoint_url(&config.object_storage_endpoint)+ .credentials_provider(env_credentials)+ .behavior_version(BehaviorVersion::latest())+ .force_path_style(config.object_storage_force_path_style)+ .build()+ }+}diff --git a/rust/cymbal/src/error.rs b/rust/cymbal/src/core/error.rssimilarity index 100%rename from rust/cymbal/src/error.rsrename to rust/cymbal/src/core/error.rsdiff --git a/rust/cymbal/src/core/ids.rs b/rust/cymbal/src/core/ids.rsnew file mode 100644index 000000000000..62380f6fc6f5--- /dev/null+++ b/rust/cymbal/src/core/ids.rs@@ -0,0 +1,2 @@+/// Tenant identifier threaded through symbol resolution and the pipeline.+pub type TeamId = i32;diff --git a/rust/cymbal/src/metric_consts.rs b/rust/cymbal/src/core/metric_consts.rssimilarity index 100%rename from rust/cymbal/src/metric_consts.rsrename to rust/cymbal/src/core/metric_consts.rsdiff --git a/rust/cymbal/src/core/mod.rs b/rust/cymbal/src/core/mod.rsnew file mode 100644index 000000000000..1ab0b7c9d6af--- /dev/null+++ b/rust/cymbal/src/core/mod.rs@@ -0,0 +1,14 @@+//! Shared symbolication kernel: the symbol-resolution stack and the domain+//! pieces both run modes depend on (see `crate::modes`). Nothing here may+//! depend on processing-only modules (the pipeline, Kafka/Redis, rules), so+//! this subtree can later be lifted into its own `cymbal-core` crate.++pub mod analytics;+pub mod config;+pub mod error;+pub mod ids;+pub mod metric_consts;+pub mod resolver;+pub mod sanitize;+pub mod symbolication;+pub mod types;diff --git a/rust/cymbal/src/core/resolver.rs b/rust/cymbal/src/core/resolver.rsnew file mode 100644index 000000000000..ce9905a31d75--- /dev/null+++ b/rust/cymbal/src/core/resolver.rs@@ -0,0 +1,117 @@+use std::sync::Arc;++use sqlx::{postgres::PgPoolOptions, PgPool};+use tokio::sync::Mutex;++use crate::core::config::{get_aws_config, ResolverConfig};+use crate::core::error::UnhandledError;+use crate::core::symbolication::symbol::{local::LocalSymbolResolver, SymbolResolver};+use crate::core::symbolication::symbol_store::{+ apple::AppleProvider,+ caching::{Caching, SymbolSetCache},+ chunk_id::ChunkIdFetcher,+ concurrency,+ hermesmap::HermesMapProvider,+ proguard::ProguardProvider,+ saving::Saving,+ sourcemap::SourcemapProvider,+ BlobClient, Catalog, S3Client,+};++/// Build just the symbol-resolution stack from config: connects to Postgres,+/// builds the S3 client, and returns a fully-wired+/// `SymbolResolver`. **Does not** start Kafka producers, Redis clients,+/// signals, the issue cache, or the remote-resolution pool — those belong to+/// the processing pipeline (`crate::app_context::AppContext`).+///+/// Used by resolution mode (`crate::modes::resolution`), which only needs+/// symbol resolution; keeping this in `core` stops resolution-mode pods from+/// depending on the processing app context.+pub async fn build_symbol_resolver(+ config: &ResolverConfig,+) -> Result<Arc<dyn SymbolResolver>, UnhandledError> {+ let options = PgPoolOptions::new().max_connections(config.max_pg_connections);+ let posthog_pool = options.connect(&config.database_url).await?;+ let s3 = aws_sdk_s3::Client::from_conf(get_aws_config(config).await);+ let s3_client: Arc<dyn BlobClient> = Arc::new(S3Client::new(s3));+ s3_client.ping_bucket(&config.object_storage_bucket).await?;+ let catalog = build_catalog(config, s3_client, posthog_pool.clone());+ Ok(Arc::new(LocalSymbolResolver::new(+ config,+ catalog,+ posthog_pool,+ )))+}++/// 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.+pub fn build_catalog(+ config: &ResolverConfig,+ s3_client: Arc<dyn BlobClient>,+ posthog_pool: PgPool,+) -> Arc<Catalog> {+ let ss_cache = Arc::new(Mutex::new(SymbolSetCache::new(+ config.symbol_store_cache_max_bytes,+ )));++ let smp = SourcemapProvider::new(config).with_chunk_id_rescue(+ posthog_pool.clone(),+ s3_client.clone(),+ config.object_storage_bucket.clone(),+ );+ let smp_chunk = ChunkIdFetcher::new(+ smp,+ s3_client.clone(),+ posthog_pool.clone(),+ config.object_storage_bucket.clone(),+ );+ let smp_saving = Saving::new(+ smp_chunk,+ posthog_pool.clone(),+ s3_client.clone(),+ config.object_storage_bucket.clone(),+ config.ss_prefix.clone(),+ );+ let smp_caching = Caching::new(smp_saving, ss_cache.clone());+ // We want to fetch each sourcemap from the outside world exactly once,+ // and if it isn't in the cache, load/parse it from s3 exactly once too.+ // Limiting the per symbol set reference concurrency to 1 ensures this.+ let smp_atmostonce = concurrency::AtMostOne::new(smp_caching);++ let hmp_chunk = ChunkIdFetcher::new(+ HermesMapProvider {},+ s3_client.clone(),+ posthog_pool.clone(),+ config.object_storage_bucket.clone(),+ );+ // Skip the saving layer for HermesMapProvider, since it'll never fetch+ // something from the outside world.+ let hmp_caching = Caching::new(hmp_chunk, ss_cache.clone());+ let hmp_atmostonce = concurrency::AtMostOne::new(hmp_caching);++ let pgp_chunk = ChunkIdFetcher::new(+ ProguardProvider {},+ s3_client.clone(),+ posthog_pool.clone(),+ config.object_storage_bucket.clone(),+ );+ let pgp_caching = Caching::new(pgp_chunk, ss_cache.clone());+ let pgp_atmostonce = concurrency::AtMostOne::new(pgp_caching);++ let apple_chunk = ChunkIdFetcher::new(+ AppleProvider {},+ s3_client.clone(),+ posthog_pool.clone(),+ config.object_storage_bucket.clone(),+ );+ let apple_caching = Caching::new(apple_chunk, ss_cache);+ let apple_atmostonce = concurrency::AtMostOne::new(apple_caching);++ Arc::new(Catalog::new(+ smp_atmostonce,+ hmp_atmostonce,+ pgp_atmostonce,+ apple_atmostonce,+ ))+}diff --git a/rust/cymbal/src/core/sanitize.rs b/rust/cymbal/src/core/sanitize.rsnew file mode 100644index 000000000000..e00bbab34b40--- /dev/null+++ b/rust/cymbal/src/core/sanitize.rs@@ -0,0 +1,114 @@+use std::sync::LazyLock;++use regex::Regex;+use serde_json::Value;+use tracing::debug;+use uuid::Uuid;++use crate::core::error::EventError;++pub fn recursively_sanitize_properties(+ id: Uuid,+ value: &mut Value,+ depth: usize,+) -> Result<(), EventError> {+ if depth > 64 {+ // We don't want to recurse too deeply, in case we have a circular reference or something.+ return Err(EventError::InvalidProperties(+ id,+ "Recursion limit exceeded".to_string(),+ ));+ }+ match value {+ Value::Object(map) => {+ for (_, v) in map.iter_mut() {+ recursively_sanitize_properties(id, v, depth + 1)?;+ }+ }+ Value::Array(arr) => {+ for v in arr.iter_mut() {+ recursively_sanitize_properties(id, v, depth + 1)?;+ }+ }+ Value::String(s) => {+ if needs_sanitization(s) {+ debug!("sanitizing null bytes from string in event {}", id);+ *s = sanitize_string(s.clone());+ }+ }+ _ => {}+ }+ Ok(())+}++static WHITESPACE_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\s{50,}").unwrap());++// Postgres doesn't like nulls (u0000) in strings, so we replace them with uFFFD. We also replace all 50-or-more whitespace sequences with "<ws trimmed>".+pub fn sanitize_string(s: String) -> String {+ let no_nulls = s.replace('\u{0000}', "\u{FFFD}");+ WHITESPACE_REGEX+ .replace_all(&no_nulls, "<ws trimmed>")+ .to_string()+}++/// Sanitize a source code line: replace only null bytes, leave all whitespace intact.+/// Source context lines have meaningful indentation that must be preserved.+pub fn sanitize_source_line(s: String) -> String {+ s.replace('\u{0000}', "\u{FFFD}")+}++pub fn needs_sanitization(s: &str) -> bool {+ s.contains('\u{0000}') || s.len() > 512+}++#[cfg(test)]+mod test {+ use super::*;++ #[test]+ fn test_sanitize_string_null_bytes() {+ let input = "hello\u{0000}world".to_string();+ let result = sanitize_string(input);+ assert_eq!(result, "hello\u{FFFD}world");+ }++ #[test]+ fn test_sanitize_string_long_whitespace() {+ let mut input = "hello".to_string();+ input.push_str(&"\n".repeat(60));+ input.push_str("world");+ let result = sanitize_string(input);+ assert_eq!(result, "hello<ws trimmed>world");+ }++ #[test]+ fn test_sanitize_string_short_whitespace() {+ let input = "hello world".to_string();+ let result = sanitize_string(input);+ assert_eq!(result, "hello world");+ }++ #[test]+ fn test_sanitize_source_line_preserves_indentation() {+ // 65 leading spaces (e.g. Obj-C multi-line method call) must be preserved.+ let input = format!("{:>65}reason:@\"value\"", "");+ let result = sanitize_source_line(input.clone());+ assert_eq!(result, input);+ }++ #[test]+ fn test_sanitize_source_line_strips_nulls() {+ let input = "hello\u{0000}world".to_string();+ let result = sanitize_source_line(input);+ assert_eq!(result, "hello\u{FFFD}world");+ }++ #[test]+ fn test_sanitize_string_both_issues() {+ let mut input = "hello\u{0000}".to_string();+ input.push_str(&"\n".repeat(60));+ input.push_str("world");+ let result = sanitize_string(input);+ assert_eq!(result, "hello\u{FFFD}<ws trimmed>world");+ }+}diff --git a/rust/cymbal/src/symbolication/mod.rs b/rust/cymbal/src/core/symbolication/mod.rssimilarity index 96%rename from rust/cymbal/src/symbolication/mod.rsrename to rust/cymbal/src/core/symbolication/mod.rsindex 71686cab48fd..f76e5c906b98 100644--- a/rust/cymbal/src/symbolication/mod.rs+++ b/rust/cymbal/src/core/symbolication/mod.rs@@ -5,5 +5,6 @@//! - [`symbol`] — the [`symbol::SymbolResolver`] trait and the local resolver.//! - [`symbol_store`] — symbol-set providers, caching, and the [`symbolication::symbol_store::Catalog`].+pub mod resolve;pub mod symbol;pub mod symbol_store;diff --git a/rust/cymbal/src/core/symbolication/resolve.rs b/rust/cymbal/src/core/symbolication/resolve.rsnew file mode 100644index 000000000000..e31493e0ebf9--- /dev/null+++ b/rust/cymbal/src/core/symbolication/resolve.rs@@ -0,0 +1,220 @@+use reqwest::Url;++use crate::core::metric_consts::{FRAME_RESOLVED, LEGACY_JS_FRAME_RESOLVED, PER_FRAME_TIME};+use crate::core::symbolication::symbol_store::apple::AppleRef;+use crate::core::symbolication::symbol_store::chunk_id::OrChunkId;+use crate::core::symbolication::symbol_store::hermesmap::ParsedHermesMap;+use crate::core::symbolication::symbol_store::native::ParsedNativeSymbols;+use crate::core::symbolication::symbol_store::proguard::{FetchedMapping, ProguardRef};+use crate::core::symbolication::symbol_store::sourcemap::OwnedSourceMapCache;+use crate::core::symbolication::symbol_store::Catalog;+use crate::core::symbolication::symbol_store::SymbolCatalog;+use crate::core::types::frames::{Frame, RawFrame};+use crate::core::types::langs::apple::RawAppleFrame;+use crate::core::types::langs::hermes::{HermesRef, RawHermesFrame};+use crate::core::types::langs::java::RawJavaFrame;+use crate::core::types::langs::js::RawJSFrame;+use crate::core::types::langs::native::DebugImage;+use crate::core::types::langs::node::RawNodeFrame;+use crate::error::UnhandledError;++/// Resolution capability for raw stack frames.+///+/// Implemented by the catalog-backed raw frame types (`RawJSFrame`,+/// `RawNodeFrame`, `RawHermesFrame`, `RawJavaFrame`, `RawAppleFrame`) and by the+/// `RawFrame` dispatcher (see `crate::core::types::frames`). Catalog-free frames+/// (python, ruby, go, …) carry no symbol-resolution behavior — they convert+/// directly via `From<&RawX> for Frame`.+///+/// `C` is the symbol-catalog capability the implementor needs, e.g.+/// `SymbolCatalog<OrChunkId<Url>, OwnedSourceMapCache>` for JavaScript. The+/// concrete `Catalog` implements every such capability, so `RawFrame`+/// dispatches with `C = Catalog`.+#[allow(async_fn_in_trait)] // only used in-crate; mirrors the inherent async resolvers+pub trait Resolve<C> {+ async fn resolve(+ &self,+ team_id: i32,+ catalog: &C,+ debug_images: &[DebugImage],+ context_lines: usize,+ ) -> Result<Vec<Frame>, UnhandledError>;+}++impl<C> Resolve<C> for RawJSFrame+where+ C: SymbolCatalog<OrChunkId<Url>, OwnedSourceMapCache>,+{+ async fn resolve(+ &self,+ team_id: i32,+ catalog: &C,+ _debug_images: &[DebugImage],+ context_lines: usize,+ ) -> Result<Vec<Frame>, UnhandledError> {+ self.resolve_frame(team_id, catalog, context_lines)+ .await+ .map(|f| vec![f])+ }+}++impl<C> Resolve<C> for RawNodeFrame+where+ C: SymbolCatalog<OrChunkId<Url>, OwnedSourceMapCache>,+{+ async fn resolve(+ &self,+ team_id: i32,+ catalog: &C,+ _debug_images: &[DebugImage],+ context_lines: usize,+ ) -> Result<Vec<Frame>, UnhandledError> {+ self.resolve_frame(team_id, catalog, context_lines)+ .await+ .map(|f| vec![f])+ }+}++impl<C> Resolve<C> for RawHermesFrame+where+ C: SymbolCatalog<OrChunkId<HermesRef>, ParsedHermesMap>,+{+ async fn resolve(+ &self,+ team_id: i32,+ catalog: &C,+ _debug_images: &[DebugImage],+ context_lines: usize,+ ) -> Result<Vec<Frame>, UnhandledError> {+ self.resolve_frame(team_id, catalog, context_lines)+ .await+ .map(|f| vec![f])+ }+}++impl<C> Resolve<C> for RawJavaFrame+where+ C: SymbolCatalog<OrChunkId<ProguardRef>, FetchedMapping>,+{+ async fn resolve(+ &self,+ team_id: i32,+ catalog: &C,+ _debug_images: &[DebugImage],+ _context_lines: usize, // Java frames have no source context to bound+ ) -> Result<Vec<Frame>, UnhandledError> {+ self.resolve_frame(team_id, catalog).await+ }+}++impl<C> Resolve<C> for RawAppleFrame+where+ C: SymbolCatalog<OrChunkId<AppleRef>, ParsedNativeSymbols>,+{+ async fn resolve(+ &self,+ team_id: i32,+ catalog: &C,+ debug_images: &[DebugImage],+ context_lines: usize,+ ) -> Result<Vec<Frame>, UnhandledError> {+ self.resolve_frame(team_id, catalog, debug_images, context_lines)+ .await+ }+}++impl Resolve<Catalog> for RawFrame {+ async fn resolve(+ &self,+ team_id: i32,+ catalog: &Catalog,+ debug_images: &[DebugImage],+ context_lines: usize,+ ) -> Result<Vec<Frame>, UnhandledError> {+ let frame_resolve_time = common_metrics::timing_guard(PER_FRAME_TIME, &[]);+ // Catalog-backed frames resolve via `Resolve`; catalog-free frames convert+ // directly with `From<&RawX> for Frame` (no symbol resolution needed).+ let (res, lang_tag): (Result<Vec<Frame>, UnhandledError>, &str) = match self {+ RawFrame::JavaScriptWeb(frame) => (+ frame+ .resolve(team_id, catalog, debug_images, context_lines)+ .await,+ "javascript",+ ),+ RawFrame::LegacyJS(frame) => {+ // TODO: monitor this metric and remove the legacy frame type when it hits 0+ metrics::counter!(LEGACY_JS_FRAME_RESOLVED).increment(1);+ (+ frame+ .resolve(team_id, catalog, debug_images, context_lines)+ .await,+ "javascript",+ )+ }+ RawFrame::JavaScriptNode(frame) => (+ frame+ .resolve(team_id, catalog, debug_images, context_lines)+ .await,+ "javascript",+ ),++ RawFrame::Dart(frame) => (Ok(vec![frame.into()]), "dart"),+ RawFrame::Apple(frame) => (+ frame+ .resolve(team_id, catalog, debug_images, context_lines)+ .await,+ "apple",+ ),+ RawFrame::Php(frame) => (Ok(vec![frame.into()]), "php"),+ RawFrame::Python(frame) => (Ok(vec![frame.into()]), "python"),+ RawFrame::Ruby(frame) => (Ok(vec![frame.into()]), "ruby"),+ RawFrame::Rust(frame) => (Ok(vec![frame.into()]), "rust"),+ RawFrame::Custom(frame) => (Ok(vec![frame.into()]), "custom"),+ RawFrame::Go(frame) => (Ok(vec![frame.into()]), "go"),+ RawFrame::Hermes(frame) => (+ frame+ .resolve(team_id, catalog, debug_images, context_lines)+ .await,+ "hermes",+ ),+ RawFrame::Java(frame) => (+ frame+ .resolve(team_id, catalog, debug_images, context_lines)+ .await,+ "java",+ ),+ };++ // The raw id of the frame is set after it's resolved.+ let res = res.map(|mut fs| {+ fs.iter_mut()+ .enumerate()+ .for_each(|(index, f)| f.frame_id = self.frame_id(team_id, index, debug_images));+ fs+ });++ if res.is_err() {+ frame_resolve_time.label("outcome", "failed")+ } else {+ frame_resolve_time.label("outcome", "success")+ }+ .label("lang", lang_tag)+ .fin();++ if let Ok(frames) = &res {+ for frame in frames {+ if frame.resolved {+ metrics::counter!(FRAME_RESOLVED, "lang" => lang_tag).increment(1);+ }+ // Failure metrics are emitted by the language-specific `From` impls in+ // `langs/*.rs` at the moment of frame construction, where the typed error+ // is in scope (so we can call `metric_reason()` directly). This avoids+ // having to carry the typed error on the `Frame` struct just to recover+ // the metric label, which previously required a custom serializer plus+ // `skip_deserializing` and silently dropped failure reasons on PG round-trip.+ }+ }++ res+ }+}diff --git a/rust/cymbal/src/symbolication/symbol/local.rs b/rust/cymbal/src/core/symbolication/symbol/local.rssimilarity index 91%rename from rust/cymbal/src/symbolication/symbol/local.rsrename to rust/cymbal/src/core/symbolication/symbol/local.rsindex 3e307fb6473c..dba5cf78ac08 100644--- a/rust/cymbal/src/symbolication/symbol/local.rs+++ b/rust/cymbal/src/core/symbolication/symbol/local.rs@@ -14,18 +14,16 @@ use moka::{use sqlx::PgPool;use crate::{- config::Config,+ core::config::ResolverConfig,error::{JsResolveErr, ProguardError, ResolveError, UnhandledError},- frames::{- records::{ErrorTrackingStackFrame, FrameResultTtlPolicy},- releases::ReleaseRecord,- Frame, RawFrame,- },+ frames::{releases::ReleaseRecord, Frame, RawFrame},langs::native::DebugImage,metric_consts::{FRAME_CACHE_HITS, FRAME_CACHE_MISSES, FRAME_DB_HITS, FRAME_DB_MISSES,SUSPICIOUS_FRAMES_DETECTED,},+ symbolication::resolve::Resolve,+ symbolication::symbol::records::{ErrorTrackingStackFrame, FrameResultTtlPolicy},symbolication::symbol::SymbolResolver,symbolication::symbol_store::{chunk_id::OrChunkId,@@ -45,6 +43,8 @@ pub struct LocalSymbolResolver {cache: Cache<RawFrameId, Vec<ErrorTrackingStackFrame>>,pool: PgPool,ttl_policy: FrameResultTtlPolicy,+ // Lines of pre/post source context to attach per resolved frame.+ context_lines: usize,}impl Expiry<RawFrameId, Vec<ErrorTrackingStackFrame>> for FrameResultTtlPolicy {@@ -83,7 +83,7 @@ fn expiration_duration(}impl LocalSymbolResolver {- pub fn new(config: &Config, catalog: Arc<Catalog>, pool: PgPool) -> Self {+ pub fn new(config: &ResolverConfig, catalog: Arc<Catalog>, pool: PgPool) -> Self {let ttl_policy = FrameResultTtlPolicy::new(chrono::Duration::seconds(config.frame_resolved_ttl_seconds as i64),chrono::Duration::seconds(config.frame_unresolved_ttl_seconds as i64),@@ -97,6 +97,7 @@ impl LocalSymbolResolver {pool,cache,ttl_policy,+ context_lines: config.context_line_count,}}@@ -145,7 +146,12 @@ impl LocalSymbolResolver {metrics::counter!(FRAME_DB_MISSES).increment(1);let resolved = frame- .resolve(raw_id.team_id, &self.catalog, debug_images)+ .resolve(+ raw_id.team_id,+ &self.catalog,+ debug_images,+ self.context_lines,+ ).await?;assert!(!resolved.is_empty()); // If this ever happens, we've got a data-dropping bug, and want to crash@@ -251,8 +257,10 @@ mod test {use symbolic::sourcemapcache::SourceMapCacheWriter;use crate::{- config::Config,- frames::{records::ErrorTrackingStackFrame, RawFrame},+ core::config::ResolverConfig,+ core::types::Stacktrace,+ frames::RawFrame,+ symbolication::symbol::records::ErrorTrackingStackFrame,symbolication::symbol::{local::LocalSymbolResolver, SymbolResolver},symbolication::symbol_store::{apple::AppleProvider,@@ -263,20 +271,23 @@ mod test {sourcemap::SourcemapProvider,Catalog, MockS3Client,},- types::{RawErrProps, Stacktrace},+ types::RawErrProps,};const CHUNK_PATH: &str = "/static/chunk-PGUQKT6S.js";- const MINIFIED: &[u8] = include_bytes!("../../../tests/static/chunk-PGUQKT6S.js");- const MAP: &[u8] = include_bytes!("../../../tests/static/chunk-PGUQKT6S.js.map");+ const MINIFIED: &[u8] = include_bytes!("../../../../tests/static/chunk-PGUQKT6S.js");+ const MAP: &[u8] = include_bytes!("../../../../tests/static/chunk-PGUQKT6S.js.map");const EXAMPLE_EXCEPTION: &str =- include_str!("../../../tests/static/raw_ch_exception_list.json");+ include_str!("../../../../tests/static/raw_ch_exception_list.json");- async fn setup_test_context<S>(pool: PgPool, s3_init: S) -> (Config, Catalog, MockServer)+ async fn setup_test_context<S>(+ pool: PgPool,+ s3_init: S,+ ) -> (ResolverConfig, Catalog, MockServer)where- S: FnOnce(&Config, MockS3Client) -> MockS3Client,+ S: FnOnce(&ResolverConfig, MockS3Client) -> MockS3Client,{- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.object_storage_bucket = "test-bucket".to_string();config.ss_prefix = "test-prefix".to_string();config.allow_internal_ips = true; // Gonna be hitting the sourcemap mocks@@ -385,7 +396,7 @@ mod test {}fn expect_puts_and_gets(- config: &Config,+ config: &ResolverConfig,mut client: MockS3Client,puts: usize,gets: usize,diff --git a/rust/cymbal/src/symbolication/symbol/mod.rs b/rust/cymbal/src/core/symbolication/symbol/mod.rssimilarity index 98%rename from rust/cymbal/src/symbolication/symbol/mod.rsrename to rust/cymbal/src/core/symbolication/symbol/mod.rsindex d01519ef171b..dce35aab88ba 100644--- a/rust/cymbal/src/symbolication/symbol/mod.rs+++ b/rust/cymbal/src/core/symbolication/symbol/mod.rs@@ -1,15 +1,17 @@use async_trait::async_trait;use crate::{+ core::ids::TeamId,+ core::types::Exception,error::{ProguardError, ResolveError, UnhandledError},frames::{Frame, RawFrame},langs::native::DebugImage,metric_consts::JAVA_EXCEPTION_REMAP_FAILED,symbolication::symbol_store::{chunk_id::OrChunkId, proguard::ProguardRef},- types::{operator::TeamId, Exception},};use tracing::warn;pub mod local;+pub mod records;#[async_trait]pub trait SymbolResolver: Send + Sync + 'static {diff --git a/rust/cymbal/src/frames/records.rs b/rust/cymbal/src/core/symbolication/symbol/records.rssimilarity index 97%rename from rust/cymbal/src/frames/records.rsrename to rust/cymbal/src/core/symbolication/symbol/records.rsindex 39f2dafdbd64..7e1c5937aeba 100644--- a/rust/cymbal/src/frames/records.rs+++ b/rust/cymbal/src/core/symbolication/symbol/records.rs@@ -1,16 +1,12 @@use chrono::{DateTime, Duration, Utc};-use common_types::error_tracking::RawFrameId;+use common_types::error_tracking::{FrameId, RawFrameId};use serde::{Deserialize, Serialize};use serde_json::Value;use sqlx::Executor;use uuid::Uuid;-use crate::{- error::UnhandledError,- frames::{releases::ReleaseRecord, FrameId},-};--use super::{Context, Frame};+use crate::error::UnhandledError;+use crate::frames::{releases::ReleaseRecord, Context, Frame};const FRAME_TTL_JITTER_PERCENT: u32 = 10;diff --git a/rust/cymbal/src/symbolication/symbol_store/apple.rs b/rust/cymbal/src/core/symbolication/symbol_store/apple.rssimilarity index 100%rename from rust/cymbal/src/symbolication/symbol_store/apple.rsrename to rust/cymbal/src/core/symbolication/symbol_store/apple.rsdiff --git a/rust/cymbal/src/symbolication/symbol_store/caching.rs b/rust/cymbal/src/core/symbolication/symbol_store/caching.rssimilarity index 100%rename from rust/cymbal/src/symbolication/symbol_store/caching.rsrename to rust/cymbal/src/core/symbolication/symbol_store/caching.rsdiff --git a/rust/cymbal/src/symbolication/symbol_store/chunk_id.rs b/rust/cymbal/src/core/symbolication/symbol_store/chunk_id.rssimilarity index 96%rename from rust/cymbal/src/symbolication/symbol_store/chunk_id.rsrename to rust/cymbal/src/core/symbolication/symbol_store/chunk_id.rsindex 3907c7945e0c..ff509c9ee277 100644--- a/rust/cymbal/src/symbolication/symbol_store/chunk_id.rs+++ b/rust/cymbal/src/core/symbolication/symbol_store/chunk_id.rs@@ -343,7 +343,8 @@ mod test {use uuid::Uuid;use crate::{- config::Config,+ core::config::ResolverConfig,+ core::types::Stacktrace,error::ResolveError,frames::RawFrame,langs::js::RawJSFrame,@@ -356,13 +357,13 @@ mod test {sourcemap::{OwnedSourceMapCache, SourcemapProvider},Catalog, MockS3Client, Provider,},- types::{RawErrProps, Stacktrace},+ types::RawErrProps,};const EXAMPLE_EXCEPTION: &str =- include_str!("../../../tests/static/raw_ch_exception_list.json");- const MINIFIED: &[u8] = include_bytes!("../../../tests/static/chunk-PGUQKT6S.js");- const MAP: &[u8] = include_bytes!("../../../tests/static/chunk-PGUQKT6S.js.map");+ include_str!("../../../../tests/static/raw_ch_exception_list.json");+ const MINIFIED: &[u8] = include_bytes!("../../../../tests/static/chunk-PGUQKT6S.js");+ const MAP: &[u8] = include_bytes!("../../../../tests/static/chunk-PGUQKT6S.js.map");// Used to construct a Catalog with only the chunk id based provider implemented#[allow(dead_code)]@@ -418,7 +419,7 @@ mod test {#[sqlx::test(migrations = "./tests/test_migrations")]async fn test_successful_chunk_idlookup(db: PgPool) {- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.object_storage_bucket = "test-bucket".to_string();let chunk_id = Uuid::now_v7().to_string();@@ -459,7 +460,7 @@ mod test {#[sqlx::test(migrations = "./tests/test_migrations")]async fn test_frame_uses_right_resolver(db: PgPool) {- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.object_storage_bucket = "test-bucket".to_string();let chunk_id = Uuid::now_v7().to_string();@@ -523,7 +524,7 @@ mod test {let mut frame = get_example_frame();frame.chunk_id = Some(chunk_id.clone());- let res = frame.resolve(1, &catalog).await.unwrap();+ let res = frame.resolve_frame(1, &catalog, 15).await.unwrap();assert!(res.resolved)}}diff --git a/rust/cymbal/src/symbolication/symbol_store/concurrency.rs b/rust/cymbal/src/core/symbolication/symbol_store/concurrency.rssimilarity index 100%rename from rust/cymbal/src/symbolication/symbol_store/concurrency.rsrename to rust/cymbal/src/core/symbolication/symbol_store/concurrency.rsdiff --git a/rust/cymbal/src/symbolication/symbol_store/dart_minified_names.rs b/rust/cymbal/src/core/symbolication/symbol_store/dart_minified_names.rssimilarity index 100%rename from rust/cymbal/src/symbolication/symbol_store/dart_minified_names.rsrename to rust/cymbal/src/core/symbolication/symbol_store/dart_minified_names.rsdiff --git a/rust/cymbal/src/symbolication/symbol_store/hermesmap.rs b/rust/cymbal/src/core/symbolication/symbol_store/hermesmap.rssimilarity index 100%rename from rust/cymbal/src/symbolication/symbol_store/hermesmap.rsrename to rust/cymbal/src/core/symbolication/symbol_store/hermesmap.rsdiff --git a/rust/cymbal/src/symbolication/symbol_store/mod.rs b/rust/cymbal/src/core/symbolication/symbol_store/mod.rssimilarity index 100%rename from rust/cymbal/src/symbolication/symbol_store/mod.rsrename to rust/cymbal/src/core/symbolication/symbol_store/mod.rsdiff --git a/rust/cymbal/src/symbolication/symbol_store/native.rs b/rust/cymbal/src/core/symbolication/symbol_store/native.rssimilarity index 100%rename from rust/cymbal/src/symbolication/symbol_store/native.rsrename to rust/cymbal/src/core/symbolication/symbol_store/native.rsdiff --git a/rust/cymbal/src/symbolication/symbol_store/proguard.rs b/rust/cymbal/src/core/symbolication/symbol_store/proguard.rssimilarity index 97%rename from rust/cymbal/src/symbolication/symbol_store/proguard.rsrename to rust/cymbal/src/core/symbolication/symbol_store/proguard.rsindex b3922fcd27e0..0cd452855747 100644--- a/rust/cymbal/src/symbolication/symbol_store/proguard.rs+++ b/rust/cymbal/src/core/symbolication/symbol_store/proguard.rs@@ -101,7 +101,8 @@ mod tests {use super::*;- const PROGUARD_MAP: &str = include_str!("../../../tests/static/proguard/mapping_example.txt");+ const PROGUARD_MAP: &str =+ include_str!("../../../../tests/static/proguard/mapping_example.txt");#[test]fn fetched_mapping_uses_proguard_cache_for_lookups() {diff --git a/rust/cymbal/src/symbolication/symbol_store/s3.rs b/rust/cymbal/src/core/symbolication/symbol_store/s3.rssimilarity index 100%rename from rust/cymbal/src/symbolication/symbol_store/s3.rsrename to rust/cymbal/src/core/symbolication/symbol_store/s3.rsdiff --git a/rust/cymbal/src/symbolication/symbol_store/saving.rs b/rust/cymbal/src/core/symbolication/symbol_store/saving.rssimilarity index 97%rename from rust/cymbal/src/symbolication/symbol_store/saving.rsrename to rust/cymbal/src/core/symbolication/symbol_store/saving.rsindex 488ffd5ab49d..cb02699cbf7b 100644--- a/rust/cymbal/src/symbolication/symbol_store/saving.rs+++ b/rust/cymbal/src/core/symbolication/symbol_store/saving.rs@@ -10,13 +10,13 @@ use tracing::{error, info, warn};use uuid::Uuid;use crate::{+ core::analytics::{capture_symbol_set_deleted, capture_symbol_set_saved},error::{FrameError, ResolveError, UnhandledError},metric_consts::{FRAME_RESOLUTION_RESULTS_DELETED, SAVED_SYMBOL_SET_ERROR_RETURNED, SAVED_SYMBOL_SET_LOADED,SAVE_SYMBOL_SET, SYMBOL_SET_DB_FETCHES, SYMBOL_SET_DB_HITS, SYMBOL_SET_DB_MISSES,SYMBOL_SET_FETCH_RETRY, SYMBOL_SET_SAVED,},- posthog_utils::{capture_symbol_set_deleted, capture_symbol_set_saved},symbolication::symbol_store::{chunk_id::SymbolSetKey, BlobClient},};@@ -533,7 +533,7 @@ mod test {use uuid::Uuid;use crate::{- config::Config,+ core::config::ResolverConfig,symbolication::symbol_store::{saving::{truncate_ref, Saving, SymbolSetRecord, MAX_REF_BYTES},sourcemap::SourcemapProvider,@@ -542,8 +542,8 @@ mod test {};const CHUNK_PATH: &str = "/static/chunk-PGUQKT6S.js";- const MINIFIED: &[u8] = include_bytes!("../../../tests/static/chunk-PGUQKT6S.js");- const MAP: &[u8] = include_bytes!("../../../tests/static/chunk-PGUQKT6S.js.map");+ const MINIFIED: &[u8] = include_bytes!("../../../../tests/static/chunk-PGUQKT6S.js");+ const MAP: &[u8] = include_bytes!("../../../../tests/static/chunk-PGUQKT6S.js.map");#[test]fn test_truncate_ref_short_string() {@@ -587,7 +587,7 @@ mod test {async fn test_successful_lookup(db: PgPool) {let server = MockServer::start();- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.object_storage_bucket = "test-bucket".to_string();config.ss_prefix = "test-prefix".to_string();config.allow_internal_ips = true; // Gonna be hitting the sourcemap mocks@@ -649,7 +649,7 @@ mod test {async fn test_dynamic_fetch_cleanup_when_existing_blob_wins_race(db: PgPool) {let server = MockServer::start();- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.object_storage_bucket = "test-bucket".to_string();config.ss_prefix = "test-prefix".to_string();@@ -718,7 +718,7 @@ mod test {async fn test_symbol_set_404_handling(db: PgPool) {let server = MockServer::start();- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.object_storage_bucket = "test-bucket".to_string();config.ss_prefix = "test-prefix".to_string();config.allow_internal_ips = true;@@ -763,7 +763,7 @@ mod test {async fn test_invalid_sourcemap_handling(db: PgPool) {let server = MockServer::start();- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.object_storage_bucket = "test-bucket".to_string();config.ss_prefix = "test-prefix".to_string();config.allow_internal_ips = true;@@ -815,7 +815,7 @@ mod test {async fn test_parse_failure_does_not_overwrite_existing_blob(db: PgPool) {let server = MockServer::start();- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.object_storage_bucket = "test-bucket".to_string();config.ss_prefix = "test-prefix".to_string();config.allow_internal_ips = true;diff --git a/rust/cymbal/src/symbolication/symbol_store/sourcemap.rs b/rust/cymbal/src/core/symbolication/symbol_store/sourcemap.rssimilarity index 97%rename from rust/cymbal/src/symbolication/symbol_store/sourcemap.rsrename to rust/cymbal/src/core/symbolication/symbol_store/sourcemap.rsindex bda098323de8..863b279eea35 100644--- a/rust/cymbal/src/symbolication/symbol_store/sourcemap.rs+++ b/rust/cymbal/src/core/symbolication/symbol_store/sourcemap.rs@@ -10,7 +10,7 @@ use symbolic::sourcemapcache::{SourceMapCache, SourceMapCacheWriter};use tracing::{info, warn};use crate::{- config::Config,+ core::config::ResolverConfig,error::{JsResolveErr, ResolveError, UnhandledError},metric_consts::{CHUNK_ID_RESCUED_FROM_BODY, SOURCEMAP_BODY_FETCHES, SOURCEMAP_BODY_REF_FOUND,@@ -100,7 +100,7 @@ impl Countable for OwnedSourceMapCache {}impl SourcemapProvider {- pub fn new(config: &Config) -> Self {+ pub fn new(config: &ResolverConfig) -> Self {let timeout = Duration::from_secs(config.sourcemap_timeout_seconds);let connect_timeout = Duration::from_secs(config.sourcemap_connect_timeout_seconds);let mut client = reqwest::Client::builder()@@ -563,10 +563,10 @@ fn assert_is_sourcemap(data: &str) -> Result<(), ResolveError> {mod test {use httpmock::MockServer;- const MINIFIED: &[u8] = include_bytes!("../../../tests/static/chunk-PGUQKT6S.js");- const MAP: &[u8] = include_bytes!("../../../tests/static/chunk-PGUQKT6S.js.map");+ const MINIFIED: &[u8] = include_bytes!("../../../../tests/static/chunk-PGUQKT6S.js");+ const MAP: &[u8] = include_bytes!("../../../../tests/static/chunk-PGUQKT6S.js.map");const MINIFIED_WITH_NO_MAP_REF: &[u8] =- include_bytes!("../../../tests/static/chunk-PGUQKT6S-no-map.js");+ include_bytes!("../../../../tests/static/chunk-PGUQKT6S-no-map.js");use super::*;@@ -607,7 +607,7 @@ mod test {then.status(200).body(MAP);});- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();// Needed because we're using mockserver, so hitting localhostconfig.allow_internal_ips = true;let store = SourcemapProvider::new(&config);@@ -641,7 +641,7 @@ mod test {then.status(200).body(MAP);});- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();// Needed because we're using mockserver, so hitting localhostconfig.allow_internal_ips = true;let store = SourcemapProvider::new(&config);@@ -658,7 +658,7 @@ mod test {#[tokio::test]pub async fn data_url_test() {let data_url_example: &str =- include_str!("../../../tests/static/inline_sourcemap_example.js");+ include_str!("../../../../tests/static/inline_sourcemap_example.js");let server = MockServer::start();@@ -679,7 +679,7 @@ mod test {panic!("Expected Data, got something else");};- let expected = include_str!("../../../tests/static/inline_sourcemap_example.js.map");+ let expected = include_str!("../../../../tests/static/inline_sourcemap_example.js.map");assert_eq!(res.trim(), expected.trim());@@ -763,7 +763,7 @@ mod test {.returning(move |_, _| Ok(Some(saved_payload_for_mock.clone())));let s3: Arc<dyn BlobClient> = Arc::new(s3);- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.allow_internal_ips = true;let provider = SourcemapProvider::new(&config).with_chunk_id_rescue(db.clone(),@@ -797,7 +797,7 @@ mod test {let s3: Arc<dyn BlobClient> = Arc::new(MockS3Client::default());- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.allow_internal_ips = true;let provider = SourcemapProvider::new(&config).with_chunk_id_rescue(db.clone(),@@ -859,7 +859,7 @@ mod test {.returning(|_, _| Ok(None));let s3: Arc<dyn BlobClient> = Arc::new(s3);- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.allow_internal_ips = true;let provider = SourcemapProvider::new(&config).with_chunk_id_rescue(db.clone(),diff --git a/rust/cymbal/src/types/exception.rs b/rust/cymbal/src/core/types/exception.rssimilarity index 90%rename from rust/cymbal/src/types/exception.rsrename to rust/cymbal/src/core/types/exception.rsindex b37dea22ceea..7ef1cda2a5f8 100644--- a/rust/cymbal/src/types/exception.rs+++ b/rust/cymbal/src/core/types/exception.rs@@ -1,9 +1,7 @@use serde::{Deserialize, Serialize};-use crate::{- frames::RawFrame,- types::{stacktrace::Stacktrace, Mechanism},-};+use crate::core::types::frames::RawFrame;+use crate::core::types::{stacktrace::Stacktrace, Mechanism};#[derive(Debug, Deserialize, Serialize, Clone)]pub struct Exception {diff --git a/rust/cymbal/src/frames/mod.rs b/rust/cymbal/src/core/types/frames/mod.rssimilarity index 74%rename from rust/cymbal/src/frames/mod.rsrename to rust/cymbal/src/core/types/frames/mod.rsindex 351c81a6af35..60bad7e7a004 100644--- a/rust/cymbal/src/frames/mod.rs+++ b/rust/cymbal/src/core/types/frames/mod.rs@@ -6,17 +6,14 @@ use serde::{Deserialize, Serialize};use serde_json::Value;use crate::{- error::UnhandledError,- fingerprinting::{FingerprintBuilder, FingerprintComponent, FingerprintRecordPart},langs::{apple::RawAppleFrame, custom::CustomFrame, dart::RawDartFrame, go::RawGoFrame,hermes::RawHermesFrame, java::RawJavaFrame, js::RawJSFrame, native::DebugImage,node::RawNodeFrame, php::RawPHPFrame, python::RawPythonFrame, ruby::RawRubyFrame,rust::RawRustFrame,},- metric_consts::{FRAME_NOT_RESOLVED, FRAME_RESOLVED, LEGACY_JS_FRAME_RESOLVED, PER_FRAME_TIME},+ metric_consts::FRAME_NOT_RESOLVED,sanitize_source_line,- symbolication::symbol_store::Catalog,};/// Records the metric and tracing line for a single failed-frame construction. Each@@ -39,7 +36,6 @@ pub(crate) fn record_frame_resolution_failure(}}-pub mod records;pub mod releases;// We consume a huge variety of differently shaped stack frames, which we have special-case@@ -77,73 +73,6 @@ pub enum RawFrame {}impl RawFrame {- pub async fn resolve(- &self,- team_id: i32,- catalog: &Catalog,- debug_images: &[DebugImage],- ) -> Result<Vec<Frame>, UnhandledError> {- let frame_resolve_time = common_metrics::timing_guard(PER_FRAME_TIME, &[]);- let (res, lang_tag) = match self {- RawFrame::JavaScriptWeb(frame) => {- (to_vec(frame.resolve(team_id, catalog).await), "javascript")- }- RawFrame::LegacyJS(frame) => {- // TODO: monitor this metric and remove the legacy frame type when it hits 0- metrics::counter!(LEGACY_JS_FRAME_RESOLVED).increment(1);- (to_vec(frame.resolve(team_id, catalog).await), "javascript")- }- RawFrame::JavaScriptNode(frame) => {- (to_vec(frame.resolve(team_id, catalog).await), "javascript")- }-- RawFrame::Dart(frame) => (to_vec(Ok(frame.into())), "dart"),- RawFrame::Apple(frame) => {- (frame.resolve(team_id, catalog, debug_images).await, "apple")- }- RawFrame::Php(frame) => (to_vec(Ok(frame.into())), "php"),- RawFrame::Python(frame) => (to_vec(Ok(frame.into())), "python"),- RawFrame::Ruby(frame) => (to_vec(Ok(frame.into())), "ruby"),- RawFrame::Rust(frame) => (to_vec(Ok(frame.into())), "rust"),- RawFrame::Custom(frame) => (to_vec(Ok(frame.into())), "custom"),- RawFrame::Go(frame) => (to_vec(Ok(frame.into())), "go"),- RawFrame::Hermes(frame) => (to_vec(frame.resolve(team_id, catalog).await), "hermes"),- RawFrame::Java(frame) => (frame.resolve(team_id, catalog).await, "java"),- };-- // The raw id of the frame is set after it's resolved.- let res = res.map(|mut fs| {- fs.iter_mut()- .enumerate()- .for_each(|(index, f)| f.frame_id = self.frame_id(team_id, index, debug_images));- fs- });-- if res.is_err() {- frame_resolve_time.label("outcome", "failed")- } else {- frame_resolve_time.label("outcome", "success")- }- .label("lang", lang_tag)- .fin();-- if let Ok(frames) = &res {- for frame in frames {- if frame.resolved {- metrics::counter!(FRAME_RESOLVED, "lang" => lang_tag).increment(1);- }- // Failure metrics are emitted by the language-specific `From` impls in- // `langs/*.rs` at the moment of frame construction, where the typed error- // is in scope (so we can call `metric_reason()` directly). This avoids- // having to carry the typed error on the `Frame` struct just to recover- // the metric label, which previously required a custom serializer plus- // `skip_deserializing` and silently dropped failure reasons on PG round-trip.- }- }-- res- }-pub fn symbol_set_ref(&self) -> Option<String> {match self {RawFrame::JavaScriptWeb(frame) | RawFrame::LegacyJS(frame) => frame.symbol_set_ref(),@@ -250,55 +179,6 @@ pub struct ContextLine {pub line: String,}-impl FingerprintComponent for Frame {- fn update(&self, fp: &mut FingerprintBuilder) {- let get_part = |s: &FrameId, p: Vec<&str>| FingerprintRecordPart::Frame {- raw_id: s.to_string(),- pieces: p.into_iter().map(String::from).collect(),- };-- let mut included_pieces = Vec::new();-- // Include source and module in the fingerprint either way- if let Some(source) = &self.source {- fp.update(source.as_bytes());- included_pieces.push("Source file name");- }-- if let Some(module) = &self.module {- fp.update(module.as_bytes());- included_pieces.push("Module name");- }-- // If we've resolved this frame, include function name, and then return- if let Some(resolved) = &self.resolved_name {- fp.update(resolved.as_bytes());- included_pieces.push("Resolved function name");-- fp.add_part(get_part(&self.frame_id, included_pieces));- return;- }-- // Otherwise, get more granular- fp.update(self.mangled_name.as_bytes());- included_pieces.push("Mangled function name");-- if let Some(line) = self.line {- fp.update(line.to_string().as_bytes());- included_pieces.push("Line number");- }-- if let Some(column) = self.column {- fp.update(column.to_string().as_bytes());- included_pieces.push("Column number");- }-- fp.update(self.lang.as_bytes());- included_pieces.push("Language");- fp.add_part(get_part(&self.frame_id, included_pieces));- }-}-impl Frame {pub fn add_junk<T>(&mut self, key: impl ToString, val: T) -> Result<(), serde_json::Error>where@@ -437,10 +317,6 @@ impl From<Frame> for FrameData {}}-fn to_vec<T, E>(item: Result<T, E>) -> Result<Vec<T>, E> {- item.map(|t| vec![t])-}-#[cfg(test)]mod test {use crate::frames::{Frame, RawFrame};diff --git a/rust/cymbal/src/frames/releases.rs b/rust/cymbal/src/core/types/frames/releases.rssimilarity index 100%rename from rust/cymbal/src/frames/releases.rsrename to rust/cymbal/src/core/types/frames/releases.rsdiff --git a/rust/cymbal/src/langs/apple.rs b/rust/cymbal/src/core/types/langs/apple.rssimilarity index 96%rename from rust/cymbal/src/langs/apple.rsrename to rust/cymbal/src/core/types/langs/apple.rsindex a6f4ae7ab63f..c5efeaedbb46 100644--- a/rust/cymbal/src/langs/apple.rs+++ b/rust/cymbal/src/core/types/langs/apple.rs@@ -6,10 +6,7 @@ use sha2::{Digest, Sha512};use symbolic::common::Name;use symbolic::demangle::{Demangle, DemangleOptions};-use std::sync::atomic::Ordering;-use crate::{- config::FRAME_CONTEXT_LINES,error::{AppleError, FrameError, ResolveError, UnhandledError},frames::{record_frame_resolution_failure, Frame},langs::native::{self, DebugImage},@@ -87,11 +84,12 @@ pub struct RawAppleFrame {}impl RawAppleFrame {- pub async fn resolve<C>(+ pub async fn resolve_frame<C>(&self,team_id: i32,catalog: &C,debug_images: &[DebugImage],+ context_lines: usize,) -> Result<Vec<Frame>, UnhandledError>whereC: SymbolCatalog<OrChunkId<AppleRef>, ParsedNativeSymbols>,@@ -101,7 +99,10 @@ impl RawAppleFrame {self.instruction_addr, self.module, self.function, debug_images.len());- match self.resolve_impl(team_id, catalog, debug_images).await {+ match self+ .resolve_impl(team_id, catalog, debug_images, context_lines)+ .await+ {Ok(frames) => {tracing::debug!("[apple-debug] resolve() SUCCESS: {} frame(s), first resolved_name={:?}",@@ -138,6 +139,7 @@ impl RawAppleFrame {team_id: i32,catalog: &C,debug_images: &[DebugImage],+ context_lines: usize,) -> Result<Vec<Frame>, ResolveError>whereC: SymbolCatalog<OrChunkId<AppleRef>, ParsedNativeSymbols>,@@ -223,11 +225,8 @@ impl RawAppleFrame {} else {0};- frame.context = get_context_lines(- source_text.lines(),- target_line,- FRAME_CONTEXT_LINES.load(Ordering::Relaxed),- );+ frame.context =+ get_context_lines(source_text.lines(), target_line, context_lines);}}@@ -432,6 +431,7 @@ impl From<&RawAppleFrame> for Frame {#[cfg(test)]mod test {use super::*;+ use crate::core::symbolication::resolve::Resolve;#[sqlx::test(migrations = "./tests/test_migrations")]async fn test_apple_symbolication(db: sqlx::PgPool) {@@ -441,7 +441,7 @@ mod test {use uuid::Uuid;use crate::{- config::Config,+ core::config::ResolverConfig,frames::RawFrame,symbolication::symbol_store::{apple::AppleProvider, chunk_id::ChunkIdFetcher, hermesmap::HermesMapProvider,@@ -451,7 +451,7 @@ mod test {};let team_id = 1;- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.object_storage_bucket = "test-bucket".to_string();let chunk_id = Uuid::now_v7().to_string();@@ -543,7 +543,7 @@ mod test {let frame = RawFrame::Apple(raw_frame);let resolved = frame- .resolve(team_id, &catalog, &debug_images)+ .resolve(team_id, &catalog, &debug_images, 15).await.unwrap().pop()@@ -559,7 +559,8 @@ mod test {fn get_dsym_bytes() -> Vec<u8> {use posthog_symbol_data::write_symbol_data;- const DSYM_ZIP: &[u8] = include_bytes!("../../tests/static/apple/test_binary.dSYM.zip");+ const DSYM_ZIP: &[u8] =+ include_bytes!("../../../../tests/static/apple/test_binary.dSYM.zip");write_symbol_data(posthog_symbol_data::AppleDsym {data: DSYM_ZIP.to_vec(),})@@ -575,7 +576,7 @@ mod test {// The ZIP includes __source/manifest.json and the source file content,// enabling source-context tests without requiring the file to exist on disk.const DSYM_ZIP: &[u8] =- include_bytes!("../../tests/static/apple/test_binary_inline.dSYM.zip");+ include_bytes!("../../../../tests/static/apple/test_binary_inline.dSYM.zip");write_symbol_data(posthog_symbol_data::AppleDsym {data: DSYM_ZIP.to_vec(),})@@ -604,7 +605,7 @@ mod test {use uuid::Uuid;use crate::{- config::Config,+ core::config::ResolverConfig,frames::RawFrame,symbolication::symbol_store::{apple::AppleProvider, chunk_id::ChunkIdFetcher, hermesmap::HermesMapProvider,@@ -614,7 +615,7 @@ mod test {};let team_id = 1;- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.object_storage_bucket = "test-bucket".to_string();let chunk_id = Uuid::now_v7().to_string();@@ -698,7 +699,7 @@ mod test {}];let frames = RawFrame::Apple(raw_frame)- .resolve(team_id, &catalog, &debug_images)+ .resolve(team_id, &catalog, &debug_images, 15).await.unwrap();diff --git a/rust/cymbal/src/langs/custom.rs b/rust/cymbal/src/core/types/langs/custom.rssimilarity index 100%rename from rust/cymbal/src/langs/custom.rsrename to rust/cymbal/src/core/types/langs/custom.rsdiff --git a/rust/cymbal/src/langs/dart.rs b/rust/cymbal/src/core/types/langs/dart.rssimilarity index 100%rename from rust/cymbal/src/langs/dart.rsrename to rust/cymbal/src/core/types/langs/dart.rsdiff --git a/rust/cymbal/src/langs/go.rs b/rust/cymbal/src/core/types/langs/go.rssimilarity index 100%rename from rust/cymbal/src/langs/go.rsrename to rust/cymbal/src/core/types/langs/go.rsdiff --git a/rust/cymbal/src/langs/hermes.rs b/rust/cymbal/src/core/types/langs/hermes.rssimilarity index 91%rename from rust/cymbal/src/langs/hermes.rsrename to rust/cymbal/src/core/types/langs/hermes.rsindex d6364ddc2a1d..b4998791ab57 100644--- a/rust/cymbal/src/langs/hermes.rs+++ b/rust/cymbal/src/core/types/langs/hermes.rs@@ -41,11 +41,16 @@ pub struct RawHermesFrame {pub enum HermesRef {}impl RawHermesFrame {- pub async fn resolve<C>(&self, team_id: i32, catalog: &C) -> Result<Frame, UnhandledError>+ pub async fn resolve_frame<C>(+ &self,+ team_id: i32,+ catalog: &C,+ context_lines: usize,+ ) -> Result<Frame, UnhandledError>whereC: SymbolCatalog<OrChunkId<HermesRef>, ParsedHermesMap>,{- match self.resolve_impl(team_id, catalog).await {+ match self.resolve_impl(team_id, catalog, context_lines).await {Ok(frame) => Ok(frame),Err(ResolveError::ResolutionError(FrameError::Hermes(e))) => {Ok(self.handle_resolution_error(e))@@ -61,7 +66,12 @@ impl RawHermesFrame {}}- async fn resolve_impl<C>(&self, team_id: i32, catalog: &C) -> Result<Frame, ResolveError>+ async fn resolve_impl<C>(+ &self,+ team_id: i32,+ catalog: &C,+ context_lines: usize,+ ) -> Result<Frame, ResolveError>whereC: SymbolCatalog<OrChunkId<HermesRef>, ParsedHermesMap>,{@@ -83,7 +93,7 @@ impl RawHermesFrame {.get_original_function_name(column).map(|s| s.to_string());- Ok((self, token, resolved_name).into())+ Ok((self, token, resolved_name, context_lines).into())}pub fn frame_id(&self) -> String {@@ -153,8 +163,15 @@ impl From<(&RawHermesFrame, HermesError)> for Frame {}}-impl From<(&RawHermesFrame, Token<'_>, Option<String>)> for Frame {- fn from((frame, token, resolved_name): (&RawHermesFrame, Token<'_>, Option<String>)) -> Self {+impl From<(&RawHermesFrame, Token<'_>, Option<String>, usize)> for Frame {+ fn from(+ (frame, token, resolved_name, context_lines): (+ &RawHermesFrame,+ Token<'_>,+ Option<String>,+ usize,+ ),+ ) -> Self {let source = token.get_source().map(|s| sanitize_string(s.to_string()));let in_app = source.as_ref()@@ -176,7 +193,7 @@ impl From<(&RawHermesFrame, Token<'_>, Option<String>)> for Frame {synthetic: frame.meta.synthetic,junk_drawer: None,code_variables: None,- context: get_token_context(&token, token.get_src_line() as usize),+ context: get_token_context(&token, token.get_src_line() as usize, context_lines),release: None,suspicious: false,module: None,@@ -226,6 +243,7 @@ impl From<&RawHermesFrame> for Frame {#[cfg(test)]mod test {+ use crate::core::symbolication::resolve::Resolve;use std::sync::Arc;use chrono::Utc;@@ -236,7 +254,7 @@ mod test {use uuid::Uuid;use crate::{- config::Config,+ core::config::ResolverConfig,frames::RawFrame,langs::{hermes::RawHermesFrame, CommonFrameMetadata},symbolication::symbol_store::{@@ -246,13 +264,13 @@ mod test {},};- const HERMES_MAP: &str = include_str!("../../tests/static/hermes/composed_example.map");- const RAW_STACK: &str = include_str!("../../tests/static/hermes/raw_stack.txt");+ const HERMES_MAP: &str = include_str!("../../../../tests/static/hermes/composed_example.map");+ const RAW_STACK: &str = include_str!("../../../../tests/static/hermes/raw_stack.txt");#[sqlx::test(migrations = "./tests/test_migrations")]async fn test_hermes_resolution(db: PgPool) {let team_id = 1;- let mut config = Config::init_with_defaults().unwrap();+ let mut config = ResolverConfig::init_with_defaults().unwrap();config.object_storage_bucket = "test-bucket".to_string();let chunk_id = Uuid::now_v7().to_string();@@ -316,7 +334,7 @@ mod test {for (raw_frame, expected_name) in get_frames(chunk_id) {let res = raw_frame- .resolve(team_id, &c, &[])+ .resolve(team_id, &c, &[], 15).await.unwrap().pop()diff --git a/rust/cymbal/src/langs/java.rs b/rust/cymbal/src/core/types/langs/java.rssimilarity index 98%rename from rust/cymbal/src/langs/java.rsrename to rust/cymbal/src/core/types/langs/java.rsindex 371cd45d119b..b85ea45519b0 100644--- a/rust/cymbal/src/langs/java.rs+++ b/rust/cymbal/src/core/types/langs/java.rs@@ -53,7 +53,11 @@ impl RawJavaFrame {format!("{:x}", hasher.finalize())}- pub async fn resolve<C>(&self, team_id: i32, catalog: &C) -> Result<Vec<Frame>, UnhandledError>+ pub async fn resolve_frame<C>(+ &self,+ team_id: i32,+ catalog: &C,+ ) -> Result<Vec<Frame>, UnhandledError>whereC: SymbolCatalog<OrChunkId<ProguardRef>, FetchedMapping>,{diff --git a/rust/cymbal/src/langs/js.rs b/rust/cymbal/src/core/types/langs/js.rssimilarity index 95%rename from rust/cymbal/src/langs/js.rsrename to rust/cymbal/src/core/types/langs/js.rsindex 13e7c210b652..4a3689a5b284 100644--- a/rust/cymbal/src/langs/js.rs+++ b/rust/cymbal/src/core/types/langs/js.rs@@ -42,11 +42,16 @@ pub struct FrameLocation {}impl RawJSFrame {- pub async fn resolve<C>(&self, team_id: i32, catalog: &C) -> Result<Frame, UnhandledError>+ pub async fn resolve_frame<C>(+ &self,+ team_id: i32,+ catalog: &C,+ context_lines: usize,+ ) -> Result<Frame, UnhandledError>whereC: SymbolCatalog<OrChunkId<Url>, OwnedSourceMapCache>,{- match self.resolve_impl(team_id, catalog).await {+ match self.resolve_impl(team_id, catalog, context_lines).await {Ok(frame) => Ok(frame),Err(ResolveError::ResolutionError(FrameError::JavaScript(e))) => {Ok(self.handle_resolution_error(e))@@ -62,7 +67,12 @@ impl RawJSFrame {}}- async fn resolve_impl<C>(&self, team_id: i32, catalog: &C) -> Result<Frame, ResolveError>+ async fn resolve_impl<C>(+ &self,+ team_id: i32,+ catalog: &C,+ context_lines: usize,+ ) -> Result<Frame, ResolveError>whereC: SymbolCatalog<OrChunkId<Url>, OwnedSourceMapCache>,{@@ -86,7 +96,7 @@ impl RawJSFrame {.into());};- Ok(Frame::from((self, location)))+ Ok(Frame::from((self, location, context_lines)))}// JS frames can only handle JS resolution errors - errors at the network level@@ -176,9 +186,9 @@ impl RawJSFrame {}}-impl From<(&RawJSFrame, SourceLocation<'_>)> for Frame {- fn from(src: (&RawJSFrame, SourceLocation)) -> Self {- let (raw_frame, token) = src;+impl From<(&RawJSFrame, SourceLocation<'_>, usize)> for Frame {+ fn from(src: (&RawJSFrame, SourceLocation, usize)) -> Self {+ let (raw_frame, token, context_lines) = src;let resolved_name = match token.scope() {// The `$async$` prefix is a Dart/Flutter compiler artifact that appears in@@ -224,7 +234,7 @@ impl From<(&RawJSFrame, SourceLocation<'_>)> for Frame {junk_drawer: None,code_variables: None,- context: get_sourcelocation_context(&token),+ context: get_sourcelocation_context(&token, context_lines),release: None,synthetic: raw_frame.meta.synthetic,suspicious,diff --git a/rust/cymbal/src/langs/mod.rs b/rust/cymbal/src/core/types/langs/mod.rssimilarity index 100%rename from rust/cymbal/src/langs/mod.rsrename to rust/cymbal/src/core/types/langs/mod.rsdiff --git a/rust/cymbal/src/langs/native.rs b/rust/cymbal/src/core/types/langs/native.rssimilarity index 100%rename from rust/cymbal/src/langs/native.rsrename to rust/cymbal/src/core/types/langs/native.rsdiff --git a/rust/cymbal/src/langs/node.rs b/rust/cymbal/src/core/types/langs/node.rssimilarity index 95%rename from rust/cymbal/src/langs/node.rsrename to rust/cymbal/src/core/types/langs/node.rsindex a43966207b2b..41277c93b24d 100644--- a/rust/cymbal/src/langs/node.rs+++ b/rust/cymbal/src/core/types/langs/node.rs@@ -38,7 +38,12 @@ pub struct RawNodeFrame {}impl RawNodeFrame {- pub async fn resolve<C>(&self, team_id: i32, catalog: &C) -> Result<Frame, UnhandledError>+ pub async fn resolve_frame<C>(+ &self,+ team_id: i32,+ catalog: &C,+ context_lines: usize,+ ) -> Result<Frame, UnhandledError>whereC: SymbolCatalog<OrChunkId<Url>, OwnedSourceMapCache>,{@@ -46,7 +51,10 @@ impl RawNodeFrame {return Ok(self.into());};- match self.resolve_impl(team_id, catalog, chunk_id.clone()).await {+ match self+ .resolve_impl(team_id, catalog, chunk_id.clone(), context_lines)+ .await+ {Ok(frame) => Ok(frame),Err(ResolveError::ResolutionError(FrameError::JavaScript(e))) => Ok((self, e).into()),Err(ResolveError::ResolutionError(FrameError::MissingChunkIdData(chunk_id))) => {@@ -65,6 +73,7 @@ impl RawNodeFrame {team_id: i32,catalog: &C,chunk_id: String,+ context_lines: usize,) -> Result<Frame, ResolveError>whereC: SymbolCatalog<OrChunkId<Url>, OwnedSourceMapCache>,@@ -78,7 +87,7 @@ impl RawNodeFrame {if let Some(location) =smc.lookup(SourcePosition::new(location.line - 1, location.column)){- Ok(Frame::from((self, location)))+ Ok(Frame::from((self, location, context_lines)))} else {Err(JsResolveErr::TokenNotFound(self.function.clone(),@@ -186,8 +195,8 @@ impl From<&RawNodeFrame> for Frame {}}-impl From<(&RawNodeFrame, SourceLocation<'_>)> for Frame {- fn from((raw_frame, location): (&RawNodeFrame, SourceLocation)) -> Self {+impl From<(&RawNodeFrame, SourceLocation<'_>, usize)> for Frame {+ fn from((raw_frame, location, context_lines): (&RawNodeFrame, SourceLocation, usize)) -> Self {let resolved_name = match location.scope() {ScopeLookupResult::NamedScope(name) => Some(sanitize_string(name.to_string())),ScopeLookupResult::AnonymousScope => Some("<anonymous>".to_string()),@@ -222,7 +231,7 @@ impl From<(&RawNodeFrame, SourceLocation<'_>)> for Frame {junk_drawer: None,code_variables: None,- context: get_sourcelocation_context(&location),+ context: get_sourcelocation_context(&location, context_lines),release: None,synthetic: raw_frame.meta.synthetic,suspicious: false,diff --git a/rust/cymbal/src/langs/php.rs b/rust/cymbal/src/core/types/langs/php.rssimilarity index 100%rename from rust/cymbal/src/langs/php.rsrename to rust/cymbal/src/core/types/langs/php.rsdiff --git a/rust/cymbal/src/langs/python.rs b/rust/cymbal/src/core/types/langs/python.rssimilarity index 100%rename from rust/cymbal/src/langs/python.rsrename to rust/cymbal/src/core/types/langs/python.rsdiff --git a/rust/cymbal/src/langs/ruby.rs b/rust/cymbal/src/core/types/langs/ruby.rssimilarity index 100%rename from rust/cymbal/src/langs/ruby.rsrename to rust/cymbal/src/core/types/langs/ruby.rsdiff --git a/rust/cymbal/src/langs/rust.rs b/rust/cymbal/src/core/types/langs/rust.rssimilarity index 100%rename from rust/cymbal/src/langs/rust.rsrename to rust/cymbal/src/core/types/langs/rust.rsdiff --git a/rust/cymbal/src/langs/utils.rs b/rust/cymbal/src/core/types/langs/utils.rssimilarity index 70%rename from rust/cymbal/src/langs/utils.rsrename to rust/cymbal/src/core/types/langs/utils.rsindex ecd566d3c07d..269046fddd06 100644--- a/rust/cymbal/src/langs/utils.rs+++ b/rust/cymbal/src/core/types/langs/utils.rs@@ -1,34 +1,27 @@-use std::sync::atomic::Ordering;-use serde::Serialize;use sourcemap::Token;use symbolic::sourcemapcache::SourceLocation;-use crate::{- config::FRAME_CONTEXT_LINES,- frames::{Context, ContextLine, Frame},-};+use crate::frames::{Context, ContextLine, Frame};pub fn add_raw_to_junk<T: Serialize + Clone>(frame: &mut Frame, raw: &T) {// UNWRAP: raw JS frames are definitely representable as jsonframe.add_junk("raw_frame", raw.clone()).unwrap();}-pub fn get_sourcelocation_context(token: &SourceLocation) -> Option<Context> {+pub fn get_sourcelocation_context(token: &SourceLocation, context_lines: usize) -> Option<Context> {let file = token.file()?;let token_line_num = token.line();let src = file.source()?;- let line_limit = FRAME_CONTEXT_LINES.load(Ordering::Relaxed);- get_context_lines(src.lines(), token_line_num as usize, line_limit)+ get_context_lines(src.lines(), token_line_num as usize, context_lines)}-pub fn get_token_context(token: &Token<'_>, line: usize) -> Option<Context> {+pub fn get_token_context(token: &Token<'_>, line: usize, context_lines: usize) -> Option<Context> {let src = token.get_source_view()?;let lines = src.lines();- let line_limit = FRAME_CONTEXT_LINES.load(Ordering::Relaxed);- get_context_lines(lines, line, line_limit)+ get_context_lines(lines, line, context_lines)}pub fn get_context_lines<'a, L>(lines: L, line: usize, context_len: usize) -> Option<Context>diff --git a/rust/cymbal/src/core/types/mod.rs b/rust/cymbal/src/core/types/mod.rsnew file mode 100644index 000000000000..bf3b8efc0407--- /dev/null+++ b/rust/cymbal/src/core/types/mod.rs@@ -0,0 +1,26 @@+//! Shared exception/stacktrace domain types used by both run modes. The+//! processing event model (`RawErrProps`, `OutputErrProps`, the pipeline+//! `Batch`/`Operator` types) lives in `crate::modes::processing::types`.++use serde::{Deserialize, Serialize};++pub mod exception;+pub mod frames;+pub mod langs;+pub mod stacktrace;++pub use exception::*;+pub use stacktrace::*;++#[derive(Debug, Deserialize, Serialize, Clone)]+pub struct Mechanism {+ #[serde(skip_serializing_if = "Option::is_none")]+ pub handled: Option<bool>,+ #[serde(skip_serializing_if = "Option::is_none")]+ #[serde(rename = "type")]+ pub mechanism_type: Option<String>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub source: Option<String>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub synthetic: Option<bool>,+}diff --git a/rust/cymbal/src/types/stacktrace.rs b/rust/cymbal/src/core/types/stacktrace.rssimilarity index 81%rename from rust/cymbal/src/types/stacktrace.rsrename to rust/cymbal/src/core/types/stacktrace.rsindex 5fa5e0541407..7d70e12eb496 100644--- a/rust/cymbal/src/types/stacktrace.rs+++ b/rust/cymbal/src/core/types/stacktrace.rs@@ -1,6 +1,6 @@use serde::{Deserialize, Serialize};-use crate::frames::{Frame, RawFrame};+use crate::core::types::frames::{Frame, RawFrame};#[derive(Debug, Deserialize, Serialize, Clone)]#[serde(tag = "type", rename_all = "lowercase")]diff --git a/rust/cymbal/src/lib.rs b/rust/cymbal/src/lib.rsindex 1902885a4757..9d9f6ee5b53b 100644--- a/rust/cymbal/src/lib.rs+++ b/rust/cymbal/src/lib.rs@@ -1,138 +1,21 @@-use error::EventError;--use regex::Regex;-use std::sync::LazyLock;--use serde_json::Value;-use tracing::debug;-use uuid::Uuid;--pub mod app_context;-pub mod assignment_rules;-pub mod config;-pub mod error;-pub mod fingerprinting;-pub mod frames;-pub mod issue_resolution;-pub mod langs;-pub mod metric_consts;+pub mod core;pub mod modes;-pub mod posthog_utils;-pub mod router;-pub mod server;-pub mod signals;-pub mod spike_config;-pub mod stages;-pub mod suppression_rules;-pub mod symbolication;-pub mod teams;#[cfg(test)]pub mod test_utils;-pub mod tokenizer;-pub mod types;--pub fn recursively_sanitize_properties(- id: Uuid,- value: &mut Value,- depth: usize,-) -> Result<(), EventError> {- if depth > 64 {- // We don't want to recurse too deeply, in case we have a circular reference or something.- return Err(EventError::InvalidProperties(- id,- "Recursion limit exceeded".to_string(),- ));- }- match value {- Value::Object(map) => {- for (_, v) in map.iter_mut() {- recursively_sanitize_properties(id, v, depth + 1)?;- }- }- Value::Array(arr) => {- for v in arr.iter_mut() {- recursively_sanitize_properties(id, v, depth + 1)?;- }- }- Value::String(s) => {- if needs_sanitization(s) {- debug!("sanitizing null bytes from string in event {}", id);- *s = sanitize_string(s.clone());- }- }- _ => {}- }- Ok(())-}--static WHITESPACE_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\s{50,}").unwrap());--// Postgres doesn't like nulls (u0000) in strings, so we replace them with uFFFD. We also replace all 50-or-more whitespace sequences with "<ws trimmed>".-pub fn sanitize_string(s: String) -> String {- let no_nulls = s.replace('\u{0000}', "\u{FFFD}");- WHITESPACE_REGEX- .replace_all(&no_nulls, "<ws trimmed>")- .to_string()-}--/// Sanitize a source code line: replace only null bytes, leave all whitespace intact.-/// Source context lines have meaningful indentation that must be preserved.-pub fn sanitize_source_line(s: String) -> String {- s.replace('\u{0000}', "\u{FFFD}")-}--pub fn needs_sanitization(s: &str) -> bool {- s.contains('\u{0000}') || s.len() > 512-}--#[cfg(test)]-mod test {- use super::*;-- #[test]- fn test_sanitize_string_null_bytes() {- let input = "hello\u{0000}world".to_string();- let result = sanitize_string(input);- assert_eq!(result, "hello\u{FFFD}world");- }-- #[test]- fn test_sanitize_string_long_whitespace() {- let mut input = "hello".to_string();- input.push_str(&"\n".repeat(60));- input.push_str("world");- let result = sanitize_string(input);- assert_eq!(result, "hello<ws trimmed>world");- }-- #[test]- fn test_sanitize_string_short_whitespace() {- let input = "hello world".to_string();- let result = sanitize_string(input);- assert_eq!(result, "hello world");- }-- #[test]- fn test_sanitize_source_line_preserves_indentation() {- // 65 leading spaces (e.g. Obj-C multi-line method call) must be preserved.- let input = format!("{:>65}reason:@\"value\"", "");- let result = sanitize_source_line(input.clone());- assert_eq!(result, input);- }-- #[test]- fn test_sanitize_source_line_strips_nulls() {- let input = "hello\u{0000}world".to_string();- let result = sanitize_source_line(input);- assert_eq!(result, "hello\u{FFFD}world");- }- #[test]- fn test_sanitize_string_both_issues() {- let mut input = "hello\u{0000}".to_string();- input.push_str(&"\n".repeat(60));- input.push_str("world");- let result = sanitize_string(input);- assert_eq!(result, "hello\u{FFFD}<ws trimmed>world");- }-}+// 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.+pub use core::sanitize::{+ needs_sanitization, recursively_sanitize_properties, sanitize_source_line, sanitize_string,+};+pub use core::types::frames;+pub use core::types::langs;+pub use core::{error, metric_consts, symbolication};++// Compat re-exports: processing-only modules now live under `modes::processing`.+// Prefer `crate::modes::processing::*` in new code.+pub use modes::processing::{+ analytics, app_context, fingerprinting, issue_resolution, router, server, signals, stages,+ teams, tokenizer, types,+};diff --git a/rust/cymbal/src/main.rs b/rust/cymbal/src/main.rsindex 212f1b778570..ec5faaa01069 100644--- a/rust/cymbal/src/main.rs+++ b/rust/cymbal/src/main.rs@@ -1,4 +1,5 @@-use cymbal::config::Config;+use cymbal::modes::processing::ProcessingConfig;+use cymbal::modes::resolution::ResolutionConfig;use cymbal::modes::{self, CymbalMode};use tracing::level_filters::LevelFilter;use tracing::{error, info};@@ -16,6 +17,15 @@ fn setup_tracing() {tracing_subscriber::registry().with(log_layer).init();}+/// Read `CYMBAL_MODE` without parsing any mode-specific config, so each mode can+/// own and parse its own config below.+fn read_mode() -> CymbalMode {+ std::env::var("CYMBAL_MODE")+ .ok()+ .map(|s| s.parse().expect("invalid CYMBAL_MODE"))+ .unwrap_or_default()+}+#[tokio::main]async fn main() {rustls::crypto::ring::default_provider()@@ -25,36 +35,45 @@ async fn main() {setup_tracing();info!("Starting up...");- let config = Config::init_with_defaults().unwrap();-- // Start continuous profiling if enabled (keep _agent alive for the duration of the program)- let _profiling_agent = match config.continuous_profiling.start_agent() {- Ok(agent) => agent,- Err(e) => {- error!("Failed to start continuous profiling agent: {e}");- None+ match read_mode() {+ CymbalMode::Processing => {+ let config = ProcessingConfig::init_with_defaults().unwrap();+ let _profiling_agent = start_profiling(&config.continuous_profiling);+ init_posthog("cymbal", &config.posthog_api_key, &config.posthog_endpoint).await;+ modes::processing::run(config).await;}- };-- let service_name = match config.mode {- CymbalMode::Processing => "cymbal",- CymbalMode::Resolution => "cymbal-resolution",- };- common_posthog::init(- service_name,- config.posthog_api_key.as_deref(),- &config.posthog_endpoint,- )- .await- .unwrap();-- match config.mode {- CymbalMode::Processing => modes::processing::run(config).await,CymbalMode::Resolution => {- if let Err(e) = modes::resolution::serve(&config).await {+ let config = ResolutionConfig::init_with_defaults().unwrap();+ let _profiling_agent = start_profiling(&config.continuous_profiling);+ init_posthog(+ "cymbal-resolution",+ &config.posthog_api_key,+ &config.posthog_endpoint,+ )+ .await;+ if let Err(e) = modes::resolution::serve(&config.resolver, &config.service).await {error!("cymbal-resolution server error: {e}");std::process::exit(1);}}}}++// Keep the returned agent alive for the duration of the program.+fn start_profiling(+ config: &common_continuous_profiling::ContinuousProfilingConfig,+) -> Option<impl Sized> {+ match config.start_agent() {+ Ok(agent) => agent,+ Err(e) => {+ error!("Failed to start continuous profiling agent: {e}");+ None+ }+ }+}++async fn init_posthog(service_name: &'static str, api_key: &Option<String>, endpoint: &str) {+ common_posthog::init(service_name, api_key.as_deref(), endpoint)+ .await+ .unwrap();+}diff --git a/rust/cymbal/src/modes/mod.rs b/rust/cymbal/src/modes/mod.rsindex ff71a690af91..cedbef24bb7b 100644--- a/rust/cymbal/src/modes/mod.rs+++ b/rust/cymbal/src/modes/mod.rs@@ -1,7 +1,7 @@//! Run modes for the cymbal binary. The active mode is selected at boot via//! the `CYMBAL_MODE` env var; each mode owns its own server stack and (nested)//! config. Adding a mode is one submodule, one [`CymbalMode`] variant, one-//! nested config field on [`crate::config::Config`], and one match arm in+//! nested config field on [`crate::modes::processing::ProcessingConfig`], and one match arm in//! `main.rs`.use std::str::FromStr;diff --git a/rust/cymbal/src/modes/processing.rs b/rust/cymbal/src/modes/processing.rsdeleted file mode 100644index ee1c69ef1967..000000000000--- a/rust/cymbal/src/modes/processing.rs+++ /dev/null@@ -1,14 +0,0 @@-//! Processing mode: the error-tracking HTTP `/process` pipeline. This is the-//! default mode and wraps the full [`AppContext`] (Kafka, Redis, issue cache,-//! remote-resolution pool) behind the HTTP server.--use std::sync::Arc;--use crate::app_context::AppContext;-use crate::config::Config;-use crate::server::start_server;--pub async fn run(config: Config) {- let context = Arc::new(AppContext::from_config(&config).await.unwrap());- start_server(config.clone(), context).await;-}diff --git a/rust/cymbal/src/modes/processing/analytics.rs b/rust/cymbal/src/modes/processing/analytics.rsnew file mode 100644index 000000000000..6b2a9b898403--- /dev/null+++ b/rust/cymbal/src/modes/processing/analytics.rs@@ -0,0 +1,24 @@+use posthog_rs::Event;+use uuid::Uuid;++use crate::core::analytics::spawning_capture;++const ISSUE_CREATED: &str = "error_tracking_issue_created";+const ISSUE_REOPENED: &str = "error_tracking_issue_reopened";++pub fn capture_issue_created(team_id: i32, issue_id: Uuid, sentry_integration: bool) {+ let mut event = Event::new_anon(ISSUE_CREATED);+ event.insert_prop("team_id", team_id).unwrap();+ event.insert_prop("issue_id", issue_id.to_string()).unwrap();+ event+ .insert_prop("sentry_integration", sentry_integration)+ .unwrap();+ spawning_capture(ISSUE_CREATED, event);+}++pub fn capture_issue_reopened(team_id: i32, issue_id: Uuid) {+ let mut event = Event::new_anon(ISSUE_REOPENED);+ event.insert_prop("team_id", team_id).unwrap();+ event.insert_prop("issue_id", issue_id.to_string()).unwrap();+ spawning_capture(ISSUE_REOPENED, event);+}diff --git a/rust/cymbal/src/app_context.rs b/rust/cymbal/src/modes/processing/app_context.rssimilarity index 62%rename from rust/cymbal/src/app_context.rsrename to rust/cymbal/src/modes/processing/app_context.rsindex 1cc8e0837b98..a24a464dd6b2 100644--- a/rust/cymbal/src/app_context.rs+++ b/rust/cymbal/src/modes/processing/app_context.rs@@ -5,33 +5,22 @@ use moka::future::{Cache, CacheBuilder};use rdkafka::producer::FutureProducer;use sqlx::{postgres::PgPoolOptions, PgPool};use std::{sync::Arc, time::Duration};-use tokio::{- sync::{Mutex, Semaphore},- task::JoinHandle,-};+use tokio::{sync::Semaphore, task::JoinHandle};use tracing::info;use uuid::Uuid;use crate::{- config::{get_aws_config, init_global_state, Config},+ core::config::get_aws_config,+ core::resolver::build_catalog,error::UnhandledError,+ modes::processing::config::{init_global_state, ProcessingConfig},signals::{MaybeSignalClient, SignalClient},stages::resolution::remote::{dns::TokioDnsResolver, pool::EndpointPool, resolver::RemoteResolutionContext,RemoteResolutionConfig,},symbolication::symbol::{local::LocalSymbolResolver, SymbolResolver},- symbolication::symbol_store::{- apple::AppleProvider,- caching::{Caching, SymbolSetCache},- chunk_id::ChunkIdFetcher,- concurrency,- hermesmap::HermesMapProvider,- proguard::ProguardProvider,- saving::Saving,- sourcemap::SourcemapProvider,- BlobClient, Catalog, S3Client,- },+ symbolication::symbol_store::{BlobClient, Catalog, S3Client},teams::TeamManager,types::operator::TeamId,};@@ -53,7 +42,7 @@ pub struct AppContext {/// the background.pub remote_resolution: Option<RemoteResolutionContext>,remote_resolution_refresh_task: Option<JoinHandle<()>>,- pub config: Config,+ pub config: ProcessingConfig,pub team_manager: TeamManager,pub issue_buckets_redis_client: Arc<dyn RedisClientTrait + Send + Sync>,@@ -73,112 +62,12 @@ impl Drop for AppContext {}}-/// Build just the symbol-resolution stack from env config: connects to-/// Postgres, builds the S3 client, calls [`init_global_state`], and-/// returns a fully-wired `SymbolResolver`. **Does not** start Kafka-/// producers, Redis clients, signals, the issue cache, or the remote--/// resolution pool — those belong to the full cymbal pipeline and are-/// constructed by [`AppContext::from_config`].-///-/// Used by resolution mode (`crate::modes::resolution`), which only needs-/// symbol resolution; keeping this separate stops resolution-mode pods from-/// holding Kafka/Redis connections they never use.-pub(crate) async fn build_symbol_resolver(- config: &Config,-) -> Result<Arc<dyn SymbolResolver>, UnhandledError> {- init_global_state(config);- let options = PgPoolOptions::new().max_connections(config.max_pg_connections);- let posthog_pool = options.connect(&config.database_url).await?;- let s3 = aws_sdk_s3::Client::from_conf(get_aws_config(config).await);- let s3_client: Arc<dyn BlobClient> = Arc::new(S3Client::new(s3));- s3_client.ping_bucket(&config.object_storage_bucket).await?;- let catalog = build_catalog(config, s3_client, posthog_pool.clone());- Ok(Arc::new(LocalSymbolResolver::new(- config,- catalog,- posthog_pool,- )))-}--/// Build the symbol-store [`Catalog`] from already-constructed S3 and PG-/// handles. Internal helper shared by [`AppContext::new`] and-/// [`build_symbol_resolver`] so the provider wiring doesn't drift.-fn build_catalog(- config: &Config,- s3_client: Arc<dyn BlobClient>,- posthog_pool: PgPool,-) -> Arc<Catalog> {- let ss_cache = Arc::new(Mutex::new(SymbolSetCache::new(- config.symbol_store_cache_max_bytes,- )));-- let smp = SourcemapProvider::new(config).with_chunk_id_rescue(- posthog_pool.clone(),- s3_client.clone(),- config.object_storage_bucket.clone(),- );- let smp_chunk = ChunkIdFetcher::new(- smp,- s3_client.clone(),- posthog_pool.clone(),- config.object_storage_bucket.clone(),- );- let smp_saving = Saving::new(- smp_chunk,- posthog_pool.clone(),- s3_client.clone(),- config.object_storage_bucket.clone(),- config.ss_prefix.clone(),- );- let smp_caching = Caching::new(smp_saving, ss_cache.clone());- // We want to fetch each sourcemap from the outside world exactly once,- // and if it isn't in the cache, load/parse it from s3 exactly once too.- // Limiting the per symbol set reference concurrency to 1 ensures this.- let smp_atmostonce = concurrency::AtMostOne::new(smp_caching);-- let hmp_chunk = ChunkIdFetcher::new(- HermesMapProvider {},- s3_client.clone(),- posthog_pool.clone(),- config.object_storage_bucket.clone(),- );- // Skip the saving layer for HermesMapProvider, since it'll never fetch- // something from the outside world.- let hmp_caching = Caching::new(hmp_chunk, ss_cache.clone());- let hmp_atmostonce = concurrency::AtMostOne::new(hmp_caching);-- let pgp_chunk = ChunkIdFetcher::new(- ProguardProvider {},- s3_client.clone(),- posthog_pool.clone(),- config.object_storage_bucket.clone(),- );- let pgp_caching = Caching::new(pgp_chunk, ss_cache.clone());- let pgp_atmostonce = concurrency::AtMostOne::new(pgp_caching);-- let apple_chunk = ChunkIdFetcher::new(- AppleProvider {},- s3_client.clone(),- posthog_pool.clone(),- config.object_storage_bucket.clone(),- );- let apple_caching = Caching::new(apple_chunk, ss_cache);- let apple_atmostonce = concurrency::AtMostOne::new(apple_caching);-- Arc::new(Catalog::new(- smp_atmostonce,- hmp_atmostonce,- pgp_atmostonce,- apple_atmostonce,- ))-}-impl AppContext {- pub async fn from_config(config: &Config) -> Result<Self, UnhandledError> {- let options = PgPoolOptions::new().max_connections(config.max_pg_connections);- let posthog_pool = options.connect(&config.database_url).await?;+ pub async fn from_config(config: &ProcessingConfig) -> Result<Self, UnhandledError> {+ let options = PgPoolOptions::new().max_connections(config.resolver.max_pg_connections);+ let posthog_pool = options.connect(&config.resolver.database_url).await?;- let s3_client = aws_sdk_s3::Client::from_conf(get_aws_config(config).await);+ 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);@@ -206,7 +95,7 @@ impl AppContext {}pub async fn new(- config: &Config,+ config: &ProcessingConfig,s3_client: Arc<dyn BlobClient>,posthog_pool: PgPool,issue_buckets_redis_client: Arc<dyn RedisClientTrait + Send + Sync>,@@ -238,9 +127,11 @@ impl AppContext {_ => immediate_producer.clone(),};- s3_client.ping_bucket(&config.object_storage_bucket).await?;+ s3_client+ .ping_bucket(&config.resolver.object_storage_bucket)+ .await?;- let catalog = build_catalog(config, s3_client, posthog_pool.clone());+ let catalog = build_catalog(&config.resolver, s3_client, posthog_pool.clone());info!("AppContext initialized");@@ -257,12 +148,13 @@ impl AppContext {};let symbol_resolver = Arc::new(LocalSymbolResolver::new(- config,+ &config.resolver,catalog.clone(),posthog_pool.clone(),));- let symbol_resolution_limiter =- Arc::new(Semaphore::new(config.symbol_resolution_concurrency.max(1)));+ 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)));@@ -294,7 +186,7 @@ impl AppContext {}async fn build_remote_resolution(- config: &Config,+ config: &ProcessingConfig,) -> Result<(Option<RemoteResolutionContext>, Option<JoinHandle<()>>), UnhandledError> {if !config.remote_resolution_enabled {return Ok((None, None));diff --git a/rust/cymbal/src/config.rs b/rust/cymbal/src/modes/processing/config.rssimilarity index 67%rename from rust/cymbal/src/config.rsrename to rust/cymbal/src/modes/processing/config.rsindex 163d92ca4005..46260a05718e 100644--- a/rust/cymbal/src/config.rs+++ b/rust/cymbal/src/modes/processing/config.rs@@ -1,30 +1,23 @@use std::sync::atomic::{AtomicUsize, Ordering};-use aws_config::{BehaviorVersion, Region};use common_continuous_profiling::ContinuousProfilingConfig;use common_kafka::config::KafkaConfig;use envconfig::Envconfig;-use tracing::{info, warn};-// TODO - I'm just too lazy to pipe this all the way through the resolve call stack-pub static FRAME_CONTEXT_LINES: AtomicUsize = AtomicUsize::new(15);+use crate::core::config::ResolverConfig;+pub static BATCH_APPLY_CONCURRENCY: AtomicUsize = AtomicUsize::new(64);#[derive(Envconfig, Clone)]-pub struct Config {- /// Which server stack the binary runs. `processing` (default) serves the- /// error-tracking HTTP pipeline; `resolution` serves the- /// `cymbal.resolution.v1` gRPC symbol-resolution service.- #[envconfig(from = "CYMBAL_MODE", default = "processing")]- pub mode: crate::modes::CymbalMode,-+pub struct ProcessingConfig {#[envconfig(nested = true)]pub continuous_profiling: ContinuousProfilingConfig,- /// Resolution-mode settings. Parsed unconditionally (defaults make this- /// harmless in processing mode); only read when `mode == Resolution`.+ /// Shared symbol-resolution config (Postgres, object storage, frame cache,+ /// sourcemap fetching). Both modes read this slice; it lives in `core` so+ /// resolution mode never pulls in the processing-only knobs below.#[envconfig(nested = true)]- pub resolution: crate::modes::resolution::Config,+ pub resolver: ResolverConfig,#[envconfig(from = "BIND_HOST", default = "::")]pub host: String,@@ -62,76 +55,14 @@ pub struct Config {#[envconfig(default = "document_embeddings_input")]pub embedding_worker_topic: String,- #[envconfig(default = "postgres://posthog:posthog@localhost:5432/posthog")]- pub database_url: String,-- // Rust service connect directly to postgres, not via pgbouncer, so we keep this low- #[envconfig(default = "4")]- pub max_pg_connections: u32,-- // cymbal makes HTTP get requests to auto-resolve sourcemaps - and follows redirects. To protect against SSRF, we only allow requests to public URLs by default- #[envconfig(default = "false")]- pub allow_internal_ips: bool,-- #[envconfig(default = "30")]- pub sourcemap_timeout_seconds: u64,-- #[envconfig(default = "5")]- pub sourcemap_connect_timeout_seconds: u64,-- #[envconfig(default = "100000000")] // 100MB - in prod, we should use closer to 1-10GB- pub symbol_store_cache_max_bytes: usize,-- #[envconfig(default = "http://127.0.0.1:19000")] // minio- pub object_storage_endpoint: String,-- #[envconfig(default = "symbol_sets")]- pub object_storage_bucket: String,-- #[envconfig(default = "us-east-1")]- pub object_storage_region: String,-- #[envconfig(default = "object_storage_root_user")]- pub object_storage_access_key_id: String,-- #[envconfig(default = "object_storage_root_password")]- pub object_storage_secret_access_key: String,-- #[envconfig(default = "false")] // Enable for MinIO compatibility- pub object_storage_force_path_style: bool,-- #[envconfig(default = "symbolsets")]- pub ss_prefix: String,-#[envconfig(default = "600")]pub issue_cache_ttl_seconds: u64,- #[envconfig(default = "100000")]- pub frame_cache_size: u64,-- // Used by cymbal and cymbal-resolution through the shared symbol resolver config.- // Resolved frame results are relatively stable, while unresolved results can become- // resolvable after a user uploads missing symbols, so keep them shorter.- #[envconfig(default = "1800")]- pub frame_resolved_ttl_seconds: u64,-- #[envconfig(default = "300")]- pub frame_unresolved_ttl_seconds: u64,-- // Maximum number of lines of pre and post context to get per frame- #[envconfig(default = "15")]- pub context_line_count: usize,-// Maximum number of in-flight futures for a single `Batch::apply_func` call.// This is a per-call-site limit, not a global pipeline-wide concurrency cap.#[envconfig(default = "64")]pub batch_apply_concurrency: usize,- // Global maximum number of concurrent symbol resolution operations.- // This limiter is shared across frame and exception symbol resolution paths.- #[envconfig(default = "64")]- pub symbol_resolution_concurrency: usize,-// Maximum number of in-flight /process requests accepted by the API.// Requests above this limit are rejected with 429 to apply backpressure.#[envconfig(default = "128")]@@ -185,9 +116,6 @@ pub struct Config {#[envconfig(default = "")]pub signals_api_base_url: String,- #[envconfig(default = "")]- pub internal_api_secret: String,-// ----------------------------------------------------------------------// Remote resolution (cymbal.resolution.v1) — Batch 3 client integration.//@@ -312,7 +240,7 @@ pub struct Config {pub remote_resolution_subscribe_reconnect_backoff_ms: u64,}-impl Config {+impl ProcessingConfig {pub fn init_with_defaults() -> Result<Self, envconfig::Error> {let res = Self::init_from_env()?;init_global_state(&res);@@ -320,38 +248,6 @@ impl Config {}}-pub fn init_global_state(config: &Config) {- FRAME_CONTEXT_LINES.store(config.context_line_count, Ordering::Relaxed);+pub fn init_global_state(config: &ProcessingConfig) {BATCH_APPLY_CONCURRENCY.store(config.batch_apply_concurrency.max(1), Ordering::Relaxed);}--pub async fn get_aws_config(config: &Config) -> aws_sdk_s3::Config {- // If we have a role ARN and token file, which are added to the container due to the SA annotation we use in prod- if std::env::var("AWS_ROLE_ARN").is_ok() && std::env::var("AWS_WEB_IDENTITY_TOKEN_FILE").is_ok()- {- info!("AWS role and token file detected, config loaded from environment variables");- // Use default aws config loading behaviour, which should pick up the role-based credentials. We- // assume region and endpoint will be properly set due to SA annotation. Behaviour version will- // be latest due to config crate feature flag- aws_sdk_s3::config::Builder::from(&aws_config::load_from_env().await)- .force_path_style(config.object_storage_force_path_style)- .build()- } else {- warn!("Falling back to building config from explicit environment variables");- // Fall back to building our config from the explicit environment variables we use in local dev- let env_credentials = aws_sdk_s3::config::Credentials::new(- &config.object_storage_access_key_id,- &config.object_storage_secret_access_key,- None,- None,- "environment",- );- aws_sdk_s3::config::Builder::new()- .region(Region::new(config.object_storage_region.clone()))- .endpoint_url(&config.object_storage_endpoint)- .credentials_provider(env_credentials)- .behavior_version(BehaviorVersion::latest())- .force_path_style(config.object_storage_force_path_style)- .build()- }-}diff --git a/rust/cymbal/src/fingerprinting/mod.rs b/rust/cymbal/src/modes/processing/fingerprinting/mod.rssimilarity index 86%rename from rust/cymbal/src/fingerprinting/mod.rsrename to rust/cymbal/src/modes/processing/fingerprinting/mod.rsindex 1a27ae0506c7..9c1328ae7ede 100644--- a/rust/cymbal/src/fingerprinting/mod.rs+++ b/rust/cymbal/src/modes/processing/fingerprinting/mod.rs@@ -1,19 +1,17 @@use std::sync::Arc;+use crate::modes::processing::rules::grouping::{try_grouping_rules, GroupingRule};use crate::{app_context::AppContext,- assignment_rules::NewAssignment,error::UnhandledError,+ modes::processing::rules::assignment::NewAssignment,types::{ExceptionList, RawErrProps},};use common_types::TeamId;-use grouping_rules::{try_grouping_rules, GroupingRule};use serde::{Deserialize, Serialize};use sha2::{Digest, Sha512};use uuid::Uuid;-pub mod grouping_rules;-pub async fn resolve_fingerprint(ctx: &Arc<AppContext>,team_id: TeamId,@@ -108,6 +106,57 @@ impl Fingerprint {}}+impl FingerprintComponent for crate::frames::Frame {+ fn update(&self, fp: &mut FingerprintBuilder) {+ let get_part = |s: &common_types::error_tracking::FrameId, p: Vec<&str>| {+ FingerprintRecordPart::Frame {+ raw_id: s.to_string(),+ pieces: p.into_iter().map(String::from).collect(),+ }+ };++ let mut included_pieces = Vec::new();++ // Include source and module in the fingerprint either way+ if let Some(source) = &self.source {+ fp.update(source.as_bytes());+ included_pieces.push("Source file name");+ }++ if let Some(module) = &self.module {+ fp.update(module.as_bytes());+ included_pieces.push("Module name");+ }++ // If we've resolved this frame, include function name, and then return+ if let Some(resolved) = &self.resolved_name {+ fp.update(resolved.as_bytes());+ included_pieces.push("Resolved function name");++ fp.add_part(get_part(&self.frame_id, included_pieces));+ return;+ }++ // Otherwise, get more granular+ fp.update(self.mangled_name.as_bytes());+ included_pieces.push("Mangled function name");++ if let Some(line) = self.line {+ fp.update(line.to_string().as_bytes());+ included_pieces.push("Line number");+ }++ if let Some(column) = self.column {+ fp.update(column.to_string().as_bytes());+ included_pieces.push("Column number");+ }++ fp.update(self.lang.as_bytes());+ included_pieces.push("Language");+ fp.add_part(get_part(&self.frame_id, included_pieces));+ }+}+#[cfg(test)]mod test {diff --git a/rust/cymbal/src/issue_resolution.rs b/rust/cymbal/src/modes/processing/issue_resolution.rssimilarity index 98%rename from rust/cymbal/src/issue_resolution.rsrename to rust/cymbal/src/modes/processing/issue_resolution.rsindex acd70ee21e81..66ad7de55794 100644--- a/rust/cymbal/src/issue_resolution.rs+++ b/rust/cymbal/src/modes/processing/issue_resolution.rs@@ -9,12 +9,12 @@ use serde::{Deserialize, Serialize};use sqlx::PgConnection;use uuid::Uuid;-use crate::assignment_rules::{try_assignment_rules, Assignee, Assignment};+use crate::modes::processing::rules::assignment::{try_assignment_rules, Assignee, Assignment};use crate::teams::TeamManager;use crate::types::{FingerprintedErrProps, OutputErrProps};use crate::{- app_context::AppContext, error::UnhandledError, metric_consts::ISSUE_REOPENED,- posthog_utils::capture_issue_reopened,+ analytics::capture_issue_reopened, app_context::AppContext, error::UnhandledError,+ metric_consts::ISSUE_REOPENED,};#[derive(Debug, Clone)]@@ -534,7 +534,7 @@ impl Display for IssueStatus {#[cfg(test)]mod test {- use crate::{assignment_rules::Assignee, sanitize_string};+ use crate::{modes::processing::rules::assignment::Assignee, sanitize_string};#[test]fn it_replaces_null_characters() {diff --git a/rust/cymbal/src/modes/processing/mod.rs b/rust/cymbal/src/modes/processing/mod.rsnew file mode 100644index 000000000000..c1ba5f24d431--- /dev/null+++ b/rust/cymbal/src/modes/processing/mod.rs@@ -0,0 +1,31 @@+//! Processing mode: the error-tracking HTTP `/process` pipeline. This is the+//! default mode and wraps the full [`AppContext`] (Kafka, Redis, issue cache,+//! remote-resolution pool) behind the HTTP server. Everything under this module+//! is processing-only; the shared symbol-resolution kernel lives in+//! [`crate::core`].++use std::sync::Arc;++use crate::app_context::AppContext;+use crate::server::start_server;++pub mod analytics;+pub mod app_context;+pub mod config;+pub mod fingerprinting;+pub mod issue_resolution;+pub mod router;+pub mod rules;+pub mod server;+pub mod signals;+pub mod stages;+pub mod teams;+pub mod tokenizer;+pub mod types;++pub use config::ProcessingConfig;++pub async fn run(config: ProcessingConfig) {+ let context = Arc::new(AppContext::from_config(&config).await.unwrap());+ start_server(config.clone(), context).await;+}diff --git a/rust/cymbal/src/router/event.rs b/rust/cymbal/src/modes/processing/router/event.rssimilarity index 100%rename from rust/cymbal/src/router/event.rsrename to rust/cymbal/src/modes/processing/router/event.rsdiff --git a/rust/cymbal/src/router/mod.rs b/rust/cymbal/src/modes/processing/router/mod.rssimilarity index 100%rename from rust/cymbal/src/router/mod.rsrename to rust/cymbal/src/modes/processing/router/mod.rsdiff --git a/rust/cymbal/src/assignment_rules.rs b/rust/cymbal/src/modes/processing/rules/assignment.rssimilarity index 100%rename from rust/cymbal/src/assignment_rules.rsrename to rust/cymbal/src/modes/processing/rules/assignment.rsdiff --git a/rust/cymbal/src/fingerprinting/grouping_rules.rs b/rust/cymbal/src/modes/processing/rules/grouping.rssimilarity index 99%rename from rust/cymbal/src/fingerprinting/grouping_rules.rsrename to rust/cymbal/src/modes/processing/rules/grouping.rsindex abe65be6db4c..7c099bf09bc7 100644--- a/rust/cymbal/src/fingerprinting/grouping_rules.rs+++ b/rust/cymbal/src/modes/processing/rules/grouping.rs@@ -9,12 +9,12 @@ use sqlx::PgConnection;use uuid::Uuid;use crate::{- assignment_rules::NewAssignment,error::UnhandledError,metric_consts::{CUSTOM_GROUPED_EVENTS, GROUPING_RULES_DISABLED, GROUPING_RULES_FOUND,GROUPING_RULES_PROCESSING_TIME, GROUPING_RULES_TRIED,},+ modes::processing::rules::assignment::NewAssignment,teams::TeamManager,types::RawErrProps,};diff --git a/rust/cymbal/src/modes/processing/rules/mod.rs b/rust/cymbal/src/modes/processing/rules/mod.rsnew file mode 100644index 000000000000..92e3f1a2e167--- /dev/null+++ b/rust/cymbal/src/modes/processing/rules/mod.rs@@ -0,0 +1,8 @@+//! Per-team rule kinds the processing pipeline evaluates: assignment,+//! suppression, spike-alerting, and grouping (custom fingerprints). Cached+//! together by `crate::modes::processing::teams::TeamManager`.++pub mod assignment;+pub mod grouping;+pub mod spike;+pub mod suppression;diff --git a/rust/cymbal/src/spike_config.rs b/rust/cymbal/src/modes/processing/rules/spike.rssimilarity index 100%rename from rust/cymbal/src/spike_config.rsrename to rust/cymbal/src/modes/processing/rules/spike.rsdiff --git a/rust/cymbal/src/suppression_rules.rs b/rust/cymbal/src/modes/processing/rules/suppression.rssimilarity index 100%rename from rust/cymbal/src/suppression_rules.rsrename to rust/cymbal/src/modes/processing/rules/suppression.rsdiff --git a/rust/cymbal/src/server.rs b/rust/cymbal/src/modes/processing/server.rssimilarity index 89%rename from rust/cymbal/src/server.rsrename to rust/cymbal/src/modes/processing/server.rsindex a39c1e44d68b..2969cc427ff8 100644--- a/rust/cymbal/src/server.rs+++ b/rust/cymbal/src/modes/processing/server.rs@@ -5,15 +5,15 @@ use tracing::info;use crate::{app_context::AppContext,- config::Config,metric_consts::{BYTE_HISTOGRAM_BUCKETS, S3_FETCHED_BYTES, S3_PUT_BYTES, SOURCEMAP_EXTERNAL_BYTES,SYMBOL_SET_DECOMPRESSED_BYTES,},+ modes::processing::config::ProcessingConfig,router::get_router,};-pub async fn start_server(config: Config, context: Arc<AppContext>) -> () {+pub async fn start_server(config: ProcessingConfig, context: Arc<AppContext>) -> () {let router = get_router(context);let bucket_overrides: &[(Matcher, &[f64])] = &[(diff --git a/rust/cymbal/src/signals.rs b/rust/cymbal/src/modes/processing/signals.rssimilarity index 97%rename from rust/cymbal/src/signals.rsrename to rust/cymbal/src/modes/processing/signals.rsindex ed330e26bca8..772b4250923e 100644--- a/rust/cymbal/src/signals.rs+++ b/rust/cymbal/src/modes/processing/signals.rs@@ -3,9 +3,9 @@ use std::sync::Arc;use serde::Serialize;use tracing::warn;-use crate::config::Config;use crate::issue_resolution::Issue;use crate::metric_consts::{SIGNAL_EMITTED, SIGNAL_EMIT_FAILED, SIGNAL_EMIT_RESPONSE};+use crate::modes::processing::config::ProcessingConfig;use crate::tokenizer::CL100K_BPE;use crate::types::OutputErrProps;@@ -65,14 +65,14 @@ pub struct SignalClient {}impl SignalClient {- pub fn new(config: &Config) -> Self {+ pub fn new(config: &ProcessingConfig) -> Self {Self {http: reqwest::Client::builder().no_proxy().build().expect("Failed to build SignalClient HTTP client"),base_url: config.signals_api_base_url.clone(),- secret: config.internal_api_secret.clone(),+ secret: config.resolver.internal_api_secret.clone(),}}diff --git a/rust/cymbal/src/stages/alerting/mod.rs b/rust/cymbal/src/modes/processing/stages/alerting/mod.rssimilarity index 100%rename from rust/cymbal/src/stages/alerting/mod.rsrename to rust/cymbal/src/modes/processing/stages/alerting/mod.rsdiff --git a/rust/cymbal/src/stages/alerting/spike_alert.rs b/rust/cymbal/src/modes/processing/stages/alerting/spike_alert.rssimilarity index 100%rename from rust/cymbal/src/stages/alerting/spike_alert.rsrename to rust/cymbal/src/modes/processing/stages/alerting/spike_alert.rsdiff --git a/rust/cymbal/src/stages/alerting/spike_detection.rs b/rust/cymbal/src/modes/processing/stages/alerting/spike_detection.rssimilarity index 99%rename from rust/cymbal/src/stages/alerting/spike_detection.rsrename to rust/cymbal/src/modes/processing/stages/alerting/spike_detection.rsindex 7c527c1f6d29..702238c6eca9 100644--- a/rust/cymbal/src/stages/alerting/spike_detection.rs+++ b/rust/cymbal/src/modes/processing/stages/alerting/spike_detection.rs@@ -16,7 +16,7 @@ use crate::metric_consts::{SPIKE_INCREMENT_ISSUE_BUCKETS_TIME, SPIKE_INCREMENT_TEAM_BUCKETS_TIME,SPIKE_ISSUES_BLOCKED_BY_COOLDOWN, SPIKE_ISSUES_CHECKED, SPIKE_ISSUES_SPIKING,};-use crate::spike_config::SpikeDetectionConfig;+use crate::modes::processing::rules::spike::SpikeDetectionConfig;use crate::types::OutputErrProps;const ISSUE_BUCKET_TTL_SECONDS: usize = 60 * 60;diff --git a/rust/cymbal/src/stages/grouping/fingerprint.rs b/rust/cymbal/src/modes/processing/stages/grouping/fingerprint.rssimilarity index 94%rename from rust/cymbal/src/stages/grouping/fingerprint.rsrename to rust/cymbal/src/modes/processing/stages/grouping/fingerprint.rsindex 2068c1a5e303..8b8111759b77 100644--- a/rust/cymbal/src/stages/grouping/fingerprint.rs+++ b/rust/cymbal/src/modes/processing/stages/grouping/fingerprint.rs@@ -2,8 +2,9 @@ use sha2::{Digest, Sha512};use crate::{error::UnhandledError,- fingerprinting::{grouping_rules::evaluate_grouping_rules, Fingerprint, FingerprintRecordPart},+ fingerprinting::{Fingerprint, FingerprintRecordPart},metric_consts::FINGERPRINT_GENERATOR_OPERATOR,+ modes::processing::rules::grouping::evaluate_grouping_rules,stages::{grouping::GroupingStage, pipeline::HandledError},types::{exception_properties::ExceptionProperties,diff --git a/rust/cymbal/src/stages/grouping/mod.rs b/rust/cymbal/src/modes/processing/stages/grouping/mod.rssimilarity index 100%rename from rust/cymbal/src/stages/grouping/mod.rsrename to rust/cymbal/src/modes/processing/stages/grouping/mod.rsdiff --git a/rust/cymbal/src/stages/http_pipeline.rs b/rust/cymbal/src/modes/processing/stages/http_pipeline.rssimilarity index 100%rename from rust/cymbal/src/stages/http_pipeline.rsrename to rust/cymbal/src/modes/processing/stages/http_pipeline.rsdiff --git a/rust/cymbal/src/stages/linking/issue.rs b/rust/cymbal/src/modes/processing/stages/linking/issue.rssimilarity index 99%rename from rust/cymbal/src/stages/linking/issue.rsrename to rust/cymbal/src/modes/processing/stages/linking/issue.rsindex 36eec6127e82..24bcc33b6883 100644--- a/rust/cymbal/src/stages/linking/issue.rs+++ b/rust/cymbal/src/modes/processing/stages/linking/issue.rs@@ -7,15 +7,15 @@ use tracing::warn;use uuid::Uuid;use crate::{+ analytics::capture_issue_created,app_context::AppContext,- assignment_rules::{try_assignment_rules, Assignment},error::UnhandledError,issue_resolution::{send_fingerprint_issue_state, send_issue_created_alert, send_issue_reopened_alert,send_new_fingerprint_event, Issue, IssueFingerprintOverride,},metric_consts::{ISSUE_CREATED, ISSUE_LINKER_OPERATOR},- posthog_utils::capture_issue_created,+ modes::processing::rules::assignment::{try_assignment_rules, Assignment},stages::{linking::LinkingStage, pipeline::HandledError},teams::TeamManager,types::{diff --git a/rust/cymbal/src/stages/linking/mod.rs b/rust/cymbal/src/modes/processing/stages/linking/mod.rssimilarity index 100%rename from rust/cymbal/src/stages/linking/mod.rsrename to rust/cymbal/src/modes/processing/stages/linking/mod.rsdiff --git a/rust/cymbal/src/stages/linking/rule_suppression.rs b/rust/cymbal/src/modes/processing/stages/linking/rule_suppression.rssimilarity index 100%rename from rust/cymbal/src/stages/linking/rule_suppression.rsrename to rust/cymbal/src/modes/processing/stages/linking/rule_suppression.rsdiff --git a/rust/cymbal/src/stages/linking/suppression.rs b/rust/cymbal/src/modes/processing/stages/linking/suppression.rssimilarity index 100%rename from rust/cymbal/src/stages/linking/suppression.rsrename to rust/cymbal/src/modes/processing/stages/linking/suppression.rsdiff --git a/rust/cymbal/src/stages/mod.rs b/rust/cymbal/src/modes/processing/stages/mod.rssimilarity index 100%rename from rust/cymbal/src/stages/mod.rsrename to rust/cymbal/src/modes/processing/stages/mod.rsdiff --git a/rust/cymbal/src/stages/pipeline.rs b/rust/cymbal/src/modes/processing/stages/pipeline.rssimilarity index 100%rename from rust/cymbal/src/stages/pipeline.rsrename to rust/cymbal/src/modes/processing/stages/pipeline.rsdiff --git a/rust/cymbal/src/stages/post_processing/mod.rs b/rust/cymbal/src/modes/processing/stages/post_processing/mod.rssimilarity index 100%rename from rust/cymbal/src/stages/post_processing/mod.rsrename to rust/cymbal/src/modes/processing/stages/post_processing/mod.rsdiff --git a/rust/cymbal/src/stages/pre_processing/mod.rs b/rust/cymbal/src/modes/processing/stages/pre_processing/mod.rssimilarity index 100%rename from rust/cymbal/src/stages/pre_processing/mod.rsrename to rust/cymbal/src/modes/processing/stages/pre_processing/mod.rsdiff --git a/rust/cymbal/src/stages/resolution/exception.rs b/rust/cymbal/src/modes/processing/stages/resolution/exception.rssimilarity index 88%rename from rust/cymbal/src/stages/resolution/exception.rsrename to rust/cymbal/src/modes/processing/stages/resolution/exception.rsindex 10592d05a531..50215222e3b0 100644--- a/rust/cymbal/src/stages/resolution/exception.rs+++ b/rust/cymbal/src/modes/processing/stages/resolution/exception.rs@@ -85,9 +85,9 @@ mod test {use uuid::Uuid;use crate::{- config::Config,frames::RawFrame,langs::{java::RawJavaFrame, CommonFrameMetadata},+ modes::processing::config::ProcessingConfig,symbolication::symbol::{local::LocalSymbolResolver, SymbolResolver},symbolication::symbol_store::{apple::AppleProvider, chunk_id::ChunkIdFetcher, hermesmap::HermesMapProvider,@@ -97,13 +97,14 @@ mod test {types::{Exception, Stacktrace},};- const PROGUARD_MAP: &str = include_str!("../../../tests/static/proguard/mapping_example.txt");+ const PROGUARD_MAP: &str =+ include_str!("../../../../../tests/static/proguard/mapping_example.txt");#[sqlx::test(migrations = "./tests/test_migrations")]async fn test_proguard_resolution(db: PgPool) {let team_id = 1;- let mut config = Config::init_with_defaults().unwrap();- config.object_storage_bucket = "test-bucket".to_string();+ let mut config = ProcessingConfig::init_with_defaults().unwrap();+ config.resolver.object_storage_bucket = "test-bucket".to_string();let map_id = "[email protected]+3".to_string();@@ -125,7 +126,7 @@ mod test {client.expect_get().with(- predicate::eq(config.object_storage_bucket.clone()),+ predicate::eq(config.resolver.object_storage_bucket.clone()),predicate::eq(map_id.clone()), // We set the map id as the storage ptr above, in production it will be a different value with a prefix).returning(|_, _| Ok(Some(bytes::Bytes::from(get_symbol_data_bytes()))));@@ -137,29 +138,29 @@ mod test {hmp,client.clone(),db.clone(),- config.object_storage_bucket.clone(),+ config.resolver.object_storage_bucket.clone(),);- let smp = SourcemapProvider::new(&config);+ let smp = SourcemapProvider::new(&config.resolver);let smp = ChunkIdFetcher::new(smp,client.clone(),db.clone(),- config.object_storage_bucket.clone(),+ config.resolver.object_storage_bucket.clone(),);let pgp = ChunkIdFetcher::new(ProguardProvider {},client.clone(),db.clone(),- config.object_storage_bucket.clone(),+ config.resolver.object_storage_bucket.clone(),);let apple = ChunkIdFetcher::new(AppleProvider {},client.clone(),db.clone(),- config.object_storage_bucket.clone(),+ config.resolver.object_storage_bucket.clone(),);let c = Catalog::new(smp, hmp, pgp, apple);@@ -174,7 +175,7 @@ mod test {meta: CommonFrameMetadata::default(),};- let resolver = LocalSymbolResolver::new(&config, Arc::new(c), db);+ let resolver = LocalSymbolResolver::new(&config.resolver, Arc::new(c), db);let exception = Exception {exception_type: "c".to_string(),module: Some("a1".to_string()),diff --git a/rust/cymbal/src/stages/resolution/frame.rs b/rust/cymbal/src/modes/processing/stages/resolution/frame.rssimilarity index 100%rename from rust/cymbal/src/stages/resolution/frame.rsrename to rust/cymbal/src/modes/processing/stages/resolution/frame.rsdiff --git a/rust/cymbal/src/stages/resolution/mod.rs b/rust/cymbal/src/modes/processing/stages/resolution/mod.rssimilarity index 100%rename from rust/cymbal/src/stages/resolution/mod.rsrename to rust/cymbal/src/modes/processing/stages/resolution/mod.rsdiff --git a/rust/cymbal/src/stages/resolution/properties.rs b/rust/cymbal/src/modes/processing/stages/resolution/properties.rssimilarity index 100%rename from rust/cymbal/src/stages/resolution/properties.rsrename to rust/cymbal/src/modes/processing/stages/resolution/properties.rsdiff --git a/rust/cymbal/src/stages/resolution/remote/client.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/client.rssimilarity index 100%rename from rust/cymbal/src/stages/resolution/remote/client.rsrename to rust/cymbal/src/modes/processing/stages/resolution/remote/client.rsdiff --git a/rust/cymbal/src/stages/resolution/remote/config.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/config.rssimilarity index 93%rename from rust/cymbal/src/stages/resolution/remote/config.rsrename to rust/cymbal/src/modes/processing/stages/resolution/remote/config.rsindex 464cc766e5ff..077676e3b412 100644--- a/rust/cymbal/src/stages/resolution/remote/config.rs+++ b/rust/cymbal/src/modes/processing/stages/resolution/remote/config.rs@@ -1,9 +1,9 @@use std::time::Duration;-use crate::config::Config;use crate::error::UnhandledError;+use crate::modes::processing::config::ProcessingConfig;-/// Narrowed view of [`crate::config::Config`] containing only the fields used+/// Narrowed view of [`crate::modes::processing::config::ProcessingConfig`] containing only the fields used/// by the remote resolution client. Keeping a dedicated struct lets the pool,/// DNS, and resolver modules be exercised in tests without touching cymbal's/// full env-var surface.@@ -51,13 +51,13 @@ pub struct RemoteResolutionConfig {}impl RemoteResolutionConfig {- pub fn from_config(config: &Config) -> Result<Self, UnhandledError> {+ 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(),));}- if config.internal_api_secret.trim().is_empty() {+ if config.resolver.internal_api_secret.trim().is_empty() {return Err(UnhandledError::Other("remote resolution enabled but INTERNAL_API_SECRET is empty".to_string(),));@@ -65,7 +65,7 @@ impl RemoteResolutionConfig {Ok(Self {host: config.remote_resolution_host.clone(),port: config.remote_resolution_port,- internal_api_secret: config.internal_api_secret.clone(),+ internal_api_secret: config.resolver.internal_api_secret.clone(),dns_refresh: Duration::from_secs(config.remote_resolution_dns_refresh_secs.max(1)),request_deadline: Duration::from_millis(config.remote_resolution_deadline_ms.max(1)),connect_timeout: Duration::from_millis(diff --git a/rust/cymbal/src/stages/resolution/remote/dns.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/dns.rssimilarity index 100%rename from rust/cymbal/src/stages/resolution/remote/dns.rsrename to rust/cymbal/src/modes/processing/stages/resolution/remote/dns.rsdiff --git a/rust/cymbal/src/stages/resolution/remote/mod.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/mod.rssimilarity index 100%rename from rust/cymbal/src/stages/resolution/remote/mod.rsrename to rust/cymbal/src/modes/processing/stages/resolution/remote/mod.rsdiff --git a/rust/cymbal/src/stages/resolution/remote/mux.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/mux.rssimilarity index 100%rename from rust/cymbal/src/stages/resolution/remote/mux.rsrename to rust/cymbal/src/modes/processing/stages/resolution/remote/mux.rsdiff --git a/rust/cymbal/src/stages/resolution/remote/pool.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/pool.rssimilarity index 100%rename from rust/cymbal/src/stages/resolution/remote/pool.rsrename to rust/cymbal/src/modes/processing/stages/resolution/remote/pool.rsdiff --git a/rust/cymbal/src/stages/resolution/remote/resolver.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver.rssimilarity index 100%rename from rust/cymbal/src/stages/resolution/remote/resolver.rsrename to rust/cymbal/src/modes/processing/stages/resolution/remote/resolver.rsdiff --git a/rust/cymbal/src/stages/resolution/remote/resolver/chunk.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/chunk.rssimilarity index 100%rename from rust/cymbal/src/stages/resolution/remote/resolver/chunk.rsrename to rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/chunk.rsdiff --git a/rust/cymbal/src/stages/resolution/remote/resolver/partition.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/partition.rssimilarity index 100%rename from rust/cymbal/src/stages/resolution/remote/resolver/partition.rsrename to rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/partition.rsdiff --git a/rust/cymbal/src/stages/resolution/remote/resolver/retry.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/retry.rssimilarity index 100%rename from rust/cymbal/src/stages/resolution/remote/resolver/retry.rsrename to rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/retry.rsdiff --git a/rust/cymbal/src/stages/resolution/remote/subscription.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/subscription.rssimilarity index 100%rename from rust/cymbal/src/stages/resolution/remote/subscription.rsrename to rust/cymbal/src/modes/processing/stages/resolution/remote/subscription.rsdiff --git a/rust/cymbal/src/teams.rs b/rust/cymbal/src/modes/processing/teams.rssimilarity index 95%rename from rust/cymbal/src/teams.rsrename to rust/cymbal/src/modes/processing/teams.rsindex 7a98ece3498c..a1d80bbbb79e 100644--- a/rust/cymbal/src/teams.rs+++ b/rust/cymbal/src/modes/processing/teams.rs@@ -5,9 +5,12 @@ use moka::sync::{Cache, CacheBuilder};use tracing::warn;use crate::{- assignment_rules::AssignmentRule, config::Config, error::UnhandledError,- fingerprinting::grouping_rules::GroupingRule, metric_consts::ANCILLARY_CACHE,- spike_config::SpikeDetectionConfig, suppression_rules::SuppressionRule,+ error::UnhandledError, metric_consts::ANCILLARY_CACHE,+ modes::processing::config::ProcessingConfig,+ modes::processing::rules::assignment::AssignmentRule,+ modes::processing::rules::grouping::GroupingRule,+ modes::processing::rules::spike::SpikeDetectionConfig,+ modes::processing::rules::suppression::SuppressionRule,};#[derive(Clone)]@@ -21,7 +24,7 @@ pub struct TeamManager {}impl TeamManager {- pub fn new(config: &Config) -> Self {+ pub fn new(config: &ProcessingConfig) -> Self {let cache = CacheBuilder::new(config.max_team_cache_size).time_to_live(Duration::from_secs(config.team_cache_ttl_secs)).build();diff --git a/rust/cymbal/src/tokenizer.rs b/rust/cymbal/src/modes/processing/tokenizer.rssimilarity index 100%rename from rust/cymbal/src/tokenizer.rsrename to rust/cymbal/src/modes/processing/tokenizer.rsdiff --git a/rust/cymbal/src/types/batch.rs b/rust/cymbal/src/modes/processing/types/batch.rssimilarity index 98%rename from rust/cymbal/src/types/batch.rsrename to rust/cymbal/src/modes/processing/types/batch.rsindex 7d682a81ecf5..5bbcf4ae5669 100644--- a/rust/cymbal/src/types/batch.rs+++ b/rust/cymbal/src/modes/processing/types/batch.rs@@ -3,8 +3,8 @@ use std::{future::Future, sync::atomic::Ordering};use futures::{StreamExt, TryStreamExt};use crate::{- config::BATCH_APPLY_CONCURRENCY,error::UnhandledError,+ modes::processing::config::BATCH_APPLY_CONCURRENCY,types::{operator::Operator,stage::{Stage, StageResult},diff --git a/rust/cymbal/src/types/event.rs b/rust/cymbal/src/modes/processing/types/event.rssimilarity index 100%rename from rust/cymbal/src/types/event.rsrename to rust/cymbal/src/modes/processing/types/event.rsdiff --git a/rust/cymbal/src/types/exception_properties.rs b/rust/cymbal/src/modes/processing/types/exception_properties.rssimilarity index 100%rename from rust/cymbal/src/types/exception_properties.rsrename to rust/cymbal/src/modes/processing/types/exception_properties.rsdiff --git a/rust/cymbal/src/types/mod.rs b/rust/cymbal/src/modes/processing/types/mod.rssimilarity index 97%rename from rust/cymbal/src/types/mod.rsrename to rust/cymbal/src/modes/processing/types/mod.rsindex 704c6dbe7420..7dd9f3aefad2 100644--- a/rust/cymbal/src/types/mod.rs+++ b/rust/cymbal/src/modes/processing/types/mod.rs@@ -18,30 +18,15 @@ use crate::langs::native::DebugImage;use crate::metric_consts::POSTHOG_SDK_EXCEPTION_RESOLVED;use crate::tokenizer::CL100K_BPE;-mod exception;-mod stacktrace;-pub mod batch;pub mod event;pub mod exception_properties;pub mod operator;pub mod stage;-pub use exception::*;-pub use stacktrace::*;--#[derive(Debug, Deserialize, Serialize, Clone)]-pub struct Mechanism {- #[serde(skip_serializing_if = "Option::is_none")]- pub handled: Option<bool>,- #[serde(skip_serializing_if = "Option::is_none")]- #[serde(rename = "type")]- pub mechanism_type: Option<String>,- #[serde(skip_serializing_if = "Option::is_none")]- pub source: Option<String>,- #[serde(skip_serializing_if = "Option::is_none")]- pub synthetic: Option<bool>,-}+// Shared exception/stacktrace types live in core; re-exported here so the+// processing event model can keep referring to `crate::types::*`.+pub use crate::core::types::{Exception, Mechanism, Stacktrace};#[derive(Debug, Default, Clone, Serialize, Deserialize)]#[serde(transparent)]@@ -548,7 +533,7 @@ mod test {#[test]fn it_deserialises_error_props() {- let raw: &'static str = include_str!("../../tests/static/raw_ch_exception_list.json");+ let raw: &'static str = include_str!("../../../../tests/static/raw_ch_exception_list.json");let raw: ClickHouseEvent = serde_json::from_str(raw).unwrap();diff --git a/rust/cymbal/src/types/operator.rs b/rust/cymbal/src/modes/processing/types/operator.rssimilarity index 98%rename from rust/cymbal/src/types/operator.rsrename to rust/cymbal/src/modes/processing/types/operator.rsindex a44a9cef1f5f..00583278df35 100644--- a/rust/cymbal/src/types/operator.rs+++ b/rust/cymbal/src/modes/processing/types/operator.rs@@ -1,6 +1,6 @@use std::future::Future;-pub type TeamId = i32;+pub use crate::core::ids::TeamId;/// An Operator is a stateless function that can be applied in parallel to items in a batch.pub trait Operator {diff --git a/rust/cymbal/src/types/stage.rs b/rust/cymbal/src/modes/processing/types/stage.rssimilarity index 100%rename from rust/cymbal/src/types/stage.rsrename to rust/cymbal/src/modes/processing/types/stage.rsdiff --git a/rust/cymbal/src/modes/resolution/app_context.rs b/rust/cymbal/src/modes/resolution/app_context.rsindex 95fb17104ddd..a29f96861e61 100644--- a/rust/cymbal/src/modes/resolution/app_context.rs+++ b/rust/cymbal/src/modes/resolution/app_context.rs@@ -2,12 +2,13 @@ use std::sync::Arc;use tokio::sync::Semaphore;-use crate::app_context::build_symbol_resolver;-use crate::config::Config as CymbalConfig;+use crate::core::config::ResolverConfig;+use crate::core::resolver::build_symbol_resolver;use crate::error::UnhandledError;use crate::symbolication::symbol::SymbolResolver;use super::load_monitor::LoadMonitor;+use super::Config as ServiceConfig;/// Process-wide handles required to serve `cymbal.resolution.v1`.///@@ -24,14 +25,17 @@ pub struct ResolutionAppContext {}impl ResolutionAppContext {- pub async fn from_config(config: &CymbalConfig) -> Result<Self, UnhandledError> {- let symbol_resolver = build_symbol_resolver(config).await?;- // Symbol-resolution concurrency is the shared knob on the parent config.- let symbol_resolution_limiter =- Arc::new(Semaphore::new(config.symbol_resolution_concurrency.max(1)));- let load_monitor = LoadMonitor::new(config.resolution.max_item_concurrency.max(1) as u32);- let service_instance_id = config- .resolution+ pub async fn from_config(+ resolver: &ResolverConfig,+ service: &ServiceConfig,+ ) -> Result<Self, UnhandledError> {+ let symbol_resolver = build_symbol_resolver(resolver).await?;+ // Symbol-resolution concurrency is the shared knob on the resolver config.+ let symbol_resolution_limiter = Arc::new(Semaphore::new(+ resolver.symbol_resolution_concurrency.max(1),+ ));+ let load_monitor = LoadMonitor::new(service.max_item_concurrency.max(1) as u32);+ let service_instance_id = service.service_instance_id.clone().unwrap_or_else(|| uuid::Uuid::now_v7().to_string());diff --git a/rust/cymbal/src/modes/resolution/config.rs b/rust/cymbal/src/modes/resolution/config.rsindex 42f3290fb781..44e26af6de67 100644--- a/rust/cymbal/src/modes/resolution/config.rs+++ b/rust/cymbal/src/modes/resolution/config.rs@@ -1,11 +1,38 @@use std::net::SocketAddr;+use common_continuous_profiling::ContinuousProfilingConfig;use envconfig::Envconfig;-/// Resolution-mode config, nested into [`crate::config::Config`] via-/// `#[envconfig(nested = true)]`. Two knobs shared with processing mode live on-/// the parent config instead and are read from there: `INTERNAL_API_SECRET` and-/// `SYMBOL_RESOLUTION_CONCURRENCY`.+use crate::core::config::ResolverConfig;++/// Top-level config for resolution mode. Owns the shared resolver config and the+/// resolution service settings — no processing-only knobs. `INTERNAL_API_SECRET`+/// and `SYMBOL_RESOLUTION_CONCURRENCY` come from the nested `resolver`.+#[derive(Envconfig, Clone)]+pub struct ResolutionConfig {+ #[envconfig(nested = true)]+ pub resolver: ResolverConfig,++ #[envconfig(nested = true)]+ pub service: Config,++ #[envconfig(nested = true)]+ pub continuous_profiling: ContinuousProfilingConfig,++ pub posthog_api_key: Option<String>,++ #[envconfig(default = "https://us.i.posthog.com/capture")]+ pub posthog_endpoint: String,+}++impl ResolutionConfig {+ pub fn init_with_defaults() -> Result<Self, envconfig::Error> {+ Self::init_from_env()+ }+}++/// Resolution service settings (gRPC bind, metrics, concurrency, subscribe+/// cadence). Nested into [`ResolutionConfig`].#[derive(Envconfig, Clone)]pub struct Config {/// gRPC bind address for the cymbal.resolution.v1 server.diff --git a/rust/cymbal/src/modes/resolution/mod.rs b/rust/cymbal/src/modes/resolution/mod.rsindex 5d9ea06d5178..9ee6eeab9975 100644--- a/rust/cymbal/src/modes/resolution/mod.rs+++ b/rust/cymbal/src/modes/resolution/mod.rs@@ -18,7 +18,7 @@ use tokio::task::JoinHandle;use tonic::transport::Server;use tracing::{info, warn};-use crate::config::Config as CymbalConfig;+use crate::core::config::ResolverConfig;pub mod app_context;pub mod auth;@@ -26,7 +26,7 @@ pub mod config;pub mod load_monitor;pub mod service;-pub use config::Config;+pub use config::{Config, ResolutionConfig};use app_context::ResolutionAppContext;use auth::InternalApiSecretInterceptor;@@ -35,15 +35,19 @@ use service::{CymbalResolutionService, ServiceConfig};/// Boot the gRPC resolution service plus its metrics/health server and run/// until shutdown. The `internal_api_secret` and symbol-resolution concurrency-/// are read from shared cymbal config; everything else from `config.resolution`.-pub async fn serve(config: &CymbalConfig) -> Result<(), Box<dyn std::error::Error>> {- let res = &config.resolution;+/// come from the shared resolver config; everything else from the resolution+/// service config.+pub async fn serve(+ resolver: &ResolverConfig,+ service: &Config,+) -> Result<(), Box<dyn std::error::Error>> {+ let res = service;info!("Starting cymbal-resolution service");info!("gRPC address: {}", res.grpc_address);info!("Metrics port: {}", res.metrics_port);info!("Max concurrent requests: {}", res.max_concurrent_requests);- let app_context = ResolutionAppContext::from_config(config).await?;+ let app_context = ResolutionAppContext::from_config(resolver, service).await?;let (shutdown_tx, shutdown_rx) = watch::channel(false);let draining = Arc::new(AtomicBool::new(false));@@ -66,7 +70,7 @@ pub async fn serve(config: &CymbalConfig) -> Result<(), Box<dyn std::error::Erroservice_config,draining,);- let auth_interceptor = InternalApiSecretInterceptor::new(config.internal_api_secret.clone());+ let auth_interceptor = InternalApiSecretInterceptor::new(resolver.internal_api_secret.clone());let listener = tokio::net::TcpListener::bind(res.grpc_address).await?;let incoming = tracked_tcp_incoming(listener);diff --git a/rust/cymbal/src/test_utils.rs b/rust/cymbal/src/test_utils.rsindex dcde023ea21b..4c8a86f987cb 100644--- a/rust/cymbal/src/test_utils.rs+++ b/rust/cymbal/src/test_utils.rs@@ -10,7 +10,7 @@ use mockall::mock;use sqlx::PgPool;use crate::{- app_context::AppContext, config::Config, error::UnhandledError,+ app_context::AppContext, error::UnhandledError, modes::processing::config::ProcessingConfig,symbolication::symbol_store::BlobClient,};@@ -27,10 +27,13 @@ mock! {}pub async fn create_test_context(db: PgPool) -> Arc<AppContext> {- create_test_context_with_config(db, Config::init_with_defaults().unwrap()).await+ create_test_context_with_config(db, ProcessingConfig::init_with_defaults().unwrap()).await}-pub async fn create_test_context_with_config(db: PgPool, config: Config) -> Arc<AppContext> {+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);@@ -48,14 +51,18 @@ 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, Config::init_with_defaults().unwrap())- .await+ 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: Config,+ config: ProcessingConfig,) -> Arc<AppContext> {let issue_buckets_redis_client = Arc::new(MockRedisClient::new());diff --git a/rust/cymbal/tests/assignment_rules.rs b/rust/cymbal/tests/assignment_rules.rsindex 5a420cff279c..c8eff05e625b 100644--- a/rust/cymbal/tests/assignment_rules.rs+++ b/rust/cymbal/tests/assignment_rules.rs@@ -2,10 +2,10 @@ use std::collections::HashMap;use chrono::Utc;use cymbal::{- assignment_rules::{AssignmentRule, NewAssignment},- config::Config,fingerprinting::Fingerprint,issue_resolution::{process_assignment, Issue, IssueStatus},+ modes::processing::rules::assignment::{AssignmentRule, NewAssignment},+ modes::processing::ProcessingConfig,teams::TeamManager,types::{ExceptionList, FingerprintedErrProps},};@@ -77,7 +77,7 @@ fn test_issue() -> Issue {#[sqlx::test(migrations = "./tests/test_migrations")]async fn test_assignment_processing(db: PgPool) {- let config = Config::init_with_defaults().unwrap();+ let config = ProcessingConfig::init_with_defaults().unwrap();let fingerprint = test_fingerprint();let test_team_id = 1;diff --git a/rust/cymbal/tests/event.rs b/rust/cymbal/tests/event.rsindex d6730ff95ab3..13a348d70b49 100644--- a/rust/cymbal/tests/event.rs+++ b/rust/cymbal/tests/event.rs@@ -211,7 +211,7 @@ impl TestHarness {config.remote_resolution_enabled = true;config.remote_resolution_host = "127.0.0.1".to_string();config.remote_resolution_port = addr.port();- config.internal_api_secret = "test-secret".to_string();+ config.resolver.internal_api_secret = "test-secret".to_string();// Snapshot-required routing: give the pool a small retry// budget with fast backoff so the first Subscribe tick can// populate the load snapshot before we give up.diff --git a/rust/cymbal/tests/posthog_capture.rs b/rust/cymbal/tests/posthog_capture.rsindex 58879fd96fe1..7810f44bf812 100644--- a/rust/cymbal/tests/posthog_capture.rs+++ b/rust/cymbal/tests/posthog_capture.rs@@ -3,7 +3,7 @@ use std::time::Duration;use axum::{body::Body, http::Request};use common_redis::MockRedisClient;-use cymbal::{app_context::AppContext, config::Config, router::get_router};+use cymbal::{app_context::AppContext, modes::processing::ProcessingConfig, router::get_router};use httpmock::prelude::*;use mockall::predicate;use serde_json::json;@@ -45,8 +45,8 @@ async fn pipeline_failure_is_captured_as_posthog_exception(db: PgPool) {.await.expect("posthog init");- let mut config = Config::init_with_defaults().unwrap();- config.object_storage_bucket = STORAGE_BUCKET.to_string();+ let mut config = ProcessingConfig::init_with_defaults().unwrap();+ config.resolver.object_storage_bucket = STORAGE_BUCKET.to_string();let mut s3_client = MockS3Client::new();s3_clientdiff --git a/rust/cymbal/tests/resolve.rs b/rust/cymbal/tests/resolve.rsindex a0995b156c26..418e19a440aa 100644--- a/rust/cymbal/tests/resolve.rs+++ b/rust/cymbal/tests/resolve.rs@@ -3,9 +3,10 @@ use std::sync::Arc;use async_trait::async_trait;use common_types::ClickHouseEvent;+use cymbal::symbolication::resolve::Resolve;use cymbal::{- config::Config,frames::{Frame, RawFrame},+ modes::processing::ProcessingConfig,symbolication::symbol_store::{apple::AppleProvider,caching::{Caching, SymbolSetCache},@@ -110,12 +111,12 @@ async fn end_to_end_resolver_test() {frame.source_url = Some(server.url(CHUNK_PATH).to_string());}- let mut config = Config::init_with_defaults().unwrap();- config.allow_internal_ips = true; // We're hitting localhost for the tests+ let mut config = ProcessingConfig::init_with_defaults().unwrap();+ config.resolver.allow_internal_ips = true; // We're hitting localhost for the tests- let sourcemap = SourcemapProvider::new(&config);+ let sourcemap = SourcemapProvider::new(&config.resolver);let cache = Arc::new(Mutex::new(SymbolSetCache::new(- config.symbol_store_cache_max_bytes,+ config.resolver.symbol_store_cache_max_bytes,)));let wrapped = NoOpChunkIdFetcher { inner: sourcemap };@@ -137,7 +138,7 @@ async fn end_to_end_resolver_test() {for frame in test_stack {resolved_frames.push(frame- .resolve(exception.team_id, &catalog, &[])+ .resolve(exception.team_id, &catalog, &[], 15).await.unwrap(),);@@ -169,7 +170,7 @@ async fn sourcemap_nulls_dont_go_on_frames() {.lookup(SourcePosition::new(location.line - 1, location.column)).unwrap();- let res = Frame::from((&frame, token));+ let res = Frame::from((&frame, token, 15));assert!(!res.source.unwrap().contains('\0'));}diff --git a/rust/cymbal/tests/suppression_rules.rs b/rust/cymbal/tests/suppression_rules.rsindex 5573a7bd0d81..4cfbcbb4459f 100644--- a/rust/cymbal/tests/suppression_rules.rs+++ b/rust/cymbal/tests/suppression_rules.rs@@ -1,4 +1,7 @@-use cymbal::{config::Config, suppression_rules::SuppressionRule, teams::TeamManager};+use cymbal::{+ modes::processing::rules::suppression::SuppressionRule, modes::processing::ProcessingConfig,+ teams::TeamManager,+};use serde_json::{json, Value as JsonValue};use sqlx::{PgPool, Row};use uuid::Uuid;@@ -113,7 +116,7 @@ async fn test_suppression_rule_disable(db: PgPool) {#[sqlx::test(migrations = "./tests/test_migrations")]async fn test_suppression_rule_cache(db: PgPool) {- let config = Config::init_with_defaults().unwrap();+ let config = ProcessingConfig::init_with_defaults().unwrap();let team_manager = TeamManager::new(&config);let team_id = 1;diff --git a/rust/cymbal/tests/utils.rs b/rust/cymbal/tests/utils.rsindex e11c5357f82d..cbf3a008edfb 100644--- a/rust/cymbal/tests/utils.rs+++ b/rust/cymbal/tests/utils.rs@@ -5,8 +5,8 @@ use axum::{body::Body, http::Request};use bytes::Bytes;use common_redis::MockRedisClient;use cymbal::{- app_context::AppContext, config::Config, error::UnhandledError, router::get_router,- symbolication::symbol_store::BlobClient,+ app_context::AppContext, error::UnhandledError, modes::processing::ProcessingConfig,+ router::get_router, symbolication::symbol_store::BlobClient,};use async_trait::async_trait;@@ -45,10 +45,10 @@ pub(crate) async fn get_response_with_config<T: for<'de> Deserialize<'de>>(storage_bucket: String,request_factory: impl Fn() -> Request<Body>,s3_client: Arc<MockS3Client>,- configure: impl FnOnce(&mut Config),+ configure: impl FnOnce(&mut ProcessingConfig),) -> (StatusCode, T) {- let mut config = Config::init_with_defaults().unwrap();- config.object_storage_bucket = storage_bucket.clone();+ let mut config = ProcessingConfig::init_with_defaults().unwrap();+ config.resolver.object_storage_bucket = storage_bucket.clone();configure(&mut config);let issue_buckets_redis_client = Arc::new(MockRedisClient::new());@@ -82,8 +82,8 @@ pub(crate) async fn get_raw_response(request_factory: impl Fn() -> Request<Body>,s3_client: Arc<MockS3Client>,) -> (StatusCode, String) {- let mut config = Config::init_with_defaults().unwrap();- config.object_storage_bucket = storage_bucket.clone();+ let mut config = ProcessingConfig::init_with_defaults().unwrap();+ config.resolver.object_storage_bucket = storage_bucket.clone();let issue_buckets_redis_client = Arc::new(MockRedisClient::new());