The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
#270 #265 #264
narrow-adventuree48964048614
diff --git a/backend/app/controllers/log.controller.go b/backend/app/controllers/log.controller.goindex 42bc6dea..61e4e810 100644--- a/backend/app/controllers/log.controller.go+++ b/backend/app/controllers/log.controller.go@@ -20,9 +20,10 @@ type logController struct{}var LogController = logController{}type LogAttributeFilterRequest struct {- Scope string `json:"scope"` // "resource" | "scope" | "log"- Key string `json:"key"`- Value string `json:"value"`+ Scope string `json:"scope"` // "resource" | "scope" | "log"+ Key string `json:"key"`+ Value string `json:"value"`+ Exclude bool `json:"exclude"`}type LogSearchRequest struct {@@ -35,6 +36,9 @@ type LogSearchRequest struct {MinSeverity uint8 `json:"minSeverity"`ServiceName string `json:"serviceName"`TraceId string `json:"traceId"`+ SpanId string `json:"spanId"`+ ScopeName string `json:"scopeName"`+ Body string `json:"body"`DistributedTraceId string `json:"distributedTraceId"`ExcludeTraceId string `json:"excludeTraceId"`AttributeFilters []LogAttributeFilterRequest `json:"attributeFilters"`@@ -43,8 +47,10 @@ type LogSearchRequest struct {// Max time range allowed for body search without any other selector. Keeps a// naïve "find all logs containing 'error' for the past 30 days" query from-// scanning the full body column.-const bodySearchUnscopedMaxRange = 24 * time.Hour+// scanning the full body column. The slack matters: the frontend's "24h"+// preset rounds the range end up to the end of the current minute, so the+// received range is slightly over 24h and must not trip the gate.+const bodySearchUnscopedMaxRange = 24*time.Hour + 5*time.Minutefunc (l logController) List(c *gin.Context) {projectId, err := middleware.GetProjectId(c)@@ -70,6 +76,9 @@ func (l logController) List(c *gin.Context) {hasSelector := request.MinSeverity > 0 ||request.ServiceName != "" ||request.TraceId != "" ||+ request.SpanId != "" ||+ request.ScopeName != "" ||+ request.Body != "" ||request.DistributedTraceId != "" ||len(request.AttributeFilters) > 0rangeTooWide := request.ToDate.Sub(request.FromDate) > bodySearchUnscopedMaxRange@@ -87,9 +96,10 @@ func (l logController) List(c *gin.Context) {continue}attrFilters = append(attrFilters, telemetry.LogAttributeFilter{- Scope: f.Scope,- Key: f.Key,- Value: f.Value,+ Scope: f.Scope,+ Key: f.Key,+ Value: f.Value,+ Exclude: f.Exclude,})}@@ -102,6 +112,9 @@ func (l logController) List(c *gin.Context) {MinSeverity: request.MinSeverity,ServiceName: request.ServiceName,TraceId: request.TraceId,+ SpanId: request.SpanId,+ ScopeName: request.ScopeName,+ Body: request.Body,AttributeFilters: attrFilters,OrderBy: request.OrderBy,SortDirection: request.SortDirection,diff --git a/backend/app/repositories/telemetry/attribute_filter_exclude_test.go b/backend/app/repositories/telemetry/attribute_filter_exclude_test.gonew file mode 100644index 00000000..fdf63625--- /dev/null+++ b/backend/app/repositories/telemetry/attribute_filter_exclude_test.go@@ -0,0 +1,57 @@+//go:build !telemetry_ch++package telemetry++import (+ "context"+ "testing"+ "time"++ "github.com/google/uuid"+ "github.com/tracewayapp/traceway/backend/app/models"+)++func TestLogRecordRepository_Search_ExcludeAttributeFilter(t *testing.T) {+ setupTestDB(t)+ ctx := context.Background()+ projectId := uuid.New()+ base := time.Date(2026, 1, 1, 12, 0, 0, 0, time.UTC)++ record := func(attrs map[string]string) models.LogRecord {+ return models.LogRecord{+ Id: uuid.New(),+ ProjectId: projectId,+ Timestamp: base,+ ServiceName: "checkout",+ Body: "request handled",+ LogAttributes: attrs,+ }+ }+ if err := LogRecordRepository.InsertAsync(ctx, []models.LogRecord{+ record(map[string]string{"http.route": "GET /checkout"}),+ record(map[string]string{"http.route": "GET /cart"}),+ record(map[string]string{"other.key": "x"}),+ }); err != nil {+ t.Fatalf("InsertAsync: %v", err)+ }++ records, total, err := LogRecordRepository.Search(ctx, LogSearchParams{+ ProjectId: projectId,+ FromDate: base.Add(-time.Hour),+ ToDate: base.Add(time.Hour),+ AttributeFilters: []LogAttributeFilter{{Scope: "log", Key: "http.route", Value: "GET /checkout", Exclude: true}},+ })+ if err != nil {+ t.Fatalf("Search (exclude attribute filter): %v", err)+ }+ // The excluded row is dropped; the row that doesn't carry the attribute at+ // all must survive the exclusion.+ if total != 2 || len(records) != 2 {+ t.Fatalf("exclude attribute filter returned %d rows (total=%d), want 2", len(records), total)+ }+ for _, r := range records {+ if r.LogAttributes["http.route"] == "GET /checkout" {+ t.Errorf("excluded record (http.route=GET /checkout) was returned")+ }+ }+}diff --git a/backend/app/repositories/telemetry/clickhouse/log_record.repository.go b/backend/app/repositories/telemetry/clickhouse/log_record.repository.goindex 110269ef..50a6e3f8 100644--- a/backend/app/repositories/telemetry/clickhouse/log_record.repository.go+++ b/backend/app/repositories/telemetry/clickhouse/log_record.repository.go@@ -208,13 +208,31 @@ func (r *logRecordRepository) buildWhere(params shared.LogSearchParams) (string,clauses = append(clauses, "trace_id = ?")args = append(args, params.TraceId)}+ if params.SpanId != "" {+ clauses = append(clauses, "span_id = ?")+ args = append(args, params.SpanId)+ }+ if params.ScopeName != "" {+ clauses = append(clauses, "scope_name = ?")+ args = append(args, params.ScopeName)+ }+ if params.Body != "" {+ clauses = append(clauses, "body = ?")+ args = append(args, params.Body)+ }for _, f := range params.AttributeFilters {col := attrColumn(f.Scope)if col == "" {continue}- clauses = append(clauses, col+"[?] = ?")+ op := "="+ if f.Exclude {+ // Map columns default missing keys to '', so != also keeps rows+ // that don't carry the attribute at all.+ op = "!="+ }+ clauses = append(clauses, col+"[?] "+op+" ?")args = append(args, f.Key, f.Value)}diff --git a/backend/app/repositories/telemetry/duckdb/log_record.repository.go b/backend/app/repositories/telemetry/duckdb/log_record.repository.goindex 243a3b19..b3a5efec 100644--- a/backend/app/repositories/telemetry/duckdb/log_record.repository.go+++ b/backend/app/repositories/telemetry/duckdb/log_record.repository.go@@ -235,6 +235,18 @@ func (r *logRecordRepository) buildWhere(params shared.LogSearchParams) (string,clauses = append(clauses, "trace_id = :trace_id")args["trace_id"] = params.TraceId}+ if params.SpanId != "" {+ clauses = append(clauses, "span_id = :span_id")+ args["span_id"] = params.SpanId+ }+ if params.ScopeName != "" {+ clauses = append(clauses, "scope_name = :scope_name")+ args["scope_name"] = params.ScopeName+ }+ if params.Body != "" {+ clauses = append(clauses, "body = :body")+ args["body"] = params.Body+ }for i, f := range params.AttributeFilters {col := attrColumn(f.Scope)@@ -243,8 +255,15 @@ func (r *logRecordRepository) buildWhere(params shared.LogSearchParams) (string,}keyPH := fmt.Sprintf("attr_k%d", i)valPH := fmt.Sprintf("attr_v%d", i)- clauses = append(clauses,- fmt.Sprintf("json_extract_string(%s, '$.\"' || :%s || '\"') = :%s", col, keyPH, valPH))+ if f.Exclude {+ // COALESCE keeps rows that don't carry the attribute at all+ // (json_extract_string yields NULL there, and NULL != value is NULL).+ clauses = append(clauses,+ fmt.Sprintf("COALESCE(json_extract_string(%s, '$.\"' || :%s || '\"'), '') != :%s", col, keyPH, valPH))+ } else {+ clauses = append(clauses,+ fmt.Sprintf("json_extract_string(%s, '$.\"' || :%s || '\"') = :%s", col, keyPH, valPH))+ }args[keyPH] = f.Keyargs[valPH] = f.Value}diff --git a/backend/app/repositories/telemetry/shared/types.go b/backend/app/repositories/telemetry/shared/types.goindex b69fa3aa..cf71dadf 100644--- a/backend/app/repositories/telemetry/shared/types.go+++ b/backend/app/repositories/telemetry/shared/types.go@@ -28,9 +28,10 @@ type FiredNotification struct {// query (Map columns with bloom-filter indexes on ClickHouse, JSON on// SQLite/DuckDB).type LogAttributeFilter struct {- Scope string- Key string- Value string+ Scope string+ Key string+ Value string+ Exclude bool}type LogSearchParams struct {@@ -43,6 +44,9 @@ type LogSearchParams struct {ServiceName stringTraceId stringTraceIds []string+ SpanId string+ ScopeName string+ Body stringAttributeFilters []LogAttributeFilterOrderBy stringSortDirection stringdiff --git a/backend/app/repositories/telemetry/sqlite/log_record.repository.go b/backend/app/repositories/telemetry/sqlite/log_record.repository.goindex 758c1db2..f747a702 100644--- a/backend/app/repositories/telemetry/sqlite/log_record.repository.go+++ b/backend/app/repositories/telemetry/sqlite/log_record.repository.go@@ -220,6 +220,18 @@ func (r *logRecordRepository) buildWhere(params shared.LogSearchParams) (string,clauses = append(clauses, "trace_id = :trace_id")args["trace_id"] = params.TraceId}+ if params.SpanId != "" {+ clauses = append(clauses, "span_id = :span_id")+ args["span_id"] = params.SpanId+ }+ if params.ScopeName != "" {+ clauses = append(clauses, "scope_name = :scope_name")+ args["scope_name"] = params.ScopeName+ }+ if params.Body != "" {+ clauses = append(clauses, "body = :body")+ args["body"] = params.Body+ }for i, f := range params.AttributeFilters {col := attrColumn(f.Scope)@@ -228,8 +240,15 @@ func (r *logRecordRepository) buildWhere(params shared.LogSearchParams) (string,}keyPH := fmt.Sprintf("attr_k%d", i)valPH := fmt.Sprintf("attr_v%d", i)- clauses = append(clauses,- fmt.Sprintf("json_extract(%s, '$.\"' || :%s || '\"') = :%s", col, keyPH, valPH))+ if f.Exclude {+ // COALESCE keeps rows that don't carry the attribute at all+ // (json_extract yields NULL there, and NULL != value is NULL).+ clauses = append(clauses,+ fmt.Sprintf("COALESCE(json_extract(%s, '$.\"' || :%s || '\"'), '') != :%s", col, keyPH, valPH))+ } else {+ clauses = append(clauses,+ fmt.Sprintf("json_extract(%s, '$.\"' || :%s || '\"') = :%s", col, keyPH, valPH))+ }args[keyPH] = f.Keyargs[valPH] = f.Value}diff --git a/examples/devtesting-embedded/devtesting-embedded b/examples/devtesting-embedded/devtesting-embeddedindex abc454fc..01aec00c 100755Binary files a/examples/devtesting-embedded/devtesting-embedded and b/examples/devtesting-embedded/devtesting-embedded differdiff --git a/examples/devtesting-embedded/go.mod b/examples/devtesting-embedded/go.modindex 43d8ff17..18397ba5 100644--- a/examples/devtesting-embedded/go.mod+++ b/examples/devtesting-embedded/go.mod@@ -156,6 +156,4 @@ require (replace (github.com/tracewayapp/traceway/backend => /Users/dusanstanojevic/Documents/workspace/traceway/backendgithub.com/tracewayapp/traceway/cli => /Users/dusanstanojevic/Documents/workspace/traceway/cli- go.tracewayapp.com => /Users/dusanstanojevic/Documents/workspace/go-client- go.tracewayapp.com/tracewaygin => /Users/dusanstanojevic/Documents/workspace/go-client/tracewaygin)diff --git a/examples/devtesting-embedded/go.sum b/examples/devtesting-embedded/go.sumindex 57b635b9..ad918dd0 100644--- a/examples/devtesting-embedded/go.sum+++ b/examples/devtesting-embedded/go.sum@@ -355,6 +355,10 @@ go.opentelemetry.io/proto/otlp/collector/profiles/v1development v0.3.0 h1:AWBLtJgo.opentelemetry.io/proto/otlp/collector/profiles/v1development v0.3.0/go.mod h1:kCdbxyM9kfmv3v4ZQzZ2pACxoQ6lE0IsjP+UcZwQnr4=go.opentelemetry.io/proto/otlp/profiles/v1development v0.3.0 h1:ZQs05qo3Yh4KUHeVH6v89xErwmsvgA/cLX2/w5Ikp+k=go.opentelemetry.io/proto/otlp/profiles/v1development v0.3.0/go.mod h1:3iiRVKaCfVo0UI1ZaSMm5WbCBbINRqVlD9SUmvyBNrY=+go.tracewayapp.com v1.0.4 h1:n9O1OQDRDNPwCBnb7kNd+DutcVoPj9uLn+c9n4M7qzM=+go.tracewayapp.com v1.0.4/go.mod h1:sFMbWkA2TbT1OW6Hx+6jMDum2yt96irUXpC5lymblyc=+go.tracewayapp.com/tracewaygin v1.0.2 h1:MRAvtOKz0zceoe1Ee7pl5eciSerc+gIogC7oWJaKQf8=+go.tracewayapp.com/tracewaygin v1.0.2/go.mod h1:p/26TIhpfte86Gp3QJpA8Q72pJShFXX1jogIiKG2LXQ=go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=diff --git a/examples/devtesting-embedded/main.go b/examples/devtesting-embedded/main.goindex eea6ed7c..c6ba6dd6 100644--- a/examples/devtesting-embedded/main.go+++ b/examples/devtesting-embedded/main.go@@ -326,6 +326,38 @@ func main() {c.JSON(http.StatusOK, gin.H{"status": "ok"})})+ router.GET("/api/test-template-logs", func(c *gin.Context) {+ ctx := c.Request.Context()+ for i := 0; i < 3; i++ {+ requestId := uuid.NewString()+ backendSvc.log(ctx, otellog.SeverityDebug, "DEBUG",+ "Incoming call received.ProviderClientId: {ProviderClientId}, CallerId: {CallerId}, Method: {Method}, RequestId: {RequestId}",+ otellog.String("ProviderClientId", "[Devices, dusan-macbook, 1, rpc]"),+ otellog.String("CallerId", "[Portal, web-6f2c, 0, rpc]"),+ otellog.String("Method", "EnterManualMode"),+ otellog.String("RequestId", requestId),+ )+ backendSvc.log(ctx, otellog.SeverityDebug, "DEBUG",+ "Call handled successfully.ProviderClientId: {ProviderClientId},RequestId: {RequestId},Method: {MethodIdentity}",+ otellog.String("ProviderClientId", "[Devices, dusan-macbook, 1, rpc]"),+ otellog.String("RequestId", requestId),+ otellog.String("MethodIdentity", "MethodIdentity { Namespace = MqttComm.Devices, Name = EnterManualMode }"),+ )+ }+ // Format spec after the name + a non-string attribute value.+ backendSvc.log(ctx, otellog.SeverityWarn, "WARN",+ "Slow provider response.Provider: {Provider}, Elapsed: {ElapsedMs:N0}ms",+ otellog.String("Provider", "Devices"),+ otellog.Int("ElapsedMs", 1874),+ )+ // {MaxAttempts} has no matching attribute and must render literally.+ backendSvc.log(ctx, otellog.SeverityInfo, "INFO",+ "Retrying delivery.Attempt: {Attempt} of {MaxAttempts}",+ otellog.String("Attempt", "2"),+ )+ c.JSON(http.StatusOK, gin.H{"status": "ok"})+ })+router.GET("/api/test-sse", func(c *gin.Context) {span := trace.SpanFromContext(c.Request.Context())span.SetAttributes(attribute.Bool("traceway.is_stream", true))@@ -360,6 +392,7 @@ func main() {fmt.Printf(" curl http://localhost:%d/api/test-distributed-logs\n", appPort)fmt.Printf(" curl http://localhost:%d/api/test-long-attributes\n", appPort)fmt.Printf(" curl http://localhost:%d/api/test-long-log-attributes\n", appPort)+ fmt.Printf(" curl http://localhost:%d/api/test-template-logs\n", appPort)fmt.Println()fmt.Println(" Streaming endpoints (is_stream — expect a 'Stream' badge):")fmt.Printf(" curl -N http://localhost:%d/api/test-sse\n", appPort)diff --git a/frontend/src/app.html b/frontend/src/app.htmlindex 386b2ce7..1e7fb2d3 100644--- a/frontend/src/app.html+++ b/frontend/src/app.html@@ -18,9 +18,74 @@}} catch (e) {}</script>+ <style>+ #splash {+ position: fixed;+ inset: 0;+ display: flex;+ align-items: center;+ justify-content: center;+ color: #71717a;+ pointer-events: none;+ }+ html.dark #splash {+ color: #fff;+ }+ #splash svg {+ width: 4.5rem;+ height: 4.5rem;+ }+ #splash .outer-ring {+ animation: splash-spin 3s linear infinite;+ transform-origin: 250px 250px;+ }+ #splash .middle-ring {+ animation: splash-spin-reverse 2s linear infinite;+ transform-origin: 250px 250px;+ }+ #splash .inner-ring {+ animation: splash-spin 1.2s linear infinite;+ transform-origin: 250px 250px;+ }+ @keyframes splash-spin {+ from {+ transform: rotate(0deg);+ }+ to {+ transform: rotate(360deg);+ }+ }+ @keyframes splash-spin-reverse {+ from {+ transform: rotate(0deg);+ }+ to {+ transform: rotate(-360deg);+ }+ }+ </style>%sveltekit.head%</head><body data-sveltekit-preload-data="hover">+ <div id="splash">+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500">+ <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="31.25">+ <g class="outer-ring">+ <path+ d="M250 41.67c115.06 0 208.33 93.27 208.33 208.33c0 37.94-10.15 73.54-27.88 104.17M104.17 101.23A207.71 207.71 0 0 0 41.67 250c0 115.06 93.27 208.33 208.33 208.33c37.94 0 73.54-10.15 104.17-27.88"+ />+ </g>+ <g class="middle-ring">+ <path+ d="M104.17 250c0 30.98 9.67 59.71 26.15 83.33M250 104.17a145.83 145.83 0 1 1-62.5 277.63"+ />+ </g>+ <g class="inner-ring">+ <path d="M250 333.33a83.33 83.33 0 0 0 0-166.67" />+ </g>+ </g>+ </svg>+ </div><div style="display: contents">%sveltekit.body%</div></body></html>diff --git a/frontend/src/lib/components/trace-logs/expanded-log-row.svelte b/frontend/src/lib/components/trace-logs/expanded-log-row.svelteindex e4c4fe83..76d9f29c 100644--- a/frontend/src/lib/components/trace-logs/expanded-log-row.svelte+++ b/frontend/src/lib/components/trace-logs/expanded-log-row.svelte@@ -9,20 +9,38 @@scopeAttributes?: Record<string, string> | null;logAttributes?: Record<string, string> | null;};++ export type MetaFilterField = 'body' | 'traceId' | 'spanId' | 'scopeName';</script><script lang="ts">import * as Table from '$lib/components/ui/table';import { AttributesGrid, AttributesView } from '$lib/components/ui/attributes-grid';+ import type { AttributeFilterState } from '$lib/components/ui/attributes-grid';let {log,- colspan+ colspan,+ filterStateFor,+ onFilterToggle,+ metaFilterStateFor,+ onMetaFilterToggle}: {log: ExpandedLogRecord;colspan: number;+ filterStateFor?: (key: string, value: string) => AttributeFilterState;+ onFilterToggle?: (key: string, value: string) => void;+ metaFilterStateFor?: (field: MetaFilterField, value: string) => AttributeFilterState;+ onMetaFilterToggle?: (field: MetaFilterField, value: string) => void;} = $props();+ function metaTileProps(field: MetaFilterField, value: string) {+ return {+ filterState: metaFilterStateFor?.(field, value) ?? 'none',+ onFilterToggle: onMetaFilterToggle ? () => onMetaFilterToggle(field, value) : undefined+ };+ }+function mergedAttributes(): Record<string, string> {const out: Record<string, string> = {};const push = (m: Record<string, string> | null | undefined, prefix: string) => {@@ -52,23 +70,38 @@<div class="space-y-3"><div class="grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3"><div class="sm:col-span-2 md:col-span-3">- <AttributesView title="Body" value={log.body} />+ <AttributesView title="Body" value={log.body} {...metaTileProps('body', log.body)} /></div>{#if log.traceId}- <AttributesView title="Trace ID" value={log.traceId} />+ <AttributesView+ title="Trace ID"+ value={log.traceId}+ {...metaTileProps('traceId', log.traceId)}+ />{/if}{#if log.spanId}- <AttributesView title="Span ID" value={log.spanId} />+ <AttributesView+ title="Span ID"+ value={log.spanId}+ {...metaTileProps('spanId', log.spanId)}+ />{/if}{#if log.scopeName}+ <!-- The tile shows name@version, but the filter matches scope_name. --><AttributesViewtitle="Scope"value={log.scopeName + (log.scopeVersion ? `@${log.scopeVersion}` : '')}+ {...metaTileProps('scopeName', log.scopeName)}/>{/if}</div>{#if hasAttributes()}- <AttributesGrid attributes={mergedAttributes()} collapsedCount={6} />+ <AttributesGrid+ attributes={mergedAttributes()}+ collapsedCount={6}+ {filterStateFor}+ {onFilterToggle}+ />{/if}</div></Table.Cell>diff --git a/frontend/src/lib/components/trace-logs/log-message.svelte b/frontend/src/lib/components/trace-logs/log-message.sveltenew file mode 100644index 00000000..f311d987--- /dev/null+++ b/frontend/src/lib/components/trace-logs/log-message.svelte@@ -0,0 +1,66 @@+<script lang="ts" module>+ export type MessageSegment =+ | { type: 'text'; text: string }+ | { type: 'param'; name: string; value: string };++ // .NET-style message template placeholders: {Name}, {@Name}, {$Name},+ // optionally with alignment/format specs like {Count,5:N0}.+ const PLACEHOLDER = /\{([@$]?)([A-Za-z_][A-Za-z0-9_.]*)(?:,-?\d+)?(?::[^{}]*)?\}/g;++ // Split a rendered log line into text and parameter segments by resolving+ // template placeholders against the log's attributes. Placeholders without+ // a matching attribute stay as literal text.+ export function segmentMessage(+ line: string,+ attributes: Record<string, string> | null | undefined+ ): MessageSegment[] {+ if (!attributes || !line.includes('{')) {+ return [{ type: 'text', text: line }];+ }+ const segments: MessageSegment[] = [];+ let last = 0;+ for (const m of line.matchAll(PLACEHOLDER)) {+ const name = m[2];+ const value = attributes[name] ?? attributes[m[1] + name];+ if (value === undefined) continue;+ if (m.index > last) {+ segments.push({ type: 'text', text: line.slice(last, m.index) });+ }+ segments.push({ type: 'param', name, value });+ last = m.index + m[0].length;+ }+ if (segments.length === 0) {+ return [{ type: 'text', text: line }];+ }+ if (last < line.length) {+ segments.push({ type: 'text', text: line.slice(last) });+ }+ return segments;+ }+</script>++<script lang="ts">+ import * as Tooltip from '$lib/components/ui/tooltip';++ let {+ body,+ attributes+ }: {+ body: string;+ attributes: Record<string, string> | null | undefined;+ } = $props();++ const line = $derived.by(() => {+ if (!body) return '';+ const nl = body.indexOf('\n');+ return nl === -1 ? body : body.slice(0, nl);+ });++ const segments = $derived(segmentMessage(line, attributes));+</script>++{#each segments as seg, i (i)}{#if seg.type === 'text'}{seg.text}{:else}<Tooltip.Root+ ><Tooltip.Trigger class="cursor-default align-baseline text-blue-500 dark:text-blue-400"+ >{seg.value}</Tooltip.Trigger+ ><Tooltip.Content class="font-mono">{seg.name}</Tooltip.Content></Tooltip.Root+ >{/if}{/each}diff --git a/frontend/src/lib/components/trace-logs/trace-logs-panel.svelte b/frontend/src/lib/components/trace-logs/trace-logs-panel.svelteindex 50078f2e..93ca26c5 100644--- a/frontend/src/lib/components/trace-logs/trace-logs-panel.svelte+++ b/frontend/src/lib/components/trace-logs/trace-logs-panel.svelte@@ -7,6 +7,7 @@import { LoadingCircle } from '$lib/components/ui/loading-circle';import { SeverityBadge } from '$lib/components/ui/severity-badge';import ExpandedLogRow from './expanded-log-row.svelte';+ import LogMessage from './log-message.svelte';import { formatDateTime } from '$lib/utils/formatters';import { getTimezone } from '$lib/state/timezone.svelte';import { spanIdUuidToHex } from '$lib/utils/span-id';@@ -157,12 +158,6 @@expandedId = expandedId === id ? null : id;}- function firstLine(body: string): string {- if (!body) return '';- const nl = body.indexOf('\n');- return nl === -1 ? body : body.slice(0, nl);- }-onMount(() => {loadTraceLogs();});@@ -223,7 +218,7 @@/></Table.Cell><Table.Cell class="max-w-[600px] truncate py-1.5 font-mono text-xs">- {firstLine(log.body)}+ <LogMessage body={log.body} attributes={log.logAttributes} /></Table.Cell><Table.Cell class="py-1.5 pr-6">{#if spanName}@@ -290,7 +285,7 @@/></Table.Cell><Table.Cell class="max-w-[500px] truncate py-1.5 font-mono text-xs">- {firstLine(log.body)}+ <LogMessage body={log.body} attributes={log.logAttributes} /></Table.Cell><Table.Cell class="py-1.5 text-xs text-muted-foreground">{log.serviceName || '—'}diff --git a/frontend/src/lib/components/ui/attributes-grid/attributes-grid.svelte b/frontend/src/lib/components/ui/attributes-grid/attributes-grid.svelteindex 08987b0e..b62c12d1 100644--- a/frontend/src/lib/components/ui/attributes-grid/attributes-grid.svelte+++ b/frontend/src/lib/components/ui/attributes-grid/attributes-grid.svelte@@ -1,14 +1,18 @@<script lang="ts">- import AttributesView from './attributes-view.svelte';+ import AttributesView, { type AttributeFilterState } from './attributes-view.svelte';let {attributes,sorted = true,- collapsedCount = 3+ collapsedCount = 3,+ filterStateFor,+ onFilterToggle}: {attributes: Record<string, string>;sorted?: boolean;collapsedCount?: number;+ filterStateFor?: (key: string, value: string) => AttributeFilterState;+ onFilterToggle?: (key: string, value: string) => void;} = $props();let expanded = $state(false);@@ -37,7 +41,12 @@<div><div class="grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3">{#each visibleEntries() as [key, value]}- <AttributesView title={key} {value} />+ <AttributesView+ title={key}+ {value}+ filterState={filterStateFor?.(key, value) ?? 'none'}+ onFilterToggle={onFilterToggle ? () => onFilterToggle(key, value) : undefined}+ />{/each}</div>{#if hiddenCount() > 0}diff --git a/frontend/src/lib/components/ui/attributes-grid/attributes-view.svelte b/frontend/src/lib/components/ui/attributes-grid/attributes-view.svelteindex b1d41f06..e6c85d00 100644--- a/frontend/src/lib/components/ui/attributes-grid/attributes-view.svelte+++ b/frontend/src/lib/components/ui/attributes-grid/attributes-view.svelte@@ -1,15 +1,36 @@+<script lang="ts" module>+ export type AttributeFilterState = 'none' | 'include' | 'exclude';+</script>+<script lang="ts">import JSONTree from '@sveltejs/svelte-json-tree';- import { Copy, Check } from 'lucide-svelte';+ import { Copy, Check, Filter, FilterX } from 'lucide-svelte';let {title,- value+ value,+ filterState = 'none',+ onFilterToggle}: {title: string;value: string;+ filterState?: AttributeFilterState;+ onFilterToggle?: () => void;} = $props();+ // Hidden-until-hover only where hovering exists: always visible on small+ // screens and coarse (touch) pointers, hover-revealed on md+ fine pointers.+ const hoverRevealClass =+ 'opacity-100 md:opacity-0 md:group-hover:opacity-100 md:focus-visible:opacity-100 md:pointer-coarse:opacity-100';++ const filterTitle = $derived(+ filterState === 'none'+ ? 'Filter by this value'+ : filterState === 'include'+ ? 'Filtering by this value — click to clear'+ : 'Excluding this value — click to clear'+ );+let copied = $state(false);let showFull = $state(false);let clamped = $state(false);@@ -45,17 +66,36 @@<div class="group relative flex flex-col gap-1 rounded-md bg-muted p-3"><div class="flex items-center justify-between"><span class="text-xs font-medium text-muted-foreground">{title}</span>- <button- onclick={copyToClipboard}- class="opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-foreground"- title="Copy to clipboard"- >- {#if copied}- <Check class="h-3.5 w-3.5 text-green-500" />- {:else}- <Copy class="h-3.5 w-3.5" />+ <div class="flex items-center gap-2">+ {#if onFilterToggle}+ <button+ onclick={onFilterToggle}+ class="transition-opacity {filterState === 'none'+ ? `${hoverRevealClass} text-muted-foreground hover:text-foreground`+ : filterState === 'include'+ ? 'text-blue-500 dark:text-blue-400'+ : 'text-red-500'}"+ title={filterTitle}+ >+ {#if filterState === 'exclude'}+ <FilterX class="h-3.5 w-3.5" />+ {:else}+ <Filter class="h-3.5 w-3.5 {filterState === 'include' ? 'fill-current' : ''}" />+ {/if}+ </button>{/if}- </button>+ <button+ onclick={copyToClipboard}+ class="{hoverRevealClass} transition-opacity text-muted-foreground hover:text-foreground"+ title="Copy to clipboard"+ >+ {#if copied}+ <Check class="h-3.5 w-3.5 text-green-500" />+ {:else}+ <Copy class="h-3.5 w-3.5" />+ {/if}+ </button>+ </div></div>{#if parsedJson()}<div class="json-tree-container whitespace-normal overflow-x-auto">diff --git a/frontend/src/lib/components/ui/attributes-grid/index.ts b/frontend/src/lib/components/ui/attributes-grid/index.tsindex 6e9ccc85..685e58df 100644--- a/frontend/src/lib/components/ui/attributes-grid/index.ts+++ b/frontend/src/lib/components/ui/attributes-grid/index.ts@@ -1,2 +1,3 @@export { default as AttributesGrid } from './attributes-grid.svelte';export { default as AttributesView } from './attributes-view.svelte';+export type { AttributeFilterState } from './attributes-view.svelte';diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelteindex a0315c17..0e1b467b 100644--- a/frontend/src/routes/+layout.svelte+++ b/frontend/src/routes/+layout.svelte@@ -53,6 +53,17 @@return PUBLIC_PATHS.has(pathname) || pathname.startsWith('/accept-invitation');}+ // An unauthenticated visit to a protected path matches neither layout+ // branch below and would render a blank page; send it to login instead,+ // carrying the original URL so login can return there.+ $effect(() => {+ if (!authState.isAuthenticated && !isPublicPath(page.url.pathname)) {+ const returnTo = page.url.pathname + page.url.search;+ // eslint-disable-next-line svelte/no-navigation-without-resolve+ goto(`/login?returnTo=${encodeURIComponent(returnTo)}`, { replaceState: true });+ }+ });+// Track navigation depth for smart back buttonslet lastPathname = '';afterNavigate((navigation) => {@@ -91,6 +102,7 @@});onMount(() => {+ document.getElementById('splash')?.remove();initTheme();(window as any).captureException = captureException;diff --git a/frontend/src/routes/logs/+page.svelte b/frontend/src/routes/logs/+page.svelteindex f70f823b..397bae2b 100644--- a/frontend/src/routes/logs/+page.svelte+++ b/frontend/src/routes/logs/+page.svelte@@ -18,6 +18,7 @@import { Button } from '$lib/components/ui/button';import * as AlertDialog from '$lib/components/ui/alert-dialog';import ExpandedLogRow from '$lib/components/trace-logs/expanded-log-row.svelte';+ import LogMessage from '$lib/components/trace-logs/log-message.svelte';import { Plus, X } from '@lucide/svelte';import { CalendarDate } from '@internationalized/date';import {@@ -76,21 +77,28 @@scope: 'resource' | 'scope' | 'log';key: string;value: string;+ exclude: boolean;};- // Parse `resource.service.name=backend-service` (or scope.*/log.*) into a- // structured filter. Returns null if the input doesn't match the shape.+ // Parse `resource.service.name=backend-service` or `log.method!=Enter`+ // (scope.*/log.* likewise) into a structured filter. Returns null if the+ // input doesn't match the shape.function parseAttributeFilter(input: string): AttributeFilter | null {const trimmed = input.trim();- const m = trimmed.match(/^(resource|scope|log)\.([^=]+)=(.*)$/);+ const m = trimmed.match(/^(resource|scope|log)\.([^=]+?)(!=|=)(.*)$/);if (!m) return null;const key = m[2].trim();if (!key) return null;- return { scope: m[1] as AttributeFilter['scope'], key, value: m[3] };+ return {+ scope: m[1] as AttributeFilter['scope'],+ key,+ value: m[4],+ exclude: m[3] === '!='+ };}function formatAttributeFilter(f: AttributeFilter): string {- return `${f.scope}.${f.key}=${f.value}`;+ return `${f.scope}.${f.key}${f.exclude ? '!=' : '='}${f.value}`;}function parseLogsUrlParams() {@@ -104,6 +112,9 @@minSeverity: 0,serviceName: '',traceId: '',+ spanId: '',+ scopeName: '',+ body: '',attributeFilters: [] as AttributeFilter[]};}@@ -122,6 +133,9 @@minSeverity: Number.isFinite(minSev) ? minSev : 0,serviceName: params.get('service') || '',traceId: params.get('traceId') || '',+ spanId: params.get('spanId') || '',+ scopeName: params.get('scopeName') || '',+ body: params.get('body') || '',attributeFilters: attrs};}@@ -140,6 +154,9 @@let minSeverity = $state<number>(initialUrlParams.minSeverity);let serviceName = $state(initialUrlParams.serviceName);let traceIdFilter = $state(initialUrlParams.traceId);+ let spanIdFilter = $state(initialUrlParams.spanId);+ let scopeNameFilter = $state(initialUrlParams.scopeName);+ let bodyFilter = $state(initialUrlParams.body);let attributeFilters = $state<AttributeFilter[]>(initialUrlParams.attributeFilters);// Add-filter dialog@@ -162,17 +179,117 @@dialogError = 'Key must start with resource., scope., or log.';return;}+ addAttributeFilter(parsed);+ addFilterOpen = false;+ }++ function addAttributeFilter(filter: AttributeFilter) {const dup = attributeFilters.some(- (f) => f.scope === parsed.scope && f.key === parsed.key && f.value === parsed.value+ (f) =>+ f.scope === filter.scope &&+ f.key === filter.key &&+ f.value === filter.value &&+ f.exclude === filter.exclude);if (!dup) {- attributeFilters = [...attributeFilters, parsed];+ attributeFilters = [...attributeFilters, filter];+ }+ page = 1;+ loadData(true);+ }++ // Displayed attribute keys are prefixed `resource.` / `scope.`; log+ // attributes are unprefixed.+ function displayKeyToFilter(displayKey: string): { scope: AttributeFilter['scope']; key: string } {+ if (displayKey.startsWith('resource.')) {+ return { scope: 'resource', key: displayKey.slice('resource.'.length) };+ }+ if (displayKey.startsWith('scope.')) {+ return { scope: 'scope', key: displayKey.slice('scope.'.length) };+ }+ return { scope: 'log', key: displayKey };+ }++ function attributeFilterState(+ displayKey: string,+ value: string+ ): 'none' | 'include' | 'exclude' {+ const { scope, key } = displayKeyToFilter(displayKey);+ const f = attributeFilters.find(+ (f) => f.scope === scope && f.key === key && f.value === value+ );+ if (!f) return 'none';+ return f.exclude ? 'exclude' : 'include';+ }++ // Toggle from an attribute tile in the expanded log row: on/off. An active+ // filter of either kind (include, or exclude via a hand-edited URL) clears.+ function toggleAttributeFilter(displayKey: string, value: string) {+ const { scope, key } = displayKeyToFilter(displayKey);+ const existing = attributeFilters.findIndex(+ (f) => f.scope === scope && f.key === key && f.value === value+ );+ if (existing === -1) {+ attributeFilters = [...attributeFilters, { scope, key, value, exclude: false }];+ } else {+ attributeFilters = attributeFilters.filter((_, i) => i !== existing);}- addFilterOpen = false;page = 1;loadData(true);}+ // Filters for the fixed tiles of the expanded row (Body / Trace ID /+ // Span ID / Scope), backed by their dedicated query params rather than+ // attribute filters.+ type MetaFilterField = 'body' | 'traceId' | 'spanId' | 'scopeName';++ function metaFilterState(field: MetaFilterField, value: string): 'none' | 'include' {+ switch (field) {+ case 'body':+ return bodyFilter === value ? 'include' : 'none';+ case 'traceId':+ return traceIdFilter === value ? 'include' : 'none';+ case 'spanId':+ return spanIdFilter === value ? 'include' : 'none';+ case 'scopeName':+ return scopeNameFilter === value ? 'include' : 'none';+ }+ }++ function toggleMetaFilter(field: MetaFilterField, value: string) {+ const active = metaFilterState(field, value) === 'include';+ switch (field) {+ case 'body':+ bodyFilter = active ? '' : value;+ break;+ case 'traceId':+ traceIdFilter = active ? '' : value;+ break;+ case 'spanId':+ spanIdFilter = active ? '' : value;+ break;+ case 'scopeName':+ scopeNameFilter = active ? '' : value;+ break;+ }+ page = 1;+ loadData(true);+ }++ // Pills for the active meta filters, shown next to the attribute chips.+ const metaFilterChips = $derived([+ ...(bodyFilter ? [{ field: 'body' as const, label: 'body', value: bodyFilter }] : []),+ ...(traceIdFilter ? [{ field: 'traceId' as const, label: 'trace_id', value: traceIdFilter }] : []),+ ...(spanIdFilter ? [{ field: 'spanId' as const, label: 'span_id', value: spanIdFilter }] : []),+ ...(scopeNameFilter+ ? [{ field: 'scopeName' as const, label: 'scope', value: scopeNameFilter }]+ : [])+ ]);++ function shortenChipValue(value: string): string {+ return value.length > 20 ? value.slice(0, 18) + '…' : value;+ }+function handleDialogKeydown(e: KeyboardEvent) {if (e.key === 'Enter') {e.preventDefault();@@ -232,6 +349,9 @@if (minSeverity > 0) urlParams.set('minSeverity', String(minSeverity));if (serviceName.trim()) urlParams.set('service', serviceName.trim());if (traceIdFilter.trim()) urlParams.set('traceId', traceIdFilter.trim());+ if (spanIdFilter.trim()) urlParams.set('spanId', spanIdFilter.trim());+ if (scopeNameFilter.trim()) urlParams.set('scopeName', scopeNameFilter.trim());+ if (bodyFilter) urlParams.set('body', bodyFilter);for (const f of attributeFilters) {urlParams.append('attr', formatAttributeFilter(f));}@@ -272,6 +392,9 @@minSeverity,serviceName: serviceName.trim(),traceId: traceIdFilter.trim(),+ spanId: spanIdFilter.trim(),+ scopeName: scopeNameFilter.trim(),+ body: bodyFilter,attributeFilters};@@ -351,6 +474,9 @@minSeverity = urlParams.minSeverity;serviceName = urlParams.serviceName;traceIdFilter = urlParams.traceId;+ spanIdFilter = urlParams.spanId;+ scopeNameFilter = urlParams.scopeName;+ bodyFilter = urlParams.body;attributeFilters = urlParams.attributeFilters;page = 1;loadData(false);@@ -360,12 +486,6 @@expandedId = expandedId === id ? null : id;}- function firstLine(body: string): string {- if (!body) return '';- const nl = body.indexOf('\n');- return nl === -1 ? body : body.slice(0, nl);- }-onMount(() => {window.addEventListener('popstate', handlePopState);loadData(false);@@ -431,12 +551,27 @@<Plus class="h-3 w-3" />Add filter</button>+ {#each metaFilterChips as chip (chip.field)}+ <span class="inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs font-mono">+ <span class="text-muted-foreground">{chip.label}</span>+ <span>=</span>+ <span title={chip.value}>{shortenChipValue(chip.value)}</span>+ <button+ type="button"+ aria-label="Remove filter"+ class="ml-1 text-muted-foreground hover:text-foreground"+ onclick={() => toggleMetaFilter(chip.field, chip.value)}+ >+ <X class="h-3 w-3" />+ </button>+ </span>+ {/each}{#each attributeFilters as f, i (i)}<spanclass="inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs font-mono"><span class="text-muted-foreground">{f.scope}.{f.key}</span>- <span>=</span>+ <span class={f.exclude ? 'text-red-500' : ''}>{f.exclude ? '!=' : '='}</span><span>{f.value}</span><buttontype="button"@@ -567,7 +702,7 @@/></Table.Cell><Table.Cell class="max-w-[600px] truncate font-mono text-sm">- {firstLine(log.body)}+ <LogMessage body={log.body} attributes={log.logAttributes} /></Table.Cell><Table.Cell class="truncate text-muted-foreground">{log.serviceName || '—'}@@ -583,7 +718,14 @@</Table.Cell></Table.Row>{#if expandedId === log.id}- <ExpandedLogRow {log} colspan={5} />+ <ExpandedLogRow+ {log}+ colspan={5}+ filterStateFor={attributeFilterState}+ onFilterToggle={toggleAttributeFilter}+ metaFilterStateFor={metaFilterState}+ onMetaFilterToggle={toggleMetaFilter}+ />{/if}{/each}</Table.Body>diff --git a/website/app/cloud/page.tsx b/website/app/cloud/page.tsxindex 08c19925..2436dbcc 100644--- a/website/app/cloud/page.tsx+++ b/website/app/cloud/page.tsx@@ -35,12 +35,6 @@ export default function CloudPage() {>Start Free <ArrowRight className="h-4 w-4" /></Link>- <Link- href="https://docs.tracewayapp.com/cloud"- className="btn btn-ghost"- >- How it works- </Link></div></div></section>