Commit Graph
85 Commits
Author SHA1 Message Date
Hengfei Yang ad79d30c41 fix: optimize cache metadata (#8671) 2025-09-28 23:08:39 +08:00
Neha P 891d3f5d1a test: pytest tests sql (#8637)
### **PR Type**
Tests


___

### **Description**

- Add time-series window functions test

- Add advanced regex aggregation test

- Add complex nested aggregation test


___

### Diagram Walkthrough


```mermaid
flowchart LR
  A["Add E2E test: array case-sensitive"] -- "validates substring match in arrays" --> T["tests/test_advanced_sql.py"]
  B["Add E2E test: window functions"] -- "histogram + LAG growth" --> T
  C["Add E2E test: regex + metrics"] -- "regexp_match, health status" --> T
  D["Add E2E test: complex CTEs"] -- "env metrics, ranks" --> T
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>test_advanced_sql.py</strong><dd><code>Add multiple
advanced E2E SQL tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

tests/api-testing/tests/test_advanced_sql.py

<ul><li>Add case-sensitive array extraction E2E test.<br> <li> Add
time-series window functions E2E test.<br> <li> Add advanced regex with
JSON-path metrics test.<br> <li> Add complex nested aggregation with
CTEs and ranking test.</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8637/files#diff-190cc55e8b961580682e09403c997fda2e8288e5f210dec5ab41c9465c68538f">+451/-0</a>&nbsp;
</td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___
2025-09-25 21:54:14 +05:30
Neha PandShrinath Rao 3565d4a516 test: added advanced sql queries (#8573)
### **PR Type**
Tests


___

### **Description**

SQL Query Test Coverage

- COUNT, SUM, AVG, MIN, MAX
-  approx_percentile_cont (P50, P75, P95, P99)
- histogram (time bucketing)
- str_match, str_match_ignore_case, COALESCE
- regexp_match, array_extract (regex groups)
- CASE WHEN (pattern matching)
- HAVING, LIKE, field comparisons
- GROUP BY (multi-field, time buckets)
- Kubernetes fields (kubernetes_container_name, etc.)

- Add advanced SQL E2E tests

- Validate fields and value constraints

- Cover percentiles and aggregations

- Exercise grouping, regex, and filters


___

### Diagram Walkthrough


```mermaid
flowchart LR
  tests["New E2E SQL tests"] --> errorRate["Error rate analysis"]
  tests --> percentiles["Time-bucket percentiles"]
  tests --> volume["Log volume by bucket"]
  tests --> source["Source grouping"]
  tests --> hostPerf["Host performance stats"]
  tests --> compPct["Component percentiles"]
  tests --> apiLogs["API log analysis"]
  tests --> metadata["Regex-based metadata extraction"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>test_advanced_sql.py</strong><dd><code>Add
comprehensive E2E advanced SQL query tests</code>&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

tests/api-testing/tests/test_advanced_sql.py

<ul><li>Add eight E2E tests posting SQL queries<br> <li> Assert HTTP 200
and presence of expected fields<br> <li> Validate rates, percentile
ordering, and counts<br> <li> Use time windows, grouping, regex
extraction</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8573/files#diff-190cc55e8b961580682e09403c997fda2e8288e5f210dec5ab41c9465c68538f">+514/-0</a>&nbsp;
</td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___

---------

Co-authored-by: Shrinath Rao <shnath@openobserve.ai>
2025-09-22 19:58:45 +05:30
Neha PandShrinath Rao 000009f86d test: str_match_coalesce_fix (#8403)
### **PR Type**
Tests


___

### **Description**
- Add e2e test for str_match_ignore_case with coalesce

- Validate all hits contain expected match

- Ensure 200 response and correct schema

- Log query performance and totals


___

### Diagram Walkthrough


```mermaid
flowchart LR
  T["New e2e test: str_match_ignore_case + coalesce"] -- "executes query" --> API["/api/{org}/_search?type=logs"]
  API -- "returns hits" --> V["Validate coalesce and case-insensitive match"]
  V -- "assertions + logs" --> R["Report results and timing"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>test_search.py</strong><dd><code>Add coalesce-aware
case-insensitive match test</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

tests/api-testing/tests/test_search.py

<ul><li>Add end-to-end test for str_match_ignore_case with coalesce<br>
<li> Post SQL search over recent timeframe<br> <li> Assert 200, hits
presence, and per-hit validation<br> <li> Print diagnostics and timing
information</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8403/files#diff-f3776a5bc02e67c163ed707f86b2192f47b73c641dde04b83523b95a74518141">+76/-0</a>&nbsp;
&nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___

Co-authored-by: Shrinath Rao <shnath@openobserve.ai>
2025-09-12 18:40:35 +05:30
Neha P ed11cd1af3 test: add pytest for queries and assert hits (#8241)
### **PR Type**
Tests


___

### **Description**
- Add end-to-end SQL query validation tests

- Verify WHERE, match_all, ORDER BY semantics

- Enforce LIMIT and result consistency checks

- Validate CTE filtering and fields presence


___

### Diagram Walkthrough


```mermaid
flowchart LR
  A["New E2E tests"] -- "WHERE filter" --> B["Validate field equality"]
  A -- "match_all" --> C["Check term presence"]
  A -- "ORDER BY" --> D["Assert timestamp DESC"]
  A -- "LIMIT" --> E["Enforce max hits"]
  A -- "CTE" --> F["Validate filtered fields"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>test_search.py</strong><dd><code>Add comprehensive E2E
SQL query tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

tests/api-testing/tests/test_search.py

<ul><li>Add test for WHERE condition equality<br> <li> Add test for
match_all term presence<br> <li> Add test for ORDER BY timestamp
DESC<br> <li> Add tests for LIMIT and CTE behavior</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8241/files#diff-f3776a5bc02e67c163ed707f86b2192f47b73c641dde04b83523b95a74518141">+252/-0</a>&nbsp;
</td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___
2025-09-01 22:30:56 +05:30
Ashish Kolhe 65f5ab44e3 fix: failing streaming tests (#8037)
### **PR Type**
Tests, Bug fix


___

### **Description**
Fix streaming tests' total aggregation logic
Track latest total instead of summing
Update debug logs to reflect final total
Adjust combined metadata to use final total


___

### Diagram Walkthrough


```mermaid
flowchart LR
  Parse["Parse streaming metadata"] -- "extract results.total" --> Track["Track latest total"]
  Track -- "set final_total" --> Combine["Combine first metadata with final_total"]
  Hits["Collect hits events"] -- "aggregate all hits" --> Combine
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>test_streaming.py</strong><dd><code>Use latest total
for streaming metadata</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

tests/api-testing/tests/test_streaming.py

<ul><li>Replace summed <code>total_sum</code> with
<code>final_total</code><br> <li> Update debug prints to reference final
total<br> <li> Set combined metadata <code>results.total</code> to
latest total<br> <li> Clarify comments for streaming semantics</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8037/files#diff-f15e9b733130f72112380fda658264545435fbf956b08869b0ad5a9435d222f7">+8/-8</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___
2025-08-18 22:41:45 +05:30
Neha PandShrinath Rao 8a43a378f6 test: fix api stream tests (#7923)
### **PR Type**
Tests


___

### **Description**
Re-enable streaming SQL E2E tests
Add values streaming endpoint tests
Cover cache and non-cache paths
Validate response schema and totals


___

### Diagram Walkthrough


```mermaid
flowchart LR
  SQLTests["SQL streaming tests"] -- "parametrized inputs" --> StreamNoCache["POST _search_stream use_cache=false"]
  SQLTests -- "cache verification" --> StreamCache["POST _search_stream use_cache=true"]
  ValuesTests["Values streaming tests"] -- "no cache" --> ValuesNoCache["POST _values_stream use_cache=false"]
  ValuesTests -- "with cache" --> ValuesCache["POST _values_stream use_cache=true"]
  StreamNoCache --> AssertSQL["Assert 200, totals match"]
  StreamCache --> AssertSQLCache["Assert 200, totals match"]
  ValuesNoCache --> AssertValues["Assert 200, structure, limits"]
  ValuesCache --> AssertValuesCache["Assert 200, structure, limits"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>test_streaming.py</strong><dd><code>Re-enable SQL and
add values streaming tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

tests/api-testing/tests/test_streaming.py

<ul><li>Uncomment and restore <code>test_streaming_sql</code> with
parametrization<br> <li> Add <code>test_values_streaming_endpoint</code>
for non-cache path<br> <li> Add
<code>test_values_streaming_endpoint_cache</code> for cache path<br>
<li> Validate status, totals, and response schema</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7923/files#diff-f15e9b733130f72112380fda658264545435fbf956b08869b0ad5a9435d222f7">+176/-176</a></td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___

Co-authored-by: Shrinath Rao <shnath@openobserve.ai>
2025-08-14 06:38:22 +05:30
Loakesh Indiranandsai nikhil kethe e46f6d5b82 feat: custom histogram interval & aligned partitions (#7909)
- `is_ui_histogram` query param for search api, the backend will convert
the sql to histogram query and respond accordingly
- `search_type` for search partition query, and if search type is `ui`
only then we generate partitions with mini partition that is aligned
with histogram interval


### **PR Type**
Enhancement, Bug fix, Tests, Documentation


___

### **Description**
- Add UI histogram query conversion and flag

- Align partitions to histogram with mini

- Stream empty metadata+hints consistently

- Expose histogram eligibility and interval


___

### Diagram Walkthrough


```mermaid
flowchart LR
  FE["Web UI logs & services"] -- "is_ui_histogram, searchType" --> HTTP["HTTP search endpoints"]
  HTTP -- "convert to histogram SQL\n(resolve streams, eligibility)" --> SQL["Histogram SQL converter"]
  HTTP -- "pass search_type, flags" --> SVC["Search service"]
  SVC -- "is_eligible, gen interval" --> PART["PartitionGenerator"]
  PART -- "aligned partitions\n(+mini optional)" --> STREAM["Streaming execution"]
  STREAM -- "SearchResponse + metadata\n(empty hits emitted)" --> FE
  SVC -- "Response: histogram_interval, is_histogram_eligible, converted_query" --> FE
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>16
files</summary><table>
<tr>
<td><strong>partition.rs</strong><dd><code>Histogram-aligned partitions
with optional mini support</code>&nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-348fa23375d0cea3e5fb039cc6b381d79aa1d5121e6b9792acc048d3fd02e37c">+798/-269</a></td>

</tr>

<tr>
<td><strong>execution.rs</strong><dd><code>Always emit responses;
accumulate and metadata tweaks</code>&nbsp; &nbsp; &nbsp; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-75d432351865224f0b00d7cc819554c2ad5fa1f777e9c645d91a3fd5c1113bc0">+148/-152</a></td>

</tr>

<tr>
<td><strong>search_stream.rs</strong><dd><code>HTTP2 stream: UI
histogram conversion and interval handling</code></dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-642de43ff6b19ae41087a9f1efc02d8b0b873809e0c92cbddfac1a30ef3f1184">+149/-69</a></td>

</tr>

<tr>
<td><strong>mod.rs</strong><dd><code>Partition API: histogram
eligibility, interval, UI paths</code>&nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-c3b85ea662a885fbd39797968928b291cb59a58f53a03f7b7dfd7ba8b6a7985a">+71/-5</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>histogram.rs</strong><dd><code>Convert original SQL to
histogram-safe query</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-a5fc4cd11b3ec569b4cedf278ef0b14f540504abfbb23e29eb896d5b2a6cc2b2">+140/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>mod.rs</strong><dd><code>HTTP search: UI histogram
conversion and response enrichment</code></dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-96630a0dbb6dd7b2b0248fa325c7c7041ce31340c32826675a4a70772e9d29f6">+38/-3</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>search.rs</strong><dd><code>Response/request fields for
histogram meta and streaming chunks</code></dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-373e83a31e5bbc82fba05d7ae274b0dbd624ed748272232cf7eb8b8c3b2f3afc">+45/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>mod.rs</strong><dd><code>New error:
SearchHistogramNotAvailable</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-90c725d0e77a6e7d4bcc130cf5783848a5cf0efdb304b351cd63cacf8775fc36">+7/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>multi_streams.rs</strong><dd><code>Multi-stream partition
search accepts search_type</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-c3233cdf1e68cb2455f91457719b9c2f477e735ee16546fdfe111e76768bd054">+16/-4</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>sql.rs</strong><dd><code>Detect histogram-eligible queries
and subqueries</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-a0a09c66a20d878ec7683ae222c919fbe092b8001871ade7f455b89573ce0911">+27/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>http.rs</strong><dd><code>Add query flag parser for
is_ui_histogram</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-3b50a69c1ec2f63f8eebb5f9880e17826463a586768aed3e3e15242833609d6b">+8/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>Index.vue</strong><dd><code>UI: histogram streaming flow,
timeouts cleanup</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-0323c3da69b369843c5d72bf4df5b00ca6b5147192a213baf331659ecf92af62">+45/-12</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>IndexList.vue</strong><dd><code>Pass searchType=ui to
partition API</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-08f058f883b659e713e606991a7ea37ae1ff016b7cccef970489ab5840dc3d09">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>search.ts</strong><dd><code>API: support is_ui_histogram,
searchType plumbed</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-885ab872dbc6e7b20264df815e3ef4727f0abc86ce90d2fb47e4aff572814c75">+7/-2</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>useStreamingSearch.ts</strong><dd><code>Include
is_ui_histogram in streaming URL</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-8fce3e25a161cd458e734bd9b1f98aadefe3482da7b6529a5b1f4fa20ec115e2">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>usePanelDataLoader.ts</strong><dd><code>Dashboard partition
calls pass searchType</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-5a42e9493a7bcd722b88e61fd38883c4f61001bc9cafa399f65f8eafda3aace9">+2/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

</table></details></td></tr><tr><td><strong>Tests</strong></td><td><details><summary>3
files</summary><table>
<tr>
<td><strong>cacher.rs</strong><dd><code>Adjust tests for new response
fields</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-8c387b22b2c0a282600ee41ca702b3db60f5a284d507c0feb7418608ff062c6c">+6/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>SearchResult.spec.ts</strong><dd><code>Skip flaky
resetPlotChart unit test</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-8ff7d14fc3cdac80eeec5550ecd89a77f015b4ebe928da9d4a76a9585d64d788">+1/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>useLogs.spec.ts</strong><dd><code>Skip failing query
partitions test</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-842307ae8db03aa51891ddde98cfdbbabc712db1e1614c9eee99a59add395f70">+1/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></details></td></tr><tr><td><strong>Error
handling</strong></td><td><details><summary>1 files</summary><table>
<tr>
<td><strong>error_utils.rs</strong><dd><code>Map histogram
unavailability to 400 with code</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-d4de63bc9275a19c868f6967de0f7835bd2d7bda74ff55ce97b8fb3f9af54da9">+3/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

</table></details></td></tr><tr><td><strong>Miscellaneous</strong></td><td><details><summary>1
files</summary><table>
<tr>
<td><strong>mod.rs</strong><dd><code>Export histogram SQL
module</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-dc0ab53d0ff551cf3cd12027c73d0da5e66680c0bf2d1830778639a33bac3464">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></details></td></tr><tr><td><strong>Bug
fix</strong></td><td><details><summary>2 files</summary><table>
<tr>
<td><strong>SearchResult.vue</strong><dd><code>UI: robust
empty-histogram handling and reset watcher</code>&nbsp; &nbsp; &nbsp;
&nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-5e65533aa4754bb6d0074fda18ffc1ecacded3b9ca6bc28a161c3f6b12f20195">+17/-15</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>SearchBar.vue</strong><dd><code>Cancel running query before
applying saved view</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-81893de4edf186b0556f610acb280c87baa2ffe67d3b48a60a866094c7635baf">+2/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

</table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>1
files</summary><table>
<tr>
<td><strong>query.ts</strong><dd><code>Types: histogram interval and
eligibility fields</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-12dd5b3bb9741bbeaa348c0efbbd745d0a582899678738159c6927d34a35191d">+2/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></details></td></tr><tr><td><strong>Additional
files</strong></td><td><details><summary>2 files</summary><table>
<tr>
  <td><strong>fga.rs</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-e7c99f37f3abbb5e0507d2760bbf67df010d9218704b38dce84c5477acecd22e">+0/-2</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
  <td><strong>useLogs.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7909/files#diff-1040f61354f92711e0e77ed4e9bfa15586d45a94c7e2ab06cc37372068030e7b">+154/-168</a></td>

</tr>
</table></details></td></tr></tr></tbody></table>

</details>

___

---------

Co-authored-by: sai nikhil kethe <nikhil@openobserve.ai>
2025-08-11 13:36:03 +05:30
Loakesh IndiranandBhargav 1bd1caa10a fix: limit, hist_alignment by factors of 24 hrs, order_by (#7895)
### **User description**
Fixes:
- `total` count when limit is reached for limit queries in http2
streaming
- Search response to return an array of `order_by`
```
eg: [["x_axis", "asc"], ["y_axis", "asc"]]
```
- Check and validate the histogram interval provided either as a query
payload or the histogram query, to generate partitions in aligned 24 hr
manner to avoid duplicate.


___

### **PR Type**
Enhancement, Bug fix, Tests


___

### **Description**
- Add `order_by_metadata` to search responses

- Validate histogram intervals as 24h factors

- Fix total count after results truncation

- Implement frontend sorting with metadata


___

### Diagram Walkthrough


```mermaid
flowchart LR
  SQL["SQL generation"] -- "validate hist interval" --> R["Response (order_by metadata)"]
  R -- "merge response" --> C["Cache module"]
  R -- "set result" --> H["HTTP handler"]
  H -- "streaming data" --> S["Streaming exec"]
  S -- "apply sort metadata" --> U["Frontend UI"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody></tr></tbody></table>

</details>

___

---------

Co-authored-by: Bhargav <BJP232004@GMAIL.COM>
2025-08-08 17:50:20 +05:30
udevandAshish Kolhe 1290512fe3 fix: SYNC optimize remote wal [phase 2] (#7664) (#7786)
### **User description**
Add separate envs for pipeline wal
Improve metrics


___

### **PR Type**
Enhancement


___

### **Description**
- Add batch buffering for pipeline WAL writes

- Schedule periodic buffer flush in enterprise mode

- Introduce env configs and metric labels

- Instrument WAL reader with timing logs


___

### Diagram Walkthrough


```mermaid
flowchart LR
  A["process_node"]
  B["group by batch_key"]
  C["BATCH_BUFFERS"]
  D["get_pipeline_wal_writer"]
  E["remote WAL"]
  F["accumulate"]
  G["pipeline flush task"]
  A -- "records" --> B
  B -- "add to buffer" --> C
  C -- "should_flush? yes" --> D
  D -- "write_wal" --> E
  C -- "should_flush? no" --> F
  G -- "flush_all_buffers" --> C
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody></tr></tbody></table>

</details>

___

---------

Co-authored-by: Ashish Kolhe <ashish.j.kolhe@gmail.com>
2025-08-06 16:47:02 +05:30
Hengfei Yang b7e1a9d702 perf: pushdown plan (#7778) 2025-07-31 14:31:33 +08:00
Huaijin b41bb71779 feat: upgrade datafusion to v49 (#7649) 2025-07-30 10:57:25 +08:00
Anand Kumar Dubey ad345086d4 fix: validate password length when creating & updating users (#6782) 2025-07-20 11:11:01 +08:00
Ashish KolheandShrinath Rao 91bc704dc0 fix: RBAC default role (#7560)
### **PR Type**
Bug fix


___

### **Description**
- Include role in user-org tuple creation

- Pass `org.role` to `get_user_org_tuple`

- Add default role in custom role mapping


___

### **Changes diagram**

```mermaid
flowchart LR
  PT["process_token"] -- "pass role" --> GUT["get_user_org_tuple"]
  MG["map_group_to_custom_role"] -- "pass default role" --> GUT
```


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Bug
fix</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>jwt.rs</strong><dd><code>Add role parameter to tuple
function</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

src/handler/http/auth/jwt.rs

<li>Added role parameter to <code>get_user_org_tuple</code><br> <li>
Passed <code>org.role</code> in <code>process_token</code><br> <li>
Included default role in custom role mapping


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7560/files#diff-232cab74f4cbf135af424744272e17732fbda8ac005d33c0acb4597e65479d02">+15/-3</a>&nbsp;
&nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

___

> <details> <summary> Need help?</summary><li>Type <code>/help how to
...</code> in the comments thread for any questions about PR-Agent
usage.</li><li>Check out the <a
href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a>
for more information.</li></details>

---------

Co-authored-by: Shrinath Rao <shnath@openobserve.ai>
2025-07-15 15:23:59 +05:30
Hengfei Yang 5b2148b043 fix: remove sql_mode support for FE (#7516) 2025-07-10 11:41:25 +08:00
c2c7ea6a95 test: match_all queries pytest (#7208)
### **User description**
match_all queries pytest


___

### **PR Type**
Tests


___

### **Description**
- Add tests for match_all streaming queries


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>test_streaming.py</strong><dd><code>Add match_all
streaming test cases</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

tests/api-testing/tests/test_streaming.py

<li>Added "match_all query one" test case<br> <li> Added "match_all
query two" test case<br> <li> Added "match_all query three" test case


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7208/files#diff-f15e9b733130f72112380fda658264545435fbf956b08869b0ad5a9435d222f7">+21/-3</a>&nbsp;
&nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

___

> <details> <summary> Need help?</summary><li>Type <code>/help how to
...</code> in the comments thread for any questions about PR-Agent
usage.</li><li>Check out the <a
href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a>
for more information.</li></details>

---------

Co-authored-by: Taiming Liu <liutaiming3@gmail.com>
Co-authored-by: Shrinath Rao <shnath@openobserve.ai>
2025-06-19 11:57:32 +05:30
Loakesh IndiranandHengfei Yang 600c0d3b7e feat: aggregation cache (#6923)
Cache Intermediate record batches for aggregate sql queries

## TODO

- [ ] Add in memory cache file index
- [ ] Modify exiting delete stream results api to also delete
`aggregations` cache
- [ ] use bounded Chanel for `CACHE_QUEUE` and and an env for queue size

---------

Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>
2025-06-17 21:08:48 +05:30
Shyam Panjiyar 111298017c test: pagination pytest (#7126)
### **PR Type**
Tests, Enhancement


___

### **Description**
- Comment out SQL mode calls in streaming tests

- Disable Chromium browser tests in config

- Add WebKit (Safari) project configuration

- Adjust viewport settings for Safari tests


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>streaming.spec.js</strong><dd><code>Disable SQL mode in
streaming tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

tests/ui-testing/playwright-tests/streaming.spec.js

<li>Commented out <code>await logsPage.enableSQLMode()</code> calls<br>
<li> Removed SQL mode requirement from streaming tests


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7126/files#diff-7ee1f433f2c0f92476e64e6777e719a3cbfd2c60c7e1b4fb77891445e3cd7b91">+13/-13</a>&nbsp;
</td>

</tr>
</table></td></tr><tr><td><strong>Configuration
changes</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>playwright.config.js</strong><dd><code>Add Safari
(WebKit) project to Playwright config</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

tests/ui-testing/playwright.config.js

<li>Commented out Chromium project configuration<br> <li> Added WebKit
(Safari) project settings<br> <li> Set viewport for Desktop Safari
device


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7126/files#diff-91cb9615068914b2e4f5d66fcbed50d3e9771ea2d882f8e8048bbe54eab3c414">+13/-6</a>&nbsp;
&nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

___

> <details> <summary> Need help?</summary><li>Type <code>/help how to
...</code> in the comments thread for any questions about PR-Agent
usage.</li><li>Check out the <a
href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a>
for more information.</li></details>
2025-06-13 17:20:03 +05:30
Shyam Panjiyar 138e7e296d test: re_match, partition search and values API pytest (#7051)
re_match,  partition search and values API pytest
2025-06-06 21:45:42 +05:30
Shyam PanjiyarandHengfei Yang dc99038a32 test: Updated change organisation validation playwright (#6912)
Updated Page change organisation validation

---------

Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>
2025-05-30 16:59:23 +05:30
Shyam Panjiyar 3fbe1e17dc test: Resolved issues after Integrating organization pytest (#6942)
Resolved issues after Integrating organization pytest
2025-05-28 12:13:21 +05:30
Yashodhan JoshiandYashodhan Joshi 7540824633 fix: use _all_ in org related api call perm checks (#6920)
Fixes permission check for organization related api. In ofga when we set
a role with org perms, it sets to `org:_all_{org}` but in the check , we
check for permission on `org:{org}` which causes users with role having
permission on org, not be able to rename org. This fixes it by updating
it to correct check.

---------

Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>
Co-authored-by: Yashodhan Joshi <yjdoc2@gmail.com>
2025-05-28 11:02:01 +05:30
Shyam PanjiyarandSubhradeep Chakraborty 289d6234e5 test: new org created pytest (#6926)
New organizations created

---------

Co-authored-by: Subhradeep Chakraborty <chakrabortysubhradeep556@gmail.com>
2025-05-27 17:54:43 +05:30
+2 0d9f47966b feat: Organization revamp (#5579)
Fixes #5131 
Addresses #5408 

### Revamp
- Created a new table to store organizations in the `organizations`
table. Earlier, we never stored organizations in any table, rather we
used to store the organizations in the meta table as part of the `user`
json.
- The users and organization membership relations are now moved to its
own separate tables - `users` and `org_users`.

### New changes

**API changes** -
- `/organizations` - `POST` api to create an org and save it in the meta
table. In non-enterprise version, currently only the root user can
create the org. For enterprise version with rbac enabled, anyone with
`CREATE` access for organizations can create the organization and
becomes an admin. Root user can always create an organization.
- `/{org_id}/rename` - `PUT` api to rename the existing org. Only root
user and the admins of the org can access this API.

The payload for following APIs are changed -
- `POST api/{org_id}/roles` - `{"name":"new_role"}` is changed to
`{"role":"new_role"}
- `POST api/{org_id}/users/{user}` -
`{"role":"viewer","custom_role":["role_name"]}` is the new payload where
`custom_role` is optional and is array of custom roles (only works in
enterprise with rbac enabled) which will be assigned to the user. The
value of `role` can be standard role or as well as any custom role (when
it is custom role, the standard role assigned to the user is decided
based on the enterprise env variable - `O2_DEX_DEFAULT_ROLE`).
- `POST api/{org_id}/users`- the payload -
```
{"email":"user@user.com","role":"viewer","custom_role":["create_org_permission"],"password":"12345678", "first_name": "", "last_name":""}
```

- `PUT api//{org_id}/users/{email_id}` the payload -
```
{"first_name":"Hello","last_name":"j","role":"viewer","isExternal":false,"change_password":false,"password":"","custom_role":["create_org_permission"]}
```


A new ENV variable is introduced - `ZO_CREATE_ORG_THROUGH_INGESTION`
(default `false`) which if true, an org will automatically created when
ingesting data to a new org. If false, user can not create org by
ingesting data to new org, they need to first call the `POST
/organizations` API.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Release Notes

**New Features**
- Added a `cloud` feature for enhanced organizational management
capabilities.
- Introduced new methods for managing organizational users and
asynchronous message processing.
- Enhanced user invitation and membership features, including improved
role handling.
- Implemented configurable ingestion URL support across various
components.
- Added new functionality for user management and organization handling
in the super cluster architecture.

**Improvements**
- Refined user authentication and authorization processes, including
error handling.
- Updated database schema to support multi-organization architecture.
- Enhanced pagination settings and UI components for better user
experience.
- Improved handling of organization names and user roles in
notifications and alerts.
- Streamlined service account token management with visibility
enhancements.
- Enhanced the `AddUpdateOrganization` component with improved user
input handling and validation.
- Updated the `AppOrganizations` component to dynamically load the
appropriate organization management interface.
- Improved the `ServiceAccountsList` component with updated pagination
options and token handling logic.

**Bug Fixes**
- Resolved issues with user role assignments and organization management
inconsistencies.
- Corrected routing and navigation logic for login and logout processes.
- Addressed various error handling scenarios in user and organization
processes.
- Fixed issues with the visibility of service account options in the
`EditGroup` and `EditRole` components based on the cloud configuration.

**Breaking Changes**
- Significant restructuring of user and organization data models.
- Changes to authentication workflows and configuration handling.
- Removal of certain components related to user and organization
management.
- Updated the logic for determining the ingestion URL across various
components.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>
Co-authored-by: Bhargav <BJP232004@GMAIL.COM>
Co-authored-by: Taiming Liu <liutaiming3@gmail.com>
Co-authored-by: hengfei yang <hengfei.yang@gmail.com>
Co-authored-by: harshiv-7 <harshiv@openobserve.ai>
Co-authored-by: Huaijin <haohuaijin@gmail.com>
Co-authored-by: Zhao.wei <weizhao029@gmail.com>
Co-authored-by: ShyamOOAI <shyam@openobserve.ai>
Co-authored-by: oasisk <ashish.j.kolhe@gmail.com>
Co-authored-by: sai nikhil kethe <nikhil@openobserve.ai>
Co-authored-by: Yashodhan Joshi <yashodhan@openobserve.ai>
Co-authored-by: Yashodhan Joshi <yjdoc2@gmail.com>
2025-05-25 21:53:55 -07:00
Shyam Panjiyar 68f9193bec test: validate max_query_range for 1 hour pytest (#6890)
Validate max_query_range for 1 hour pytest
1. HTTP Cache False
2. HTTP Cache True
3. Streaming Search Cache False
4. Streaming Search Cache True
2025-05-23 11:33:31 +05:30
Shyam Panjiyar c84792d3eb test: streaming search pytest (#6803)
Streaming Search PyTest
2025-05-20 16:22:24 +05:30
bff9364ac7 feat: add EventProgress server event (#6668)
- [x] add `percent` calc, based on the query duration

---------

Co-authored-by: ktx-vaidehi <vaidehi.akhani@kiara.tech>
Co-authored-by: omkark06 <omkar@zinclabs.io>
Co-authored-by: Kirtan Thakkar <kirtan@kiara.tech>
2025-04-29 17:38:58 +05:30
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
Shyam Panjiyar 9eec05a6ee test: websocket version 2 connection pytest (#6476) 2025-04-14 15:51:04 +05:30
Shyam Panjiyar 04b83127e7 test: sql vrl satisfied and no satisfied alert pytest (#6529) 2025-04-14 10:59:45 +05:30
Ashish KolheandSubhra264 5f9f304379 fix: improve error handling (#6432)
Co-authored-by: Subhra264 <chakrabortysubhradeep556@gmail.com>
2025-03-31 18:13:31 +05:30
Shyam Panjiyar f21dfd871d test: root and admin search automation using pytest (#6433) 2025-03-31 16:16:13 +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
Shyam Panjiyar cac2ded2cf test: Create Objects and Refactoring POM PyTest (#6357) 2025-03-24 16:50:30 +05:30
Patrick Sullivan 3f4074b8cf fix: Misc V2 alerts routes fixes (#6137)
Makes the following fixes to these routes:
- `ListAlerts`
  - adds `enabled` to the response body
  - adds `name_substring` to the request body
- `MoveAlerts`
- changes the method type to `PATCH` since this is a non-idempotent
update
- changing to `PATCH` coincidentally happens to fix a routing issue
where requests to `MoveAlerts` were being routed to the `UpdateAlerts`
handler
- `EnableAlert`
- changes the method type to `PATCH` since this is a non-idempotent
update
- `TriggerAlert`
- changes the method type to `PATCH` since this is a non-idempotent
update
2025-02-28 17:19:22 -06:00
a3407fe12d fix: ws connection optimizations cherry-pick (#6047)
- fix: close frame to-from client #6033
- fix: ws connection optimizations #6038
- fix: ws connection optimizations v3 #6058 
- fix: ws conn #6080 
- fix: only close sink to backend in ws_proxy

New Env:
```sh
ZO_WEBSOCKET_ENABLED=true
ZO_WEBSOCKET_CLOSE_FRAME_DELAY=50 // microseconds
ZO_WEBSOCKET_SESSION_IDLE_TIMEOUT_SECS=300
ZO_WEBSOCKET_SESSION_MAX_LIFETIME_SECS=3600
ZO_WEBSOCKET_SESSION_GC_INTERVAL_SECS=60
ZO_WEBSOCKET_PING_INTERVAL_SECS=15
```

---------

Co-authored-by: omkark06 <omkar@zinclabs.io>
Co-authored-by: ShyamOOAI <shyam@openobserve.ai>
2025-02-25 18:28:16 +05:30
Shyam PanjiyarandLoakesh Indiran 477446cb1f test: Websocket PyTest Super Cluster (#5878)
Co-authored-by: Loakesh Indiran <66478092+Loaki07@users.noreply.github.com>
2025-02-14 17:22:44 +05:30
Shyam Panjiyar 221821dbb9 test: Summary PyTest in super cluster (#5938) 2025-02-13 12:54:27 +05:30
Neha P 527fcbc76e test: fix stream-selection flakiness (#5898) 2025-02-07 13:48:44 +05:30
Shyam Panjiyar cac3b9e40c test: Added dependencies for cipher keys (#5814)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Chores**
	- Updated project dependencies in test configuration
	- Added `tink` library (version 1.10.0+)
	- Added `protobuf` library
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-01-27 13:39:26 +05:30
Shyam Panjiyar 2714579307 test: skipping RUM Search Pytest sanity get history playwright (#5803)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Tests**
	- Removed several RUM and search-related test functions in API testing
	- Skipped a search history test case in UI testing

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-01-25 10:27:30 +05:30
Shyam PanjiyarandTaiming Liu d98164b127 test: rum search updated pytest (#5797)
rum search updated pytest

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Tests**
- Enhanced RUM (Real User Monitoring) test suite with improved logging
and data validation.
- Added print statements to output response payloads for better test
visibility.
- Introduced additional assertions for geographical data and log message
checks in search tests.
	- Commented out specific actions in UI tests to refine test execution.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Taiming Liu <liutaiming3@gmail.com>
2025-01-25 07:25:13 +05:30
Shyam Panjiyar aa96a8a1e5 test: New alerts endpoints PyTest (#5630)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Tests**
- Added comprehensive end-to-end (E2E) tests for the alert management
API.
- Implemented tests for retrieving alerts, creating new alerts,
enabling/disabling alerts, triggering alerts, and deleting alerts.
- Included validation checks and response status code assertions for all
API functionalities.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-01-20 17:31:34 +05:30
Neha P 59c61f268c test: enrichment-pipeline-test (#5731)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Tests**
- Updated test cases for pipeline creation and action handling with
corrected boolean value casing.
	- Added new test case to validate pipeline creation failure scenario.
- Enhanced UI testing for enrichment table functionality by adding
date-time button interaction and visibility checks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-01-17 16:27:15 +05:30
Neha P 2bf8bb3720 test: add test function pytest cases (#5667)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Tests**
	- Added comprehensive test cases for API function creation
- Included tests for invalid payloads, text-only inputs, and special
character scenarios
	- Verified successful function creation with valid payloads

- **Chores**
- Updated `.gitignore` to exclude temporary directories, configuration
files, and build artifacts

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-01-10 19:17:47 +05:30
Hengfei Yang a686ec6927 fix: metrics ingestion with otlp json (#5649) 2025-01-10 00:22:36 +08:00
Shyam Panjiyar 78306b7083 test: service accounts PyTest (#5625)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Tests**
	- Added comprehensive end-to-end tests for service account management.
- Implemented tests for retrieving, creating, updating, refreshing, and
deleting service accounts.
- Included validation for handling invalid email formats during service
account creation.
- Ensured proper validation of API responses and status codes for
service account operations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-01-09 12:54:44 +05:30
Shyam Panjiyar 895c0642c0 test: Have added negative test cases for new folders (#5586)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Tests**
- Added comprehensive test cases for dashboard and alerts folder
functionalities.
	- Introduced tests for unauthorized access scenarios.
	- Added error handling tests for invalid inputs and folder IDs.
- Improved test coverage for various edge cases, including responses for
empty and invalid folder IDs.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-01-08 21:51:58 +05:30
Shyam Panjiyar dd25a1da66 test: New Folders API test cases in PyTest (#5570)
New Folders API test cases 

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Tests**
- Added comprehensive API testing for dashboard and alert
functionalities.
- Implemented test cases for retrieving, creating, updating, and
deleting dashboard and alert folders.
- Ensured proper response status code validation for various API
operations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-01-04 00:27:49 +05:30
Shyam Panjiyar 9ebf7c677c test: PyTest organizations Updated (#5465)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved clarity in passcode-related tests by renaming variables and
updating assertion messages.
	- Enhanced specificity in testing passcode responses and updates.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-26 14:19:33 +05:30