Rebrand: Sentry -> Cairn OBS
Full rebrand across cosmetic branding, code identifiers, and infrastructure/data-plane naming, using the supplied Cairn OBS logo package. Cosmetic: favicon/logo swap (also closes a stale license-audit finding -- the old favicon was SvelteKit's unreplaced scaffold logo), new centered welcome landing page, larger/legible sidebar logo, page titles, CLAUDE.md/README/docs prose. Code identifiers: Go module path github.com/sentry/sentry -> github.com/cairnobs/cairnobs across all 13 modules and ~91 files (protoc regenerated); Rust crates sentry-agent/sentry-parser/sentry-search -> cairnobs-*; CLI sentryctl -> cairnobsctl; Terraform provider fully renamed (sentry_dashboard etc. -> cairnobs_dashboard, provider type, env vars); every session/auth cookie name; agent config paths and Windows service identity. Deliberately preserved: the gRPC wire protocol's protobuf packages (sentry.logs.v1, sentry.agent.v1) and their Go import directory (proto/sentry/...) -- renaming the wire-level package would break every currently-deployed agent binary (confirmed two real hosts, including mail.inbuxa.com, are actively streaming through this exact contract) until rebuilt and redeployed in lockstep with an ingest cutover. Only the Go module path wrapping the generated code changes. Infrastructure: every docker-compose container name (root and three component-level compose files); the Helm chart (directory, Chart.yaml, named-template helpers, all templates, values.yaml image repos); Kubernetes Operator (CRD group sentry.io -> cairnobs.io, both CRD YAML files, Go identifiers, RBAC markers); the coupled enterprise/tenantcrd package. Caught and fixed real path-coupling bugs along the way: the Helm chart's search/ingest volume mounts and the dev-only-credential detection constant vs. docker-compose.yml's literal values had to move together or a security warning would have silently stopped firing. Data plane: Postgres database sentry_metadata -> cairnobs_metadata and role sentry -> cairnobs; ClickHouse database sentry -> cairnobs; Kafka topic sentry.logs.raw -> cairnobs.logs.raw and its consumer groups. Source-level defaults, docker-compose.yml, and every migrate.sh/ provision script default updated together; already-applied migration files left untouched per this repo's immutable-migration convention. Verified at every layer: all 13 Go modules build/vet/test clean, both Rust workspaces (agent, search) build/clippy/test clean, npm run check/ build clean, docker compose config validates on all four compose files. Live-verified against a real docker stack multiple times through this work, including a final fresh-volume run confirming the actual renamed Postgres database/role, ClickHouse database, and Kafka topic all work end to end with a real login and query, zero console errors.
This commit is contained in:
+57
-179
@@ -1,204 +1,82 @@
|
||||
<script lang="ts">
|
||||
// Phase 2: single unified query page. Replaces Phase 0/1's two
|
||||
// separate pages (raw-SQL-only /query, free-text-only /search) --
|
||||
// see /docs/query-language-design.md and /docs/query-language-reference.md.
|
||||
// Phase 3: query bar extracted into $lib/QueryBar.svelte (reused by
|
||||
// the dashboard panel editor and alert rule editor), fetch calls
|
||||
// moved into $lib/api.ts.
|
||||
|
||||
import ResultsTable from '$lib/ResultsTable.svelte';
|
||||
import QueryBar from '$lib/QueryBar.svelte';
|
||||
import AddToDashboardModal from '$lib/components/AddToDashboardModal.svelte';
|
||||
// Landing page -- the app's first stop after login, distinct from
|
||||
// /search (the old root; every prior link/shortcut/drill-down that
|
||||
// used to point at "/" expecting the query page now points at
|
||||
// "/search" explicitly, see NavSidebar/CommandPalette/drilldown.ts).
|
||||
import logo from '$lib/assets/logo-stacked-dark.svg';
|
||||
import { Button } from '$lib/components/ui';
|
||||
import { runQuery as apiRunQuery, injectTimeRange, type Language } from '$lib/api';
|
||||
import { page } from '$app/state';
|
||||
|
||||
type HistoryEntry = { query: string; language: Language; at: number };
|
||||
|
||||
const HISTORY_KEY = 'sentry.queryHistory';
|
||||
const HISTORY_LIMIT = 20;
|
||||
|
||||
let query = $state('earliest=-1h | sort -timestamp | head 100');
|
||||
let language = $state<Language>('');
|
||||
let columns = $state<string[]>([]);
|
||||
let rows = $state<unknown[][]>([]);
|
||||
let error = $state('');
|
||||
let warnings = $state<string[]>([]);
|
||||
let loading = $state(false);
|
||||
let hasRun = $state(false);
|
||||
let history = $state<HistoryEntry[]>(loadHistory());
|
||||
|
||||
function loadHistory(): HistoryEntry[] {
|
||||
if (typeof sessionStorage === 'undefined') return [];
|
||||
try {
|
||||
const raw = sessionStorage.getItem(HISTORY_KEY);
|
||||
return raw ? JSON.parse(raw) : [];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function saveHistory(entry: HistoryEntry) {
|
||||
history = [entry, ...history.filter((h) => h.query !== entry.query)].slice(0, HISTORY_LIMIT);
|
||||
try {
|
||||
sessionStorage.setItem(HISTORY_KEY, JSON.stringify(history));
|
||||
} catch {
|
||||
// session storage unavailable/full -- history is a convenience,
|
||||
// not worth failing the query over
|
||||
}
|
||||
}
|
||||
|
||||
function useHistoryEntry(entry: HistoryEntry) {
|
||||
query = entry.query;
|
||||
language = entry.language;
|
||||
}
|
||||
|
||||
async function runQuery() {
|
||||
loading = true;
|
||||
error = '';
|
||||
warnings = [];
|
||||
try {
|
||||
const result = await apiRunQuery(query, language);
|
||||
columns = result.columns ?? [];
|
||||
rows = result.rows ?? [];
|
||||
warnings = result.warnings ?? [];
|
||||
saveHistory({ query, language, at: Date.now() });
|
||||
} catch (e) {
|
||||
error = e instanceof Error ? e.message : String(e);
|
||||
columns = [];
|
||||
rows = [];
|
||||
} finally {
|
||||
loading = false;
|
||||
hasRun = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Drill-down landing: a chart's "click to drill into query"
|
||||
// (see $lib/charts/drilldown.ts) navigates here with ?q=&earliest=&latest=.
|
||||
// Runs once per navigation, not on every reactive change, so editing
|
||||
// the query bar afterwards doesn't keep re-injecting the original
|
||||
// drill-down range.
|
||||
let consumedDrillDownParams = false;
|
||||
$effect(() => {
|
||||
const params = page.url.searchParams;
|
||||
const q = params.get('q');
|
||||
if (!q || consumedDrillDownParams) return;
|
||||
consumedDrillDownParams = true;
|
||||
const earliest = params.get('earliest');
|
||||
const latest = params.get('latest');
|
||||
query = earliest ? injectTimeRange(q, earliest, latest ?? 'now') : q;
|
||||
runQuery();
|
||||
});
|
||||
|
||||
let addToDashboardOpen = $state(false);
|
||||
const shortcuts: { href: string; label: string; hint: string }[] = [
|
||||
{ href: '/search', label: 'Search', hint: 'Query logs with filters, free-text, or raw SQL' },
|
||||
{ href: '/dashboards', label: 'Dashboards', hint: 'Saved multi-panel views over your queries' },
|
||||
{ href: '/agents', label: 'Agents', hint: 'Everything reporting logs, and its config' },
|
||||
{ href: '/hosts', label: 'Hosts', hint: 'Per-host log volume and service breakdown' }
|
||||
];
|
||||
</script>
|
||||
|
||||
<main>
|
||||
<h1>Sentry — Query</h1>
|
||||
<p>
|
||||
One query bar for both filter/stats queries and free-text search — see
|
||||
<code>/docs/query-language-reference.md</code> in the repo for the full syntax, or the cheat
|
||||
sheet below. Build reusable queries into a <a href="/dashboards">dashboard</a>.
|
||||
<img src={logo} alt="Cairn OBS" class="logo" />
|
||||
<p class="tagline">
|
||||
One query bar for filter/stats queries and free-text search across every host and service
|
||||
you're shipping logs from.
|
||||
</p>
|
||||
|
||||
<QueryBar bind:query bind:language onRun={runQuery} {loading} errorMessage={error} {warnings} />
|
||||
|
||||
{#if error}
|
||||
<p class="error">Error: {error}</p>
|
||||
{/if}
|
||||
|
||||
{#if hasRun && !error && columns.length > 0}
|
||||
<div class="results-actions">
|
||||
<Button size="sm" variant="secondary" onclick={() => (addToDashboardOpen = true)}>
|
||||
+ Add as panel to dashboard
|
||||
<div class="shortcuts">
|
||||
{#each shortcuts as s (s.href)}
|
||||
<Button href={s.href} variant="secondary">
|
||||
<span class="shortcut-label">{s.label}</span>
|
||||
<span class="shortcut-hint">{s.hint}</span>
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<ResultsTable {columns} {rows} {hasRun} />
|
||||
|
||||
<AddToDashboardModal bind:open={addToDashboardOpen} {query} {language} />
|
||||
|
||||
{#if history.length > 0}
|
||||
<details class="history">
|
||||
<summary>Query history ({history.length})</summary>
|
||||
<ul>
|
||||
{#each history as entry (entry.at)}
|
||||
<li>
|
||||
<button class="history-item" onclick={() => useHistoryEntry(entry)}>
|
||||
<code>{entry.query}</code>
|
||||
</button>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</details>
|
||||
{/if}
|
||||
|
||||
<details class="cheatsheet">
|
||||
<summary>Pipe syntax cheat sheet</summary>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr><td><code>field=value</code></td><td>filter on a structured field</td></tr>
|
||||
<tr><td><code>"free text"</code> / bare word</td><td>full-text search on <code>message</code></td></tr>
|
||||
<tr><td><code>message:"exact phrase"</code></td><td>explicit full-text search</td></tr>
|
||||
<tr><td><code>| where field>value</code></td><td>additional structured filter</td></tr>
|
||||
<tr><td><code>| stats count by field</code></td><td>aggregate (count/sum/avg/min/max)</td></tr>
|
||||
<tr><td><code>| sort -field</code></td><td>sort descending (<code>+field</code> for ascending)</td></tr>
|
||||
<tr><td><code>| fields a, b</code></td><td>project specific columns</td></tr>
|
||||
<tr><td><code>| head 50</code> / <code>| tail 50</code></td><td>limit results</td></tr>
|
||||
<tr><td><code>earliest=-1h</code> / <code>latest=...</code></td><td>time range (relative or RFC3339)</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Full reference: <code>/docs/query-language-reference.md</code> in the repo.</p>
|
||||
</details>
|
||||
{/each}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<style>
|
||||
main {
|
||||
max-width: 64rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
max-width: 40rem;
|
||||
margin: 0 auto;
|
||||
padding-top: var(--space-8, 4rem);
|
||||
}
|
||||
h1 {
|
||||
font-size: var(--text-xl);
|
||||
margin-bottom: var(--space-2);
|
||||
.logo {
|
||||
width: 11rem;
|
||||
height: 11rem;
|
||||
}
|
||||
p {
|
||||
.tagline {
|
||||
margin-top: var(--space-4);
|
||||
color: var(--color-text-muted);
|
||||
max-width: 32rem;
|
||||
}
|
||||
.error {
|
||||
color: var(--color-danger);
|
||||
.shortcuts {
|
||||
margin-top: var(--space-6);
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--space-3);
|
||||
width: 100%;
|
||||
}
|
||||
.results-actions {
|
||||
margin: var(--space-3) 0;
|
||||
}
|
||||
.history ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: var(--space-2) 0 0;
|
||||
}
|
||||
.history-item {
|
||||
background: none;
|
||||
border: none;
|
||||
.shortcuts :global(.btn) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: var(--space-1);
|
||||
height: auto;
|
||||
padding: var(--space-3) var(--space-4);
|
||||
text-align: left;
|
||||
padding: var(--space-1) 0;
|
||||
cursor: pointer;
|
||||
color: var(--color-accent);
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
.history-item:hover {
|
||||
text-decoration: underline;
|
||||
.shortcut-label {
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
.cheatsheet {
|
||||
margin-top: var(--space-5);
|
||||
font-size: var(--text-sm);
|
||||
.shortcut-hint {
|
||||
font-size: var(--text-xs);
|
||||
color: var(--color-text-muted);
|
||||
font-weight: var(--font-weight-normal);
|
||||
}
|
||||
.cheatsheet table {
|
||||
border-collapse: collapse;
|
||||
margin-top: var(--space-2);
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
.cheatsheet td {
|
||||
padding: var(--space-1) var(--space-4) var(--space-1) 0;
|
||||
vertical-align: top;
|
||||
@media (max-width: 30rem) {
|
||||
.shortcuts {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user