Files
openobserve/web
Ashish Kolhe f62d0d60c5 feat: traces for agent (#8800)
### **PR Type**
Enhancement, Bug fix


___

### **Description**
- Add distributed tracing for AI chat

- Parse W3C traceparent, fallback to UUID v7

- Enable conditional tracer provider/init

- Improve AI error logs with trace context


___

### Diagram Walkthrough


```mermaid
flowchart LR
  FE["Frontend generateTraceContext()"] -- "traceparent header" --> API["/api/{org_id}/ai/chat(_stream)"]
  API -- "Span root if enabled" --> Tracer["Tracer provider"]
  API -- "trace_id propagated" --> AIService["ai::service::{chat,chat_stream}"]
  Tracer -- "OTLP exporters" --> OO["OpenObserve OTLP"]
  Tracer -- "Filtered ai.* spans" --> OO["OpenObserve OTLP"]
  Tracer -- "Optional eval exporter" --> Eval["AI Evaluation OTLP"]
```



<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>chat.rs</strong><dd><code>Add tracing headers parsing
and span creation</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

src/handler/http/request/ai/chat.rs

<ul><li>Accept headers and org path in chat<br> <li> Create root tracing
spans when enabled<br> <li> Parse W3C traceparent to derive trace_id<br>
<li> Propagate trace_id to AI services and logs</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8800/files#diff-12a78cbb31b313cb3a0ca50f25c177470cf49b02708f179fe138ed3d66a2926b">+77/-12</a>&nbsp;
</td>

</tr>

<tr>
  <td>
    <details>
<summary><strong>main.rs</strong><dd><code>Conditional tracing setup and
AI exporters</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

src/main.rs

<ul><li>Initialize tracer when AI tracing enabled<br> <li> Add
FilteringSpanProcessor for ai.* spans<br> <li> Configure additional OTLP
exporters<br> <li> Use UUID v7 ID generator when available</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8800/files#diff-42cb6807ad74b3e201c5a7ca98b911c5fa08380e942be6e4ac5807f8377f87fc">+223/-17</a></td>

</tr>

<tr>
  <td>
    <details>
<summary><strong>useAiChat.ts</strong><dd><code>Add traceparent to AI
chat requests</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>

web/src/composables/useAiChat.ts

<ul><li>Generate and send traceparent header<br> <li> Pass abort signal
in fetch options</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8800/files#diff-830ee4f21bdbbd0fa5c5c0f43b0a1d0200831e07ccddc91982cf0371c801b046">+6/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
  <td>
    <details>
<summary><strong>ai_chat.ts</strong><dd><code>Propagate traceparent in
service requests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></summary>
<hr>

web/src/services/ai_chat.ts

<ul><li>Include traceparent header in chat_stream<br> <li> Utilize
generateTraceContext utility</ul>


</details>


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

</tr>
</table></td></tr><tr><td><strong>Miscellaneous</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>wal.rs</strong><dd><code>Remove tracing attribute from
WAL list</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></summary>
<hr>

src/service/search/datafusion/storage/wal.rs

- Remove unused tracing instrument on list


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8800/files#diff-9ca700516d742bbc3c93f2271b27034650124c06a594f5b668144c51d7e28637">+0/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr><tr><td><strong>Configuration
changes</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>vite.config.ts</strong><dd><code>Adjust Vite dependency
optimization settings</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

web/vite.config.ts

<ul><li>Exclude echarts modules from optimizeDeps<br> <li> Disable
forced dependency optimization</ul>


</details>


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

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

</details>

___
2025-10-14 17:35:17 +05:30
..
2023-02-02 09:03:11 +05:30
2025-10-14 17:35:17 +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
2025-10-14 17:35:17 +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