openobserve/web
Prabhat Sharma 624425a08a
feat(editor): rebuild query autocomplete, and fix the value path behind it (#13586)
Design at autocomplete/autocomplete.md

Rewrites the query editor's autocomplete across every surface that has
one, and
follows the field-value path far enough to fix the bugs it was hiding.
53
commits, in six phases; each phase was written test-first, reviewed
adversarially, and checked in a browser before the next one started.

## What was wrong

The completion providers were wired inconsistently. Six surfaces bound a
resolver that was never defined, so their value completion could not
resolve at
all — SLO, dashboards and anomaly detection among them. Traces never
bound
`:suggestions`. Alerts never called `updateStreamKeywords`. PromQL ran a
second
editor runtime purely for its grammar, and asked
`/prometheus/api/v1/series`
— the heaviest endpoint available — for data the stream schema already
has.

## Phases

**1 — icons, staleness, quoting.** Correct `CompletionItemKind` glyphs,
stream
keywords refreshed when the stream changes, `spath` quoting.

**2 — the function catalog.** Custom functions get one tab stop per
argument,
org VRL functions stop appearing twice, column types read from
`dataType` as
well as `type`.

**3 — signature help, hover, async completion.** Providers return real
`CompletionList`s with `incomplete: true`, so a list that arrives late
is
re-queried rather than pinned.

**4 — numeric ranking.** Numeric columns sort first inside a numeric
aggregate.

**5 — values for streams nobody has searched.** The value cache only
ever held
what a search had already returned, so a stream you had not queried
offered
nothing. Values are now fetched on demand, bounded (10s timeout, 60s
cooldown,
one in-flight request per key), and shared between the editor and the
builder.
PromQL joins the same path: labels from the stream schema, values from
the
shared cache. `/series` now has zero production callers.

**6 — one way to fetch a value.** Item 22 only, in this PR.

## The dashboard filter 400

Clicking the ✕ beside "Select Field" in a filter's dropdown sets the
column to
`{}`, and the watcher on `condition.column` then asks for that column's
values.
`loadFilterItem` built `fields: [row.field]` out of `undefined`,
JSON.stringify
turned that into `null`, and the server answered

```
400 {"code":400,"message":"SerdeJsonError# invalid type: null, expected a string"}
```

`_values_stream` answers 400, not an empty result, for each way a piece
of the
payload can go missing — and every one is reachable: an unresolved
stream alias
(`.find(…)?.stream`), a stream not yet chosen (`""`), a range not yet
set. The
range fails differently: `meta.dateTime` starts as `{start_time: ""}`
and
`""?.toISOString()` does not short-circuit, so it throws and both
callers
surface "Something went wrong!" for a lookup the user never asked to
fail.

Guarded at the two callers, where the payload is built and where the
throw
happens. Not at `fetchFieldValues` — a guard there is too late to stop
the
throw and would duplicate validation the callers need anyway. The
trigger is
left alone: re-picking a field must still load its values.

## Notable removals

CodeMirror is gone — it was still bundled for the PromQL grammar alone.
Bundle 26.3 MB → 25.43 MB; the PromQL chunks 442.7 KB → 20.6 KB. The
PromQL
term catalog went from 7 entries to 113, generated from Prometheus's own
tables
and vendored with its MIT notice.

## Verification

- 76 files, +10.5k/−1.4k, ~9,100 tests passing across the touched areas.
- `vue-tsc` clean, `npm run build` exit 0.
- Every phase checked in a running browser against a live instance,
including
the 400 above: the ✕ now produces no request and no toast, adding a
filter and
re-picking a field each still fetch once, and the value list still
populates.

## Known, deliberately out of scope

- A filter still fetches twice (once on add, once on open) — that is
item 23,
  the cache read, not this PR.
- `useMetricsExplorer.loadFilterItem` has the same unguarded
`toISOString()`
  pattern on a different surface.
- `services/metrics.ts` and `services/search.ts` still carry dead
  `get_promql_series` wrappers now that nothing calls `/series`.
2026-08-03 22:29:04 +00:00
..
cypress/e2e
public feat: service discovery (#9469) 2025-12-04 13:58:09 +05:30
scripts fix: table migration to same components (#13451) 2026-07-30 12:18:23 +00:00
src feat(editor): rebuild query autocomplete, and fix the value path behind it (#13586) 2026-08-03 22:29:04 +00:00
test-results fix: logs correlation UI fixes (#9703) 2025-12-23 17:21:16 +05:30
tests/unit fix: remove quasar leftovers (#13180) 2026-07-14 11:35:46 +00:00
.gitignore fix: Data sources tab for AI integration (#12478) 2026-06-16 10:06:46 +00:00
.nvmrc build(web): add CI-parity verify script and pin Node version (#13393) 2026-07-23 06:21:39 +00:00
.prettierignore build: FE code format check for improved maintainability (#13351) 2026-07-24 07:11:39 +00:00
.prettierrc.json build: FE code format check for improved maintainability (#13351) 2026-07-24 07:11:39 +00:00
.stylelintrc.json refactor: design token migration + CI guards (#13173) 2026-07-20 18:06:21 +00:00
AGENTS.md feat: per-group and per-series alerting, and SLO measurement (#13547) 2026-07-31 07:23:22 +00:00
README.md
coverage.sh fix: Trace Details UI improvements (#10550) 2026-02-18 20:25:32 +05:30
cypress.config.ts chore: update copyright year to 2026 (#11166) 2026-04-07 09:57:53 +08:00
env.d.ts feat: ux improvement main (#11838) 2026-05-28 11:00:49 +00:00
eslint.config.js build: FE code format check for improved maintainability (#13351) 2026-07-24 07:11:39 +00:00
eslint.sh
index.html fix: change primary buttons text (#9189) 2025-11-21 11:02:46 +05:30
package-lock.json feat(editor): rebuild query autocomplete, and fix the value path behind it (#13586) 2026-08-03 22:29:04 +00:00
package.json feat(editor): rebuild query autocomplete, and fix the value path behind it (#13586) 2026-08-03 22:29:04 +00:00
postcss.config.js fix: Patterns UI change (#11711) 2026-05-11 07:09:10 +00:00
run_all.sh feat: simplify service discovery feature (#10946) 2026-03-30 13:47:40 +05:30
sbom.json chore: regenerate SBOMs (2026-07-20) (#13280) 2026-07-21 09:57:26 +08:00
serve.json
tsconfig.app.json build: add UI code quality checks and enhance linting processe (#13174) 2026-07-21 12:47:06 +00:00
tsconfig.config.json feat: Revamp metrics explorer (#13144) 2026-07-14 07:50:56 +00:00
tsconfig.json fix: automate update process of feature master list on about us page (#10010) 2026-01-17 18:06:23 +05:30
tsconfig.node.json fix: minor and patch version upgrade (#9741) 2025-12-25 15:51:10 +05:30
tsconfig.vitest.json feat: Revamp metrics explorer (#13144) 2026-07-14 07:50:56 +00:00
tsconfig.vitest.tsbuildinfo feat: Revamp metrics explorer (#13144) 2026-07-14 07:50:56 +00:00
vite.config.ts feat(editor): rebuild query autocomplete, and fix the value path behind it (#13586) 2026-08-03 22:29:04 +00:00
vitest.chat-history.config.ts feat: Ai metering for cloud (#10824) 2026-03-13 00:57:31 +05:30
vitest.config.ts fix: remove quasar leftovers (#13180) 2026-07-14 11:35:46 +00:00

README.md

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