VictoriaLogs integration and shared Integrations settings section #220

Merged
lucas merged 1 commit from agent/issue-218-victorialogs into main 2026-11-03 16:24:49 +01:00
Collaborator

Closes: #218

Adds a read-only VictoriaLogs integration built on the Portainer pattern, and a Settings → Integrations section that holds both panels.

What's in it

  • Config (victorialogs/config.ts): URL, auth none/bearer/basic, optional numeric AccountID/ProjectID. The secret is write-only. A stored secret is reused only when the URL and auth mode are unchanged, and switching to none deletes the stored secret and username. URL validation now lives in integrations/url.ts (normalizeIntegrationUrl), shared with Portainer.
  • Client: GET-only. It sends tenant headers when they are set and redacts both the secret and the base64 basic credential. getVersion reads vm_app_version (falling back to vl_app_version) from /metrics. The capped body reader is now readBytesCapped in portainer/client.ts, so Portainer and VictoriaLogs use the same code.
  • Routes: GET/PUT/DELETE /api/victorialogs/config and POST /api/victorialogs/test. Save and test both check credentials with field_names?query=*&start=5m.
  • Tools: victorialogs_get_info, victorialogs_query, victorialogs_hits, victorialogs_field_names, victorialogs_field_values.
    • Window defaults to the last 1h. Times can be Unix seconds, ISO-8601, or a relative duration such as 5m (passed through unchanged).
    • limit defaults to 200 and is capped at 5000.
    • Large query output is saved to local://victorialogs/…, with the last 200 lines returned inline.
  • Gating: a per-workspace victorialogsEnabled flag (migration 023), off by default. Restricted (trigger) sessions treat these tools like the Portainer ones, both in the tool list and in the decidePolicy short-circuit.
  • Web: VictoriaLogsPanel, IntegrationsPanel, a workspace toggle, tool cards in components/tools/victorialogs/ (reusing PortainerShell), and /preview fixtures. ?section=portainer now opens Integrations.

Deviation from the plan

VictoriaLogsHitsResult has two extra fields, field and groups, so the card can show per-value totals when hits is grouped by field. buckets holds the counts summed across all groups.

Verification

  • bun test on the new victorialogs, routes, and Portainer suites: 57 pass.
  • Full server suite: 1224 pass, 1 fail. The failure is session-policy.test.ts "offers no git tools but keeps the comment tools". This branch doesn't touch that file, and the same test also fails typecheck (it passes 5 arguments where 6–7 are expected), so it was already broken before this change. Web and protocol typecheck clean.
  • Not run: the manual check against a real VictoriaLogs instance. The /metrics version metric name and the API response shapes are still unconfirmed, as the plan notes.
Closes: #218 Adds a read-only VictoriaLogs integration built on the Portainer pattern, and a Settings → Integrations section that holds both panels. ## What's in it - **Config** (`victorialogs/config.ts`): URL, auth `none`/`bearer`/`basic`, optional numeric `AccountID`/`ProjectID`. The secret is write-only. A stored secret is reused only when the URL and auth mode are unchanged, and switching to `none` deletes the stored secret and username. URL validation now lives in `integrations/url.ts` (`normalizeIntegrationUrl`), shared with Portainer. - **Client**: GET-only. It sends tenant headers when they are set and redacts both the secret and the base64 basic credential. `getVersion` reads `vm_app_version` (falling back to `vl_app_version`) from `/metrics`. The capped body reader is now `readBytesCapped` in `portainer/client.ts`, so Portainer and VictoriaLogs use the same code. - **Routes**: `GET/PUT/DELETE /api/victorialogs/config` and `POST /api/victorialogs/test`. Save and test both check credentials with `field_names?query=*&start=5m`. - **Tools**: `victorialogs_get_info`, `victorialogs_query`, `victorialogs_hits`, `victorialogs_field_names`, `victorialogs_field_values`. - Window defaults to the last 1h. Times can be Unix seconds, ISO-8601, or a relative duration such as `5m` (passed through unchanged). - `limit` defaults to 200 and is capped at 5000. - Large query output is saved to `local://victorialogs/…`, with the last 200 lines returned inline. - **Gating**: a per-workspace `victorialogsEnabled` flag (migration 023), off by default. Restricted (trigger) sessions treat these tools like the Portainer ones, both in the tool list and in the `decidePolicy` short-circuit. - **Web**: `VictoriaLogsPanel`, `IntegrationsPanel`, a workspace toggle, tool cards in `components/tools/victorialogs/` (reusing `PortainerShell`), and `/preview` fixtures. `?section=portainer` now opens Integrations. ## Deviation from the plan `VictoriaLogsHitsResult` has two extra fields, `field` and `groups`, so the card can show per-value totals when `hits` is grouped by `field`. `buckets` holds the counts summed across all groups. ## Verification - `bun test` on the new victorialogs, routes, and Portainer suites: 57 pass. - Full server suite: 1224 pass, 1 fail. The failure is `session-policy.test.ts` "offers no git tools but keeps the comment tools". This branch doesn't touch that file, and the same test also fails `typecheck` (it passes 5 arguments where 6–7 are expected), so it was already broken before this change. Web and protocol typecheck clean. - Not run: the manual check against a real VictoriaLogs instance. The `/metrics` version metric name and the API response shapes are still unconfirmed, as the plan notes.
Sessions in workspaces that opt in get five read-only LogsQL tools
(get_info, query, hits, field_names, field_values) against one
configured VictoriaLogs instance. The connection supports none, bearer
and basic auth plus an optional AccountID/ProjectID tenant; the secret
is write-only and verified before it is stored. Queries default to the
last hour and 200 rows (max 5000) and spill large results to
local://victorialogs/. Unattended sessions treat the tools like the
Portainer ones.

Settings gains an Integrations section holding the Portainer and
VictoriaLogs panels; the old portainer section link maps to it.

Co-Authored-By: Claude Opus 5.5 via omp-deck
lucas approved these changes 2026-11-03 16:24:44 +01:00
lucas merged commit da71870335 into main 2026-11-03 16:24:49 +01:00
lucas deleted branch agent/issue-218-victorialogs 2026-11-03 16:24:50 +01:00
Author
Collaborator

omp-deck failed to handle this event: the agent's turn failed.

Details are in omp-deck under webhook delivery 0b0a2926-2954-48a4-8737-338d4a3c7716 (session 01a1a1eb-c044-7000-bbfe-af4a09a694c2).

omp-deck failed to handle this event: the agent's turn failed. Details are in omp-deck under webhook delivery `0b0a2926-2954-48a4-8737-338d4a3c7716` (session `01a1a1eb-c044-7000-bbfe-af4a09a694c2`).
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lucas/omp-deck!220
No description provided.