mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-05 16:10:43 +00:00
### **User description**
# PR Type
Fix / Enhancement
# Description
Similar to Dashboard names, we are also going to display the alert names
on the frontend. To do this we need to include the alert_name detail in
the SearchEventContext payload which will be tracked by the
QueryManager. The frontend update will make the alert name be displayed
as query_source - just like dashboard name.
___
### **PR Type**
Enhancement
___
### **Description**
- Add `alert_name` to search context
- Propagate field through proto and conversions
- Display alert source in RunningQueries
- Simplify test context init with defaults
___
### Diagram Walkthrough
```mermaid
flowchart LR
ProtoDef["cluster/search.proto adds 'alert_name'"] -- regenerates --> ProtoGen["generated cluster.rs includes alert_name"]
ProtoGen -- maps via From --> MetaModel["meta/search.rs SearchEventContext"]
AlertsEval["alerts/alert.rs evaluate()"] -- sets --> MetaModel
MetaModel -- exposed in usage --> Frontend["RunningQueries.vue shows alert name"]
```
<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><table>
<tr>
<td>
<details>
<summary><strong>search.rs</strong><dd><code>Add alert_name to
SearchEventContext and mappings</code>
</dd></summary>
<hr>
src/config/src/meta/search.rs
<ul><li>Add <code>alert_name</code> field to
<code>SearchEventContext</code>.<br> <li> Map <code>alert_name</code> in
From/Into proto conversions.</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8378/files#diff-373e83a31e5bbc82fba05d7ae274b0dbd624ed748272232cf7eb8b8c3b2f3afc">+4/-0</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>alert.rs</strong><dd><code>Set alert_name in alert
evaluation context</code>
</dd></summary>
<hr>
src/service/alerts/alert.rs
<ul><li>Populate <code>search_event_ctx.alert_name</code> during alert
evaluation.<br> <li> Initialize mutable context then assign alert
name.</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8378/files#diff-574be3504bf4d855c65fd3d7a10797a970237ff552edac4962b474b3983e094e">+3/-1</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>RunningQueries.vue</strong><dd><code>Display alert name
as query source in UI</code>
</dd></summary>
<hr>
web/src/components/queries/RunningQueries.vue
<ul><li>Compute <code>query_source</code> based on
<code>search_type</code>.<br> <li> Show <code>folder/dashboard</code>
for dashboards.<br> <li> Show <code>alert_name(alert_key)</code> for
alerts.<br> <li> Fallback to <code>-unknown-</code> when missing.</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8378/files#diff-6f0e18626a986d934c08c368ac383179c56bfcd914a27619ba748f43629c926b">+10/-1</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>search.proto</strong><dd><code>Proto: add alert_name to
SearchEventContext</code>
</dd></summary>
<hr>
src/proto/proto/cluster/search.proto
- Add `optional string alert_name = 8;` to `SearchEventContext`.
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8378/files#diff-789f17326b818d5fbd1b5b752bed17e5341fde3d3261951634edcf78cacf3dbe">+1/-0</a>
</td>
</tr>
</table></td></tr><tr><td><strong>Dependencies</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>cluster.rs</strong><dd><code>Regenerated proto includes
alert_name field</code>
</dd></summary>
<hr>
src/proto/src/generated/cluster.rs
- Include optional `alert_name` with tag 8 in generated struct.
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8378/files#diff-542d8f27a174c845740ca1c3fe0b697db89c3db666437c1c4dd8c9745510080c">+2/-0</a>
</td>
</tr>
</table></td></tr><tr><td><strong>Tests</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>ingestion.rs</strong><dd><code>Simplify test context
with default struct update</code>
</dd></summary>
<hr>
src/service/self_reporting/ingestion.rs
<ul><li>Use <code>..Default::default()</code> to fill unused context
fields.<br> <li> Keep only <code>dashboard_id</code> explicitly set in
test.</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8378/files#diff-3edd5f4ed1eed0f765b7b450ef0fbf587632e6b22302006a5e397049e297057f">+1/-6</a>
</td>
</tr>
</table></td></tr></tr></tbody></table>
</details>
___