mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 16:09:05 +00:00
## Summary Removes all `crate::handler::*` dependencies from `src/service` and `src/common`, in preparation for splitting the codebase into separate crates. Code that both layers need is moved down into `common`/`service`, and the old handler locations keep `pub use` re-exports so call sites stay unchanged. After this PR, `src/service` and `src/common` contain zero references to `crate::handler`. ## Move map | Item | Old location (now a re-export) | New location | |---|---|---| | `MetadataMap` (OTel extractor) | `handler/grpc/mod.rs` | `common/meta/grpc.rs` (new) | | `CONTENT_TYPE_JSON` / `CONTENT_TYPE_PROTO` | `handler/http/request/mod.rs` | `common/meta/http.rs` | | `ERROR_HEADER` | `handler/http/router/mod.rs` | `common/meta/http.rs` | | `get_user_email_from_auth_str` / `get_user_details` | `handler/http/auth/validator.rs` | `common/utils/auth.rs` | | `get_user_name_from_token` | `handler/http/auth/token.rs` | `common/utils/jwt.rs` | | `check_permissions` / `list_objects_for_user` | `handler/http/auth/validator.rs` | `service/authz.rs` (new) | | `map_error_to_http_response` | `handler/http/request/search/error_utils.rs` | `service/http.rs` (new) | | `Searcher` | `handler/grpc/request/search/mod.rs` | `service/search/searcher.rs` (new) | | `get_cluster_metrics` / `get_peak_memory_from_ctx` | `handler/grpc/flight/visitor.rs` | `service/search/datafusion/plan_metrics.rs` (new) | | `GetOrgUsageResponseBody` / `OrgUserData` | `handler/http/models/billings.rs` | `service/org_usage.rs` | | `CreateAnomalyConfigRequest` / `UpdateAnomalyConfigRequest` | `handler/http/request/anomaly_detection/mod.rs` | `service/anomaly_detection.rs` | | `BackfillRequest` | `handler/http/request/pipelines/backfill.rs` | `service/alerts/backfill.rs` | | LLM schema-compat constants | `handler/http/request/traces/schema_compat.rs` | `service/traces/schema_compat.rs` (new) | ## Notes - Pure code movement; no functional changes intended. Two incidental cleanups: `strip_prefix(...).unwrap()` replaced with `?` in the moved auth helpers (removes panic paths), and `list_objects_for_user` now returns `anyhow::Result` instead of `AuthError` (call sites still respond 403; only the error message text loses the `Forbidden:` prefix). - Existing unit tests moved along with the code (`Searcher`, `error_utils`, `visitor`). - `common/utils/auth.rs` now calls `service::authz` instead of `handler::...::validator` — `common → service` dependencies already existed, so this doesn't add a new layering edge. --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>