Commit Graph
599 Commits
Author SHA1 Message Date
udev da2a769762 feat: Add HTTP2 Streaming support (#6721) (#6827) 2025-05-20 00:06:05 +08:00
Hengfei Yang ca69ce0118 fix: alert can't query latest data for separate alert query (#6831)
- [x] fix: alert can't query latest data for separate alert query
- [x] feat: add size limit for download from other nodes
- [x] fix: use real time id generator
2025-05-19 19:29:12 +08:00
Subhra264andsai nikhil kethe 330cf14ec0 fix: ZO_DEFAULT_MAX_QUERY_RANGE_DAYS env should be returned by streams list api (#6762)
Fixes #6753

---------

Co-authored-by: sai nikhil kethe <nikhil@openobserve.ai>
2025-05-09 14:22:58 +05:30
Taiming Liu 371d055a14 feat: deployment type value in o2 telemetry (#6737) 2025-05-07 18:24:10 +08:00
Taiming LiuandHengfei Yang e567f7c3a1 fix: cache miss after NATs restarts (#6726)
Refreshing in-memory cache in such NATs event trigger by NATs client's
callback closure.

---------

Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>
2025-05-06 19:33:31 -07:00
Hengfei Yang b9048cff3e fix: delete whole month by mistake (#6734) 2025-05-06 22:40:57 +08:00
40f932198a feat: separate out ddl client and commands (#6675)
fixes https://github.com/openobserve/openobserve/issues/6621

This separates the functions which execute ddl statements, and only runs
them if certain entry in meta is mis-matching with what we have in our
code. Introduces a new env var `ZO_META_DDL_DSN` , which is optional and
falls back to the original DSN if not specified. Added a new client to
Postgres and Mysql both which uses this DDL DSN, and that is used only
for the ddl statements.

Also added another command to cli `upgrade-db` which runs the db
initialization functions.

For sqlite, there is no change, as it does not have concept of users.

Primarily tested on Postgres to validate that the behavior with
read-write and admin users is as expected.

`DB_SCHEMA_VERSION` is hardcoded in code, and devs are expected to
manually uptick it everytime we do any changes to db schema, similar to
how we maintain ofga.

---------

Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>
Co-authored-by: Yashodhan Joshi <yjdoc2@gmail.com>
Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>
2025-05-01 16:56:37 +05:30
Hengfei Yang 169b92ee41 feat: report cluster_coordinator (#6672) 2025-04-28 20:41:41 +08:00
Ashish Kolhe 1f47ac2614 fix: base64 encode cookies (#6596)
fixes : [6564](https://github.com/openobserve/openobserve/issues/6564)
2025-04-28 18:08:48 +05:30
Taiming Liuandsai nikhil kethe c19b649da1 feat: delay for scheduled pipelines (#6616)
Co-authored-by: sai nikhil kethe <nikhil@openobserve.ai>
2025-04-24 22:30:34 -07:00
Loakesh Indiran 5a695cc1f5 fix: lock handling (#6624)
- [x] better lock handling at router
- [x] send `CancelResponse` if search task errors out due to `search
query cancelled`
- [x] optimize `remove_querier_connection` at router `SessionManager`
2025-04-24 06:34:06 +05:30
Loakesh Indiran a2396e308f fix: ws remove locks from querier (#6623)
- [x] remove `WS_SEARCH_REGISTRY`
2025-04-23 18:17:28 +05:30
Loakesh Indiran c2b14cc8d1 fix: refactor audit_msg (#6568)
- [x] unify `AuditMessage` across ws/http
2025-04-17 21:18:51 +05:30
Sai NikhilandSubhradeep Chakraborty a5716d88e0 feat: bulk move and export dashboard (#6507)
1. this PR implements bulk move and export dashboards

---------

Co-authored-by: Subhradeep Chakraborty <chakrabortysubhradeep556@gmail.com>
2025-04-16 22:21:05 +05:30
Hengfei Yang 0f864aab47 feat: add keepalive for scheduler_jobs (#6554) 2025-04-16 19:29:25 +08:00
Zhao.weiandhengfei yang 576125e9a6 feat: search inspector (#6508)
Co-authored-by: hengfei yang <hengfei.yang@gmail.com>
2025-04-16 18:51:00 +08:00
Loakesh Indiran 9b8b75c5c7 feat: add mini search partitions (#6494)
# Mini Partitions for Faster Initial Search Results

## Summary of Changes
This PR introduces "mini partitions" to improve user experience for
search queries by providing faster initial results, especially for large
time range queries.

## Old Partition Logic
- Created partitions of roughly equal size based on time range and data
volume
- Optimized for balanced workload distribution across processing nodes
- Users had to wait until a full partition was processed before seeing
any results
- For large time ranges (e.g., 7 days), the first result could take long
time to appear

## New Partition Logic
- Creates small "mini partitions" at the beginning of the time range
- Followed by regular-sized partitions for the remaining time range
- Preserves all the original constraints and optimizations for regular
partitions
- Users see initial results within seconds, even for large time range
queries

## New Env
```sh
ZO_MINI_SEARCH_PARTITION_DURATION_SECS: Duration of each mini partition in seconds (default: 60)
```
2025-04-15 08:17:15 +05:30
Hengfei Yang 3ba66e5f0b feat: add ZO_INGEST_ALLOWED_IN_FUTURE (#6544)
Now we have two ENV for control ingestion time:

- ZO_INGEST_ALLOWED_UPTO: old than x hours will discard
- ZO_INGEST_ALLOWED_IN_FUTURE: future than x hours will discard

```
ZO_INGEST_ALLOWED_UPTO=5
ZO_INGEST_ALLOWED_IN_FUTURE=24
```
Default is `5` hours and `24` hours.
2025-04-14 10:59:42 -07:00
Hengfei Yang a2dfb20f9c fix: trace_id for search (#6533) 2025-04-14 22:56:25 +08:00
Hengfei Yang 00e93c126f feat: add query parquet cache metrics (#6526) 2025-04-14 11:38:35 +08:00
Zhao.wei 1a7e379fea feat: check s3 config (#6514) 2025-04-11 19:10:41 +08:00
Ashish Kolheandloaki07 26fbc61d65 fix: read and write locks (#6512)
- [x] ws v2 to use tokio `RwHashMap` instead of `Dashmap` to avoid dead
locks
- [x] `trace_id` when retry to be different after the first retry to get
a different querier from consistent hash
- [x] `user_id` for enterprise search event when run as single node

---------

Co-authored-by: loaki07 <rustyloaki@gmail.com>
2025-04-11 07:48:41 +05:30
Loakesh Indiranandomkark06 471c0c88b3 fix: ws fixes (#6504)
- [x] `Router-Client` if sending `pong` from `router` fails force close
the ws connection
- [ ] `Router-Querier` conn if `pong` is not received from querier for
certain time (ping_interval + 10 secs) then force close the connection
- [x] ws behavior should be such that if one querier disconnects from
the connection pool the entire `Router-Client` connection should not be
disconnected, searches/events should continue with other queriers in the
pool. Also, if one of the querier disconnects send `should_client_retry`
as `true`

---------

Co-authored-by: omkark06 <omkar@zinclabs.io>
2025-04-10 19:48:08 +05:30
Loakesh Indiran b598735a48 fix: ws Router-Querier conn reset & remove ws v1 (#6499)
- [x] add `jitter` to `ping_interval` for heartbeats
- [x] deprecate `is_connected` in `Connection` trait
- [x] remove `maintain_connection`, instead the `health_check` tokio
tasks for each querier will do the similar functionality by manual heart
beats
- [x] add `clean_up` for `QuerrierConnectionPool` & `QuerierConnection`
with graceful shutdown
- [x] use `ZO_INSTANCE_NAME` as the `req_id` for the connection between
the `Rotuer-Querier`
- [x] remove ws v1
2025-04-09 15:04:48 -07:00
Subhra264 9f8647c59d fix: rbac migration for service accounts for existing organizations (#6462)
When introducing service accounts rbac, we didn't do a rbac openfga
migration to save openfga tuples (`_all_{org_id}`) for existing
organizations. Hence as a result, viewer and editor are not able to
view/edit service accounts by default. Currently, they can do it only
after given service accounts explicitly through the roles edit UI page.

This pr fixes this by adding a migration which saves `_all_{org_id}`
tuples for every organizations.
2025-04-07 10:34:41 +05:30
Hengfei Yang 83a3fcb7f6 fix: improve tokio task consume (#6474)
## What is changed

- [x] Try to improve task starving issue
- [x] Update mmdb frequency
- [x] Improve slow log detection

## MMDB
- Removed ENV `ZO_MMDB_UPDATE_DURATION` because is in seconds
- Add new ENV `ZO_MMDB_UPDATE_DURATION_DAYS` is in days

## Tokio task

We try to use `task::coop` to improve task starving issue in Tokio.
<img width="1496" alt="image"
src="https://github.com/user-attachments/assets/1666488a-146b-49d7-b460-c629528e06f9"
/>
The second chart is for this PR, it is a big slow but more stable.
2025-04-07 12:03:56 +08:00
Zhao.wei 871805a32c feat: impl ratelimit feature (#6072) 2025-04-03 23:47:18 +08:00
Hengfei Yang dcb117498c perf: optimize tantivy generate (#6452)
This PR has some improves:
- Improve tantivy generate, from 7.7s -> 5.9s
- Improve STREAM_SETTINGS cache with atomic
- Add process metrics
- Remove zo_node_open_fd, node_tcp_conn_resets( use
`node_tcp_connections{state="resets"}`)
- Add debug logs for bulk api
- Add debug logs for tantivy panic
2025-04-02 09:40:06 -07:00
Hengfei Yang 99f9d880b2 feat: add meta_store to report (#6445) 2025-04-01 22:00:04 +08:00
udev 12764bfb1d feat: cluster info api (#6435)
This API will return cluster specific information. This iteration will
report the pending compaction jobs in this format.
```
{
	"regions": {
		"openobserve": {
			"zo1": {
				"pending_jobs": 0
			}
		}
	}
}
```
API supports filtering by region.
2025-04-01 12:39:12 +05:30
Hengfei Yang 871f954fe2 feat: add new ENV to set token for root user (#6438) 2025-04-01 12:27:11 +08:00
Ashish KolheandSubhra264 5f9f304379 fix: improve error handling (#6432)
Co-authored-by: Subhra264 <chakrabortysubhradeep556@gmail.com>
2025-03-31 18:13:31 +05:30
Hengfei Yang 0c890145c5 fix: let the scheduled only work for ingestion (#6422)
The ingester will still can be search when it set to unscheduled
2025-03-28 23:50:27 +08:00
Ashish Kolhe e9b13ee424 fix: service account search range restriction (#6409) 2025-03-27 08:34:11 +05:30
+2 8cd0683a0b feat: ws v2 (#6404)
# WebSocket v2 Architecture

## NOTE: Open Issues:
- [ ] `session_drain` from server is experimental and not ready for
prod. Instead, the client maintains ongoing `trace_id`'s and when cookie
expires it will retry search for all the ongoing searches.

## Overview
Implements websocket v2 with the main goal to establish `Client-Router`
connections `per tab` and `Router-Querier` `persistent` connections.

## New Env (Default):
```sh
ZO_WEBSOCKET_CHECK_COOKIE_EXPIRY=true
ZO_WEBSOCKET_HEALTH_CHECK_INTERVAL_SECS=60
ZO_WEBSOCKET_IS_SESSION_DRAIN_ENABLED=false # This is experimental, not meant for prod
```

## High-Level Flow

1. Client establishes WebSocket connection with the router.  
2. Router creates a session.  
3. Router maintains persistent connections to all queriers.  
4. Client requests are routed to the appropriate querier using
consistent hashing.
5. Responses are routed back using `trace_id` mappings.  
6. Health checks maintain connection validity.  
7. Failed connections trigger automatic cleanup and reconnection.  
8. **Internal Communication Validation Using:**  
   - **8a.** Internal gRPC tokens  
   - **8b.** IP validation  
   - **8c.** WebSocket upgrade headers  

## Connection Lifecycle
```mermaid
sequenceDiagram
    participant Client
    participant Router
    participant ConnectionPool
    participant QuerierConn
    participant Querier
    participant Cluster

    Client->>Router: WS Connection Request
    Router->>SessionManager: register_client(client_id)
    
    Note over Router,SessionManager: Creates channels:<br/>response_tx/rx<br/>disconnect_tx/rx

    par Handle Incoming Messages
        Router->>Router: spawn handle_incoming task
    and Handle Outgoing Messages
        Router->>Router: spawn handle_outgoing task
    end

    Client->>Router: WS Client Event
    Router->>SessionManager: get_querier_for_trace(trace_id)
    
    alt No Existing Mapping
        Router->>Cluster: get_node_from_consistent_hash(trace_id)
        Router->>ConnectionPool: get_or_create_connection(querier)
        
        alt No Existing Connection
            ConnectionPool->>QuerierConn: create_connection
            QuerierConn->>Querier: WS Connection Request
            
            par Connection Tasks
                QuerierConn->>QuerierConn: spawn listen_to_querier_response
                QuerierConn->>QuerierConn: spawn health_check
            end
            
            Querier-->>QuerierConn: Connection Established
        end
        
        Router->>SessionManager: set_querier_for_trace(trace_id, querier)
    end

    Router->>QuerierConn: register_request(trace_id)
    Router->>QuerierConn: send_message(event)
    Querier-->>QuerierConn: Response
    QuerierConn->>Router: Route Response via response_tx
    Router->>Client: Forward Response

    Note over Router,Client: On Disconnect/Error:<br/>1. Send disconnect signal<br/>2. Clean up sessions<br/>3. Drain if needed
```

## Connections
```mermaid
graph TB
    subgraph "Client Layer"
        UI1[UI Client 1]
        UI2[UI Client 2]
        UI3[UI Client 3]
    end

    subgraph "Router Layer"
        R1[Router 1]
        R2[Router 2]
        
        subgraph "Router 1 Connection Pool"
            CP1[Connection Pool]
            QC11[Querier1 Conn]
            QC12[Querier2 Conn]
            QC13[Querier3 Conn]
            CP1 --- QC11
            CP1 --- QC12
            CP1 --- QC13
        end
        
        subgraph "Router 2 Connection Pool"
            CP2[Connection Pool]
            QC21[Querier1 Conn]
            QC22[Querier2 Conn]
            QC23[Querier3 Conn]
            CP2 --- QC21
            CP2 --- QC22
            CP2 --- QC23
        end
        
        R1 --- CP1
        R2 --- CP2
    end

    subgraph "Querier Layer"
        Q1[Querier 1]
        Q2[Querier 2]
        Q3[Querier 3]
    end

    UI1 -.->|WS| R1
    UI2 -.->|WS| R1
    UI3 -.->|WS| R2

    QC11 ===|Persistent WS| Q1
    QC12 ===|Persistent WS| Q2
    QC13 ===|Persistent WS| Q3
    QC21 ===|Persistent WS| Q1
    QC22 ===|Persistent WS| Q2
    QC23 ===|Persistent WS| Q3

    classDef client fill:#f9f,stroke:#333,stroke-width:2px
    classDef router fill:#bbf,stroke:#333,stroke-width:2px
    classDef querier fill:#bfb,stroke:#333,stroke-width:2px
    classDef pool fill:#ffd,stroke:#333,stroke-width:2px
    
    class UI1,UI2,UI3 client
    class R1,R2 router
    class Q1,Q2,Q3 querier
    class CP1,CP2 pool
```

## Components
```mermaid
classDiagram
    class WsHandler {
        +session_manager: Arc<SessionManager>
        +connection_pool: Arc<QuerierConnectionPool>
        +handle_connection()
        +remove_querier_connection()
        +_shutdown()
    }

    class SessionManager {
        +sessions: RwAHashMap<ClientId, SessionInfo>
        +mapped_queriers: RwAHashMap<QuerierName, HashSet<TraceId>>
        +register_client()
        +update_session_activity()
        +remove_trace_id()
        +unregister_client()
        +set_querier_for_trace()
        +get_querier_for_trace()
    }

    class QuerierConnectionPool {
        +connections: RwAHashMap<QuerierName, Arc<QuerierConnection>>
        +get_or_create_connection()
        +remove_querier_connection()
        +maintain_connections()
        +get_active_connection()
    }

    class QuerierConnection {
        +querier_name: QuerierName
        +write: Arc<Mutex<Option<SplitSink>>>
        +response_router: Arc<ResponseRouter>
        +is_connected: Arc<AtomicBool>
        +connect()
        +disconnect()
        +send_message()
        +register_request()
        +unregister_request()
    }

    class ResponseRouter {
        +routes: RwAHashMap<TraceId, Sender<WsServerEvents>>
        +route_response()
        +flush()
        +spawn_cleanup_task()
    }

    WsHandler --> SessionManager
    WsHandler --> QuerierConnectionPool
    QuerierConnectionPool --> QuerierConnection
    QuerierConnection --> ResponseRouter
```


Related Issues: #6396

---------

Co-authored-by: Taiming Liu <liutaiming3@gmail.com>
Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>
Co-authored-by: Abhay Padamani <141122205+ktx-abhay@users.noreply.github.com>
Co-authored-by: Ashish Kolhe <35160958+oasisk@users.noreply.github.com>
Co-authored-by: udev <uddhav@openobserve.ai>
Co-authored-by: omkark06 <omkar@zinclabs.io>
Co-authored-by: ktx-abhay <abhay.padamani@kiara.tech>
Co-authored-by: Omkar Kesarkhane <127078473+omkarK06@users.noreply.github.com>
Co-authored-by: udev <uddhavdave1@gmail.com>
Co-authored-by: Subhra264 <chakrabortysubhradeep556@gmail.com>
Co-authored-by: ktx-vaidehi <134508096+ktx-vaidehi@users.noreply.github.com>
2025-03-26 11:43:40 -07:00
Hengfei Yang afedd1907e fix: duplicated env for enrichment table (#6384) 2025-03-25 15:30:44 +08:00
c3759a4231 fix: Migration for scheduled_jobs table to use alert id as module_key (#6365)
Co-authored-by: udev <uddhavdave1@gmail.com>
Co-authored-by: sai nikhil kethe <nikhil@openobserve.ai>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2025-03-24 15:10:44 +05:30
udev 9f7521c74f fix: Actions bugs (#6367)
rename token env and disallow changing execution type
2025-03-23 23:47:16 +05:30
Hengfei Yang 2c039bfbb9 feat: support db replicas (#6358) 2025-03-21 20:19:33 +08:00
Subhra264 6926f67e08 fix: alert move rbac issues (#6352)
- Fixes 403 error when alert move api is called
- 403 error when trying to create alert in default folder even after
having permission
- Fixes # Regular user without `GET` user permission should not be able
to get list of all users
2025-03-21 00:19:00 +05:30
Subhra264 caf798e5c2 fix: Alert folder rbac migration issues (#6338) 2025-03-20 11:48:47 +05:30
Hengfei Yang f3fe0d4ba9 fix: ofga version compare (#6339) 2025-03-20 00:37:28 +08:00
Hengfei Yang 3f215526f2 fix: ofga for enterprise build (#6337) 2025-03-19 22:08:40 +08:00
Hengfei Yang 9f33b16feb fix: histogram stream sync (#6316)
fixed #6315
2025-03-19 19:30:10 +08:00
57df492b62 fix: alert v2 cache (#6302)
- Added trigger conditions in list alerts response
- RBAC for alert folders, and RBAC migration for existing alerts

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Subhradeep Chakraborty <chakrabortysubhradeep556@gmail.com>
Co-authored-by: hengfei yang <hengfei.yang@gmail.com>
2025-03-19 12:02:24 +05:30
Subhra264 bcd5bf30ce fix: remove semaphore in alert manager (#6295)
- Fixes #6289 
- Also, Removes use of semaphore inside the scheduler. Currently it only
uses the mpsc channel and waits if the mpsc channel is full. Apart from
this, it uses db locks in postgres and mysql when pulling
scheduled_jobs.
2025-03-18 23:04:33 +05:30
Hengfei Yang ef90217770 perf: add auto check if we can remove filter (#6283) 2025-03-17 23:57:49 +08:00
Loakesh Indiran 26feda0628 feat: add zo_node_open_fds & zo_node_tcp_conn_resets metrics (#6267)
- add `zo_node_open_fds` & `zo_node_tcp_conn_resets` to node metrics
2025-03-15 09:47:05 +05:30
udev 2cc9e5094e feat: report node config over super cluster (#6237) 2025-03-12 17:34:50 +08:00
Hengfei Yang 19d654eb7d feat: add node version (#6224)
Add node version to node list via heartbeat.
2025-03-10 16:46:38 +08:00