polaris_dashboard
Read-only HTTP dashboard for Polaris
sessions, runs, and spans. The crate ships a precompiled SvelteKit SPA
embedded via rust-embed; register DashboardPlugin on a Polaris
Server and the dashboard is served at a configurable base path on the
same HTTP origin as the rest of your Polaris APIs.
The SPA itself is not built by this crate. It must be compiled and
built in its own repository; its build output is placed in assets/ and
embedded at compile time. When assets/ is empty, the crate still compiles
and every dashboard route returns a "bundle missing" notice instead of the UI.
Usage
[]
= { = "0.4", = ["file-store", "sessions-http", "dashboard"] }
= "0.1"
use Arc;
use ;
use ModelsPlugin;
use ;
use ;
use Server;
use ToolsPlugin;
use DashboardPlugin;
async
See examples/serve.rs for the minimum plugin stack required to drive
the runs and sessions panes.
OTLP viewer mode
To point the runs pane at arbitrary OpenTelemetry sources (a microservice, or Polaris exporting OTLP) instead of native Polaris tracing,
register OtelTracingPlugin as the trace surface. It mounts an OTLP/HTTP JSON
ingest endpoint (POST /v1/traces) plus the same /v1/tracing/* read routes
the SPA consumes, backed by its own in-memory TraceStore:
[]
# Drop `native-tracing` so the upstream TracingPlugin doesn't also claim
# `/v1/tracing/runs` — the two surfaces conflict on that route.
= { = "0.1", = false }
use Duration;
use ;
// Configure retention from the plugin surface, then `build()` to mount.
// (Use OtelTracingPlugin::new() for an in-memory collector with defaults.)
server
.add_plugins
.add_plugins;
The builder's knobs compose in any order and apply together — the TraceStore
is constructed once, in build(). The builder returns an
OtelTracingPlugin<Configuring>, which is deliberately not mountable, so
forgetting build() is a compile error rather than a silently-default
collector. For a pre-built or shared store, use OtelTracingPlugin::with_store.
OtelTracingPlugin and the default native-tracing surface are mutually
exclusive — pick one. TraceStore::list_runs / run_tree return the same
RunSummary / SpanTree shapes the SPA renders, so the OTLP collector is a
drop-in source for the existing panes.
Note:
POST /v1/tracesis an unauthenticated write endpoint unless the host installs anAuthProvider(see below); keep it on a trusted network.
Replacing the SPA
The crate is framework-agnostic — it embeds whatever static bundle is in
assets/ and serves it (index.html at the base path, embedded files for
matching sub-paths, index.html fallback for everything else). It does no
templating and injects no config, so any framework (React, Vue, Solid, plain
HTML) can replace the bundled SvelteKit SPA as long as the bundle:
- is client-routed and rooted at
index.html(no SSR); - emits asset URLs under the mount base — the SPA's build-time base must
match
DashboardPlugin'sbase_path(the shipped SPA is built for/dashboard; a mismatch 404s every asset andbuild()logs a warning); - calls the documented contracts at the same origin:
/v1/sessions/*(fromHttpPlugin) and/v1/tracing/*(fromTracingPluginorOtelTracingPlugin), consuming theRunSummary/SpanTreeJSON shapes; - self-configures — the host injects no settings.
Auth
The dashboard plugin does not register an AuthProvider. Whatever
provider you set on polaris_ai::app::HttpRouter covers the dashboard
routes too — same-origin, same middleware.
License
Apache-2.0