Files
openobserve/web
Harsh Mahajanandsai nikhil kethe b267159579 feat: adding built-in regex patterns (#8827)
### **PR Type**
Enhancement, Documentation


___

### **Description**
- Add built-in regex patterns fetch API

- Introduce GitHub data service with caching

- Handle duplicate pattern names gracefully

- UI to browse and import built-ins


___

### Diagram Walkthrough


```mermaid
flowchart LR
  cfg["Config: regex_patterns_source_url"] -- used by --> ghsvc["GitHubDataService"]
  ghsvc -- fetch_json/cache --> adapter["PyWhatAdapter.fetch_built_in_patterns"]
  adapter -- returns --> api["GET /api/{org}/re_patterns/built-in"]
  api -- consumed by --> websvc["web regexPatterns.getBuiltInPatterns()"]
  websvc -- powers --> ui["BuiltInPatternsTab.vue"]
  ui -- import selected --> importFlow["ImportRegexPattern.vue"]
  importFlow -- create --> dbsvc["db::re_pattern::add (duplicate-safe)"]
```



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

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Configuration
changes</strong></td><td><details><summary>3 files</summary><table>
<tr>
<td><strong>config.rs</strong><dd><code>Add source URL for built-in
regex patterns</code>&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/8827/files#diff-9aeee4a74c0520daa40f9b81c7016f5b6b3254375b968dd7598e745630980d62">+6/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>mod.rs</strong><dd><code>Register built-in patterns and
reorder routes</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8827/files#diff-02556e3f515441b5d2b6bbea7829df488beac03c4cc41309a6638ae3c0e0aec6">+2/-2</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>mod.rs</strong><dd><code>Export github service
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; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8827/files#diff-1b15316505c31acccb26ba66d920fdb0894567d08d2bf1e3457716d128a67b83">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

</table></details></td></tr><tr><td><strong>Enhancement</strong></td><td><details><summary>10
files</summary><table>
<tr>
<td><strong>mod.rs</strong><dd><code>New endpoint to fetch built-in
patterns and improved save response</code></dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8827/files#diff-27d37a8738de89c81b540daa978e684caf2cf28803e1208d90cb4d42528ed28b">+103/-4</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>re_pattern.rs</strong><dd><code>Add duplicate-safe creation
with auto-suffix names</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8827/files#diff-0cb2bf6d550d07b66db7e325c6d44c6a598f2ac8e315bf9e168f4a1d9d6e745d">+47/-17</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>mod.rs</strong><dd><code>Add adapters module export for
pattern formats</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8827/files#diff-3a24aa67600735383b8b94a435974dc9b2677b6bb3f5fb502fb7d617af8bdec0">+20/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>pywhat.rs</strong><dd><code>Implement generic pattern
adapter and filters</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8827/files#diff-9ecd12df46c16fca3984bc46122a26568db208839f904e0b216185df43e13e08">+264/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>cache.rs</strong><dd><code>Introduce in-memory cache with
eviction and stats</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8827/files#diff-09bcde8f6abf0cbf88628e1e6e7290e9fde7655c7903569902bf28742e958326">+130/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>client.rs</strong><dd><code>Add GitHub data client with
retry and caching</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8827/files#diff-20a335d645493f38003faf7303124a6e85c3c2dfd765e148811aebee1ebfd890">+246/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>types.rs</strong><dd><code>Define service config, errors,
and cache types</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8827/files#diff-35becfa9ecfcd7711485f645f09a3fe2429231d0c351f0374f20f121225fbaae">+119/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>regex_pattern.ts</strong><dd><code>Add client method to
fetch built-in patterns</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/8827/files#diff-2a0b0828141d39ab0385e0941314ead1cdd2ec3ec7b3baf5fd0c42f8f010728a">+18/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>BuiltInPatternsTab.vue</strong><dd><code>New UI to search,
filter, preview, import patterns</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8827/files#diff-0747e124429b322a69f6ae0117ec635044059bd48fb03e90b2328aa1f79b8b28">+451/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>ImportRegexPattern.vue</strong><dd><code>Integrate built-in
tab and import flow updates</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8827/files#diff-e8e1bcb5a02311504d7d571090eab27a270aaa71cae185ad2703023e2e70a31e">+94/-36</a>&nbsp;
</td>

</tr>

</table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>3
files</summary><table>
<tr>
<td><strong>mod.rs</strong><dd><code>Expose GitHub service modules and
types</code>&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/8827/files#diff-90a3518cd7c8b2a8b2a2093535b64a3dc4e6ffead41e5dca7901521e0c0ba910">+39/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>.env.example</strong><dd><code>Document regex patterns
source URL env var</code>&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/8827/files#diff-a3046da0d15a27e89f2afe639b25748a7ad4d9290af3e7b1b6c1a5533c8f0a8c">+6/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>en.json</strong><dd><code>Add i18n strings for built-in
patterns UI</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/8827/files#diff-892aa3d75ab6e129ef9116aa21bec1b9a15ba69ce5366d2a19128078c690d824">+17/-1</a>&nbsp;
&nbsp; </td>

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

</details>

___

---------

Co-authored-by: sai nikhil kethe <nikhil@openobserve.ai>
2025-11-03 23:55:47 +05:30
..
2023-02-02 09:03:11 +05:30
2023-08-06 01:29:13 +08:00
2023-02-02 09:03:11 +05:30
2023-02-02 09:03:11 +05:30
2023-02-02 09:03:11 +05:30
2024-04-03 12:49:25 +05:30
2023-02-02 09:03:11 +05:30

web

This template should help get you started developing with Vue 3 in Vite.

VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).

Type Support for .vue Imports in TS

TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.

If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:

  1. Disable the built-in TypeScript Extension
    1. Run Extensions: Show Built-in Extensions from VSCode's command palette
    2. Find TypeScript and JavaScript Language Features, right click and select Disable (Workspace)
  2. Reload the VSCode window by running Developer: Reload Window from the command palette.

Customize configuration

See Vite Configuration Reference.

Project Setup

npm install

Compile and Hot-Reload for Development

For stand-alone UI development environment, create .env file and which contains below environment variable

VITE_OPENOBSERVE_ENDPOINT=http://localhost:5080/
npm run dev

Type-Check, Compile and Minify for Production

npm run build

Run Unit Tests with Vitest

npm run test:unit

Run End-to-End Tests with Cypress

npm run test:e2e:dev

This runs the end-to-end tests against the Vite development server. It is much faster than the production build.

But it's still recommended to test the production build with test:e2e before deploying (e.g. in CI environments):

npm run build
npm run test:e2e

Lint with ESLint

npm run lint