Skip to content

Add workbench dashboards - #4128

Open
michaeljguarino wants to merge 1 commit into
masterfrom
add_dashboards
Open

Add workbench dashboards#4128
michaeljguarino wants to merge 1 commit into
masterfrom
add_dashboards

Conversation

@michaeljguarino

Copy link
Copy Markdown
Member

This is an initial schematization of datadog/grafana like dashboards for workbenches. This will serve a few purposes:

  1. Give users more traditional integrated observability, leveraging our translation across backends
  2. Store reliable source metrics to use in runs
  3. Make it easier to generate useful monitors, which we will extend and make an event source for automated workbench execution.

Test Plan

Test environment: https://console.your-env.onplural.sh/

Checklist

  • I have added a meaningful title and summary to convey the impact of this PR to a user.
  • If required, I have updated the Plural documentation accordingly.
  • I have added tests to cover my changes.
  • I have deployed the agent to a test environment and verified that it works as expected (required only when changing agent code).

Plural Flow: console

This is an initial schematization of datadog/grafana like dashboards for workbenches.  This will serve a few purposes:

1. Give users more traditional integrated observability, leveraging our translation across backends
2. Store reliable source metrics to use in runs
3. Make it easier to generate useful monitors, which we will extend and make an event source for automated workbench execution.
@michaeljguarino
michaeljguarino requested review from a team as code owners September 8, 2026 03:38
@michaeljguarino michaeljguarino added the enhancement New feature or request label Sep 8, 2026
@soffi-ai

soffi-ai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Soffi AI Summary

This PR introduces workbench dashboards — a Datadog/Grafana-style observability dashboard system embedded within AI workbenches. The feature enables users to compose grid-based dashboards with graphs sourced from any supported observability backend (Prometheus, Loki, Datadog, etc.), configurable variables/inputs, and flexible layout options.

The implementation spans the full stack:

  • Elixir schema & persistence: New Dashboard Ecto schema with associated graph, layout, input, and datasource sub-schemas; a new Postgres migration; and a dedicated Console.Deployments.Observability.Dashboard context module for CRUD operations.
  • GraphQL API: New mutations (createDashboard, updateDashboard, deleteDashboard) and queries (workbenchDashboards) wired through the observability resolver, with full RBAC policy enforcement.
  • Monitor enhancements: Monitor gains a prompt field and modes options for triggering workbench investigations, plus a user association for identity when launching monitor-triggered jobs. MonitorAttributes mirrors these additions.
  • Workbench extensions: Workbench gains a workbenchDashboards connection and an issueCounts field (counts by provider and status), surfacing issue analytics alongside the new dashboard data.
  • AI toolchain: New observability tools (metrics_label_search, plrl_logs_labels, plrl_metrics_label_search) are registered in the workbench toolchain, enabling AI agents to populate dashboard input options dynamically.
  • Go client & TypeScript: models_gen.go and the generated GraphQL TypeScript types are updated to reflect all new input/output types.
  • Tests: Comprehensive test coverage added for schema validation, mutation/query behavior, and the dashboard context module.

Changes

Workbench dashboards

  • Introduces a full Datadog/Grafana-style dashboard system for workbenches. Adds Ecto schemas, a Postgres migration, GraphQL mutations and queries, RBAC enforcement, and AI toolchain integrations that allow users and agents to compose and populate observability dashboards across any supported backend. Also extends monitors with prompt/modes/user fields for workbench-triggered investigations and adds issue count aggregations to the Workbench type. Updates Go client models and TypeScript generated types throughout. (b82e3ab)

Updated: 2026-09-08 03:40 UTC

Deploy in Soffi

@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces persistent workbench dashboards, typed graph and input definitions, GraphQL CRUD and datasource execution, structured observability label results, and monitor-trigger configuration. It also updates generated GraphQL clients and ReqLLM dependencies.

  • Adds dashboard persistence, layout validation, workbench ownership, and RBAC integration.
  • Executes dashboard metrics, logs, traces, and dynamic label queries through workbench observability tools.
  • Adds monitor prompt, mode, and actor fields intended for automated workbench investigations.
  • Includes schema, service, GraphQL, and datasource tests.
  • The execution path currently bypasses workbench tool policies, monitor-triggered jobs are not wired to the new monitor configuration, and the monitor actor foreign key can block user deletion.

Confidence Score: 1/5

This PR is not safe to merge until dashboard tool policies are enforced, monitor-triggered jobs consume the new monitor configuration, and monitor actor deletion semantics are defined.

Dashboard queries can bypass configured tool restrictions, firing monitors do not successfully use their newly persisted prompt, modes, or actor, and monitor ownership can prevent user deletion.

Files Needing Attention: lib/console/ai/workbench/toolchain.ex, lib/console/deployments/observability/dashboard.ex, lib/console/schema/monitor.ex, priv/repo/migrations/20260908020709_add_dashboard_schemas.exs

Security Review

Dashboard datasource calls bypass the workbench tool-policy boundary. Read-authorized callers can supply unrestricted dashboard substitutions and invoke configured observability tools without the policy evaluation used by normal workbench execution.

Important Files Changed

Filename Overview
lib/console/deployments/observability/dashboard.ex Adds dashboard variable substitution and typed datasource execution, but forwards unconstrained caller values directly to observability tools.
lib/console/ai/workbench/toolchain.ex Extends on-demand tool execution to workbenches, but invokes tools without enforcing configured workbench policies.
lib/console/schema/dashboard.ex Defines dashboard graphs, inputs, layouts, and persistence with useful structural validation.
lib/console/schema/monitor.ex Persists monitor prompt, modes, and actor identity, although those fields are not connected to triggered jobs.
lib/console/deployments/observability.ex Adds dashboard CRUD and records monitor creators, with authorization checks on dashboard writes.
priv/repo/migrations/20260908020709_add_dashboard_schemas.exs Adds aligned dashboard storage and monitor fields, but the monitor actor foreign key lacks deletion behavior.
lib/console/graphql/deployments/observability.ex Adds the dashboard GraphQL contract and monitor execution fields consistently with generated schemas.
lib/console/graphql/resolvers/deployments/observability.ex Adds dashboard CRUD, listing, and datasource resolvers while relying on the runtime for execution safeguards.

Reviews (1): Last reviewed commit: "Add workbench dashboards" | Re-trigger Greptile

Comment on lines 35 to 38
with tool when not is_nil(tool) <- Enum.find(tools, & Tool.name(&1) == name),
{:ok, %mod{} = t} when mod in @metrics_tools <- Tool.validate(tool, args) do
{:ok, %mod{} = t} <- Tool.validate(tool, args),
true <- mod in allowed do
mod.structured(t)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security Workbench Policies Are Bypassed

Dashboard datasource execution validates only the selected tool’s Ecto changeset before invoking it. The synthetic job lacks the workbench_id needed to load workbench policies, so those policies are never evaluated. Dashboard readers can therefore submit unrestricted substitutions and execute observability queries that the workbench policy was intended to reject.

How this was verified: The GraphQL input reaches direct tool invocation after unrestricted substitution, while the execution path neither loads nor evaluates the workbench policies.

Knowledge Base Used: Console AI workbenches

Comment on lines +20 to +22
field :prompt, :string

embeds_one :modes, Modes, on_replace: :update

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Monitor Jobs Cannot Start

The new monitor prompt, modes, and user identity are not propagated when a firing monitor starts an investigation. The alert consumer instead passes alert.workbench_webhook to create_workbench_bot_job/3. Monitor-created alerts do not set that association, so the value is nil and no matching function clause exists; the investigation crashes before creating a job. If a webhook is present, its prompt, actor, and modes are used instead of the monitor’s new fields.

Knowledge Base Used: Console AI workbenches

alter table(:monitors) do
add :modes, :map
add :prompt, :string, limit: 2048
add :user_id, references(:watchman_users, type: :uuid)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Monitor Ownership Blocks Deletion

The new monitors.user_id foreign key uses PostgreSQL’s restrictive default deletion behavior. Because every newly created monitor records its creator, deleting that user through the existing user-deletion service fails with a foreign-key violation while any monitor references them. Similar persistent actor links define on_delete: :nilify_all or :delete_all; this reference also needs an explicit lifecycle policy.

Knowledge Base Used: Console backend platform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant