The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
fix: cleanup and release prep + org view work
narrow-adventurec7a5dcae5e50
diff --git a/.github/workflows/backend-vulncheck.yml b/.github/workflows/backend-vulncheck.ymlindex ca8d5400..dc7defad 100644--- a/.github/workflows/backend-vulncheck.yml+++ b/.github/workflows/backend-vulncheck.yml@@ -13,6 +13,7 @@ on:- "cli/**"- ".github/workflows/backend-vulncheck.yml"pull_request:+ types: [labeled]paths:- "backend/**"- "cli/**"@@ -44,6 +45,7 @@ jobs:# both are follow-ups.vulncheck:name: vulncheck (${{ matrix.name }})+ if: github.event_name != 'pull_request' || github.event.label.name == 'ci'runs-on: ubuntu-latesttimeout-minutes: 15strategy:@@ -67,12 +69,14 @@ jobs:- name: Checkoutuses: actions/checkout@v4- # setup-go@v5 reads only the `go` line and never sets GOTOOLCHAIN, so it- # installs the 1.26.2 floor and the go command then switches to the- # `toolchain` directive -- the same path release-traceway.yml builds the- # runner through. The Docker images are not covered by that: the official- # golang bases set GOTOOLCHAIN=local, so they build with whatever the- # floating golang:1.26-* tag ships, which is >= what is scanned here.+ # setup-go@v5 honors the `toolchain` directive in go.mod, so this installs+ # go1.26.6 -- the same version release-traceway.yml builds the runner+ # with. The Docker images are not covered by that: the official golang+ # bases set GOTOOLCHAIN=local, so they build with whatever the floating+ # golang:1.26-* tag ships, which is >= what is scanned here. One setup-go+ # cache shared by the three rows is fine here, unlike backend.yml: with+ # no -race and no test builds the module cache is what matters, and it+ # is identical across rows.- name: Setup Gouses: actions/setup-go@v5with:diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.ymlindex 8085c9b8..e04a4fad 100644--- a/.github/workflows/backend.yml+++ b/.github/workflows/backend.yml@@ -11,10 +11,12 @@ on:- "cli/**"- ".github/workflows/backend.yml"pull_request:+ types: [labeled]paths:- "backend/**"- "cli/**"- ".github/workflows/backend.yml"+ workflow_dispatch:permissions:contents: read@@ -26,6 +28,7 @@ concurrency:jobs:sqlite:name: Test (dual SQLite)+ if: github.event_name != 'pull_request' || github.event.label.name == 'ci'runs-on: ubuntu-latesttimeout-minutes: 15defaults:@@ -51,8 +54,10 @@ jobs:path: |~/.cache/go-build~/go/pkg/mod- key: go-${{ runner.os }}-sqlite-${{ hashFiles('backend/go.sum') }}- restore-keys: go-${{ runner.os }}-sqlite-+ key: go-${{ runner.os }}-sqlite-${{ hashFiles('backend/go.sum') }}-${{ github.run_id }}+ restore-keys: |+ go-${{ runner.os }}-sqlite-${{ hashFiles('backend/go.sum') }}-+ go-${{ runner.os }}-sqlite-# CGO_ENABLED=0 mirrors Dockerfile.sqlite, so CI links what ships.- name: Build@@ -74,6 +79,20 @@ jobs:GOOS=$1 GOARCH=$2 go build -o /dev/null ./cmd/traceway-runnerdone+ - name: gofmt+ run: |+ unformatted=$(gofmt -l .)+ if [ -n "$unformatted" ]; then+ echo "::error::gofmt -l reports unformatted files"+ echo "$unformatted"+ exit 1+ fi++ - name: go vet+ env:+ CGO_ENABLED: "1"+ run: go vet ./...+# The race detector requires cgo, so this step cannot inherit the# CGO_ENABLED=0 above. Worth the divergence: the backend runs the outbox# drain, on-call escalator, synthetics scheduler and recordings uploader@@ -85,6 +104,7 @@ jobs:duckdb:name: Test (DuckDB telemetry)+ if: github.event_name != 'pull_request' || github.event.label.name == 'ci'runs-on: ubuntu-latesttimeout-minutes: 15defaults:@@ -110,14 +130,16 @@ jobs:path: |~/.cache/go-build~/go/pkg/mod- key: go-${{ runner.os }}-duckdb-${{ hashFiles('backend/go.sum') }}- restore-keys: go-${{ runner.os }}-duckdb-+ key: go-${{ runner.os }}-duckdb-${{ hashFiles('backend/go.sum') }}-${{ github.run_id }}+ restore-keys: |+ go-${{ runner.os }}-duckdb-${{ hashFiles('backend/go.sum') }}-+ go-${{ runner.os }}-duckdb-# Load-bearing, not redundant with the tests below: the test scope covers- # two package trees, so this is what compiles the other ~47 packages under+ # two package trees, so this is what compiles every other package under# this tag.- name: Build- run: go build -tags telemetry_duckdb ./cmd/traceway ./cmd/traceway-runner+ run: go build -tags telemetry_duckdb ./...# The DuckDB harness opens an in-memory database, so no service# containers are needed. app/retention is included because@@ -130,6 +152,7 @@ jobs:pgch:name: Test (PostgreSQL + ClickHouse)+ if: github.event_name != 'pull_request' || github.event.label.name == 'ci'runs-on: ubuntu-latesttimeout-minutes: 20defaults:@@ -195,8 +218,10 @@ jobs:path: |~/.cache/go-build~/go/pkg/mod- key: go-${{ runner.os }}-pgch-${{ hashFiles('backend/go.sum') }}- restore-keys: go-${{ runner.os }}-pgch-+ key: go-${{ runner.os }}-pgch-${{ hashFiles('backend/go.sum') }}-${{ github.run_id }}+ restore-keys: |+ go-${{ runner.os }}-pgch-${{ hashFiles('backend/go.sum') }}-+ go-${{ runner.os }}-pgch-# CGO_ENABLED=0 mirrors Dockerfile and Dockerfile.minimal.- name: Builddiff --git a/.github/workflows/benchmark-metricsdb.yml b/.github/workflows/benchmark-metricsdb.ymlindex ab929a3a..01f80bd3 100644--- a/.github/workflows/benchmark-metricsdb.yml+++ b/.github/workflows/benchmark-metricsdb.yml@@ -72,6 +72,7 @@ jobs:build:# Pinned so the binary's glibc matches the ubuntu-24.04 Hetzner image.runs-on: ubuntu-24.04+ timeout-minutes: 30steps:- uses: actions/checkout@v4- uses: dtolnay/rust-toolchain@stable@@ -104,15 +105,18 @@ jobs:setup:runs-on: ubuntu-latest+ timeout-minutes: 5outputs:matrix: ${{ steps.plan.outputs.matrix }}expected: ${{ steps.plan.outputs.expected }}steps:- id: planname: Build matrix from inputs+ env:+ DATABASES: ${{ github.event.inputs.databases }}run: |set -euo pipefail- jq -nc --arg dbs "${{ github.event.inputs.databases }}" '+ jq -nc --arg dbs "$DATABASES" '($dbs | split(",") | map(gsub("^\\s+|\\s+$"; "")) | map(select(. != ""))) as $D| ($D - ["victoriametrics", "clickhouse", "clickhouse-map", "duckdb", "firebolt"]) as $bad| if ($bad | length) > 0 then error("unknown databases: " + ($bad | join(","))) else . end@@ -161,10 +165,12 @@ jobs:| sudo tar -xz -C /usr/local/bin hcloud- name: Materialize SSH key+ env:+ SSH_PRIVATE_KEY: ${{ secrets.BENCHMARK_SSH_PRIVATE_KEY }}run: |umask 077key="$RUNNER_TEMP/benchmark-key"- printf '%s\n' "${{ secrets.BENCHMARK_SSH_PRIVATE_KEY }}" > "$key"+ printf '%s\n' "$SSH_PRIVATE_KEY" > "$key"echo "BENCHMARK_SSH_KEY=$key" >> "$GITHUB_ENV"- name: Preflight@@ -195,6 +201,7 @@ jobs:needs: [setup, run]if: always()runs-on: ubuntu-latest+ timeout-minutes: 15steps:- uses: actions/checkout@v4diff --git a/.github/workflows/cli-contract.yml b/.github/workflows/cli-contract.ymlindex 10456cb1..9ff1b67b 100644--- a/.github/workflows/cli-contract.yml+++ b/.github/workflows/cli-contract.yml@@ -12,6 +12,7 @@ on:- "backend/**"- ".github/workflows/cli-contract.yml"pull_request:+ types: [labeled]paths:- "cli/**"- "backend/**"@@ -23,6 +24,7 @@ permissions:jobs:contract:+ if: github.event_name != 'pull_request' || github.event.label.name == 'ci'runs-on: ubuntu-latestdefaults:run:diff --git a/.github/workflows/cli-lint.yml b/.github/workflows/cli-lint.ymlindex 85627846..8222f24b 100644--- a/.github/workflows/cli-lint.yml+++ b/.github/workflows/cli-lint.yml@@ -17,6 +17,7 @@ on:- "cli/**"- ".github/workflows/cli-lint.yml"pull_request:+ types: [labeled]paths:- "cli/**"- ".github/workflows/cli-lint.yml"@@ -30,14 +31,19 @@ on:permissions:contents: read+concurrency:+ group: ${{ github.workflow }}-${{ github.ref }}+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}+# Two jobs, not one: a lint nit and a stdlib CVE are different signals, and# neither should mask the other.jobs:lint:# The daily run exists for the vulnerability database. Lint is pinned and# deterministic, so re-running it on a timer would only add noise.- if: github.event_name != 'schedule'+ if: github.event_name != 'schedule' && (github.event_name != 'pull_request' || github.event.label.name == 'ci')runs-on: ubuntu-latest+ timeout-minutes: 10steps:- name: Checkoutuses: actions/checkout@v4@@ -49,9 +55,9 @@ jobs:cache-dependency-path: cli/go.sum# Pinned, not `latest`: a new linter release must never turn an unrelated- # PR red. CI is authoritative for the version -- cli/flake.nix takes- # whatever golangci-lint its nixpkgs input carries and cannot pin one, so- # a local `just lint` can legitimately differ after a flake update.+ # PR red. CI is authoritative for the version -- the flake.nix dev shell+ # takes whatever golangci-lint its nixpkgs input carries and cannot pin+ # one, so a local `just lint` can legitimately differ after a flake update.- name: Lintuses: golangci/golangci-lint-action@v9with:@@ -59,7 +65,9 @@ jobs:working-directory: clivulncheck:+ if: github.event_name != 'pull_request' || github.event.label.name == 'ci'runs-on: ubuntu-latest+ timeout-minutes: 10defaults:run:working-directory: clidiff --git a/.github/workflows/cli.yml b/.github/workflows/cli.ymlindex f5d47fb0..80cc6a67 100644--- a/.github/workflows/cli.yml+++ b/.github/workflows/cli.yml@@ -9,17 +9,20 @@ on:- "skills/traceway/**"- ".github/workflows/cli.yml"pull_request:+ types: [labeled]paths:- "cli/**"- "backend/**"- "skills/traceway/**"- ".github/workflows/cli.yml"+ workflow_dispatch:permissions:contents: readjobs:build-test:+ if: github.event_name != 'pull_request' || github.event.label.name == 'ci'runs-on: ubuntu-latestdefaults:run:diff --git a/.github/workflows/release-traceway.yml b/.github/workflows/release-traceway.ymlindex b4d0c39c..54845eb9 100644--- a/.github/workflows/release-traceway.yml+++ b/.github/workflows/release-traceway.yml@@ -62,7 +62,7 @@ jobs:- name: Setup Nodeuses: actions/setup-node@v4with:- node-version: "latest"+ node-version-file: frontend/package.jsoncache: "npm"cache-dependency-path: frontend/package-lock.jsondiff --git a/CLAUDE.md b/CLAUDE.mdindex 230e4acb..7bc2308f 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -33,13 +33,16 @@ Traceway is an error tracking and monitoring platform consisting of:| CLI | `cd cli && just test` | Runs unit tests || CLI | `cd cli && just check` | Lint + test + vulncheck + skill drift + contract tests (pre-commit gate; CI enforces it for `cli/`) || CLI | `cd cli && just smoke-test` | Live E2E (needs `TRACEWAY_SMOKE_*` env vars) |+| Any | `nix develop` (or direnv via `.envrc`) | Dev shell with the Go and Node versions read from `backend/go.mod` and `frontend/package.json`, plus `just`, `golangci-lint`, `govulncheck` (`flake.nix`; shells `default`, `backend`, `frontend`, `oxc`). Put `JWT_SECRET` in the gitignored `.envrc.local` |Set `JWT_SECRET` (min 32 characters) before running the backend — it is the one variable with no default. `SQLITE_PATH` sets the database location, defaulting to `./traceway.db` in the working directory.+CI on pull requests is opt-in. `backend.yml`, `backend-vulncheck.yml`, `cli.yml`, `cli-lint.yml` and `cli-contract.yml` listen for `pull_request: types: [labeled]` and every job is gated on `github.event.label.name == 'ci'`, so a PR runs nothing until a maintainer applies the `ci` label (only collaborators can), and applying any other label runs nothing either. Each application validates the PR as it is at that moment: to validate later pushes, remove and re-add the label. The same workflows still run on every push to `main`, on their daily schedules (the two vulnchecks), and from the Actions tab via `workflow_dispatch`.+### Tech Stack- **Frontend**: SvelteKit 2.49, Svelte 5.45, Tailwind CSS v4, shadcn-svelte, Vite 7- **Backend**: Go 1.26, Gin 1.11, ClickHouse, PostgreSQL (in `backend/go.mod` the `go` line is the floor importers inherit and the `toolchain` directive is what builds it — keep the two distinct)-- **CLI**: Go 1.26, Cobra 1.10, separate Go module (`github.com/tracewayapp/traceway/cli`); flake.nix dev shell, justfile entrypoints+- **CLI**: Go 1.26, Cobra 1.10, separate Go module (`github.com/tracewayapp/traceway/cli`); justfile entrypoints, covered by the root `flake.nix` dev shell- **Client SDK**: Go 1.25, Gin middleware support### lit Library (SQL mapper)@@ -247,7 +250,7 @@ if err != nil {```JWT_SECRET=<min 32 char secret for JWT signing> # the only variable with no default. There is deliberately no fallback: a key committed to the repo would be identical in every clone. Unset or under 32 chars exits 1 with an actionable message rather than a panic.DB_TYPE= # sqlite | postgres. Defaults to sqlite in every build EXCEPT -tags transactional_pg, where an empty value still selects PostgreSQL. Without that tag SQLite is the only supported main DB (the migration runner applies SQLite-dialect migrations unconditionally), so the default is set once in config.defaultDBType rather than at each DBType call site.-PORTS=80,8082 # comma-separated HTTP listen ports. Every port is bound up front; a port that fails to bind (typically :80 as a non-root user) logs a warning and is reported via CaptureException, and startup only fails if NO port binds. Order is not significant.+PORTS=80,8082 # comma-separated HTTP listen ports. Every port is bound up front; a port that fails to bind (typically :80 as a non-root user) logs a warning (and reports via CaptureException when monitoring is configured), and startup only fails if NO port binds. Order is not significant: a listener that later stops serving takes the process down whichever position it holds.SQLITE_PATH= # main DB path, defaults to ./traceway.db in the working directory. The telemetry DB derives from it (_telemetry.db, or _telemetry.duckdb under -tags telemetry_duckdb).APP_BASE_URL= # public origin of this server (e.g. https://traceway.example.com). Used as the OAuth issuer / device verification URL and SSO redirect base. If unset, the device-auth + well-known endpoints derive it per-request from the Host / X-Forwarded-* headers; set it explicitly behind a proxy that doesn't forward Host.TRUSTED_PROXIES= # comma-separated IPs/CIDRs whose X-Forwarded-For/X-Real-IP gin trusts for c.ClientIP() (every per-IP rate limiter keys on it, and `/api/report` stores it on every session as `client.ip`). Unset = loopback only, so no peer can spoof its IP. Private ranges are deliberately NOT trusted by default: on a Docker/k8s network every peer has a private address, the clients included when the port is published directly, so trusting RFC1918 would let any of them forge XFF past every per-IP limiter. Set it to the CIDRs of whatever sits in front (a proxy container's compose network, the ingress pod range, the CDN ranges); otherwise every visitor shares one rate-limit bucket keyed on the proxy. The value REPLACES the default, so it must name every hop in the chain, not just the outermost (a CDN-only list leaves a private ingress untrusted and disables XFF entirely); `*` trusts every peer. A malformed entry panics at startup (`configureClientIP`, cmd/run.go). The first request carrying X-Forwarded-For/X-Real-IP from a peer outside the list logs a one-time warning naming that peer (`warnOnUntrustedForwardedFor`, cmd/run.go), which is how a forgotten proxy hop shows up. Parsing lives in `Cfg.TrustedProxyList` (config.go), covered by config_test.go.diff --git a/backend/app/chdb/chdb.go b/backend/app/chdb/chdb.goindex 8a12dcd2..4b461207 100644--- a/backend/app/chdb/chdb.go+++ b/backend/app/chdb/chdb.go@@ -3,10 +3,10 @@package chdbimport (- "github.com/tracewayapp/traceway/backend/app/config""context""crypto/tls""fmt"+ "github.com/tracewayapp/traceway/backend/app/config""strings""time"diff --git a/backend/app/controllers/endpoint.controller.go b/backend/app/controllers/endpoint.controller.goindex f750cbf7..ae9c6bb7 100644--- a/backend/app/controllers/endpoint.controller.go+++ b/backend/app/controllers/endpoint.controller.go@@ -5,6 +5,7 @@ import ("errors""net/http""net/url"+ "strings""time""github.com/tracewayapp/traceway/backend/app/middleware"@@ -47,8 +48,26 @@ type EndpointStackedChartRequest struct {ToDate time.Time `json:"toDate"`MetricType string `json:"metricType"` // total_time, p50, p95, p99IntervalMinutes int `json:"intervalMinutes"` // bucket size+ Search string `json:"search"`+ RootFilter string `json:"rootFilter"`+ MethodFilter string `json:"methodFilter"`}+var validEndpointMethods = map[string]bool{+ "GET": true, "HEAD": true, "POST": true, "PUT": true, "DELETE": true,+ "CONNECT": true, "OPTIONS": true, "TRACE": true, "PATCH": true,+}++func normalizeMethodFilter(method string) (string, bool) {+ if method == "" {+ return "", true+ }+ method = strings.ToUpper(method)+ return method, validEndpointMethods[method]+}++const invalidMethodFilterMessage = "methodFilter must be an HTTP method such as GET or POST"+func (e endpointController) FindAllEndpoints(c *gin.Context) {projectId, err := middleware.GetProjectId(c)if err != nil {@@ -94,8 +113,14 @@ func (e endpointController) FindGroupedByEndpoint(c *gin.Context) {return}+ methodFilter, ok := normalizeMethodFilter(request.MethodFilter)+ if !ok {+ c.JSON(http.StatusUnprocessableEntity, gin.H{"error": invalidMethodFilterMessage})+ return+ }+span := traceway.StartSpan(c, "loading grouped endpoints")- stats, total, err := telemetry.EndpointRepository.FindGroupedByEndpoint(c, projectId, request.FromDate, request.ToDate, request.Pagination.Page, request.Pagination.PageSize, request.OrderBy, request.SortDirection, request.Search, request.RootFilter, request.MethodFilter)+ stats, total, err := telemetry.EndpointRepository.FindGroupedByEndpoint(c, projectId, request.FromDate, request.ToDate, request.Pagination.Page, request.Pagination.PageSize, request.OrderBy, request.SortDirection, request.Search, request.RootFilter, methodFilter)span.End()if err != nil {c.AbortWithError(500, traceway.NewStackTraceErrorf("error loading stats: %w", err))@@ -190,8 +215,14 @@ func (e endpointController) GetStackedChart(c *gin.Context) {request.MetricType = "total_time" // default}+ methodFilter, ok := normalizeMethodFilter(request.MethodFilter)+ if !ok {+ c.JSON(http.StatusUnprocessableEntity, gin.H{"error": invalidMethodFilterMessage})+ return+ }+span := traceway.StartSpan(c, "loading stacked chart")- data, err := telemetry.EndpointRepository.GetEndpointStackedChart(c, projectId, request.FromDate, request.ToDate, request.IntervalMinutes, request.MetricType)+ data, err := telemetry.EndpointRepository.GetEndpointStackedChart(c, projectId, request.FromDate, request.ToDate, request.IntervalMinutes, request.MetricType, request.Search, request.RootFilter, methodFilter)span.End()if err != nil {c.AbortWithError(500, traceway.NewStackTraceErrorf("error loading stacked chart data: %w", err))diff --git a/backend/app/middleware/use_client_auth.middleware.go b/backend/app/middleware/use_client_auth.middleware.goindex 7e242a73..0a0dc8d0 100644--- a/backend/app/middleware/use_client_auth.middleware.go+++ b/backend/app/middleware/use_client_auth.middleware.go@@ -1,8 +1,8 @@package middlewareimport (- "github.com/tracewayapp/traceway/backend/app/cache""errors"+ "github.com/tracewayapp/traceway/backend/app/cache""net/http""strings"diff --git a/backend/app/models/clientmodels/clientmodels.model.go b/backend/app/models/clientmodels/clientmodels.model.goindex 06be6011..e6d241e2 100644--- a/backend/app/models/clientmodels/clientmodels.model.go+++ b/backend/app/models/clientmodels/clientmodels.model.go@@ -1,8 +1,8 @@package clientmodelsimport (- "github.com/tracewayapp/traceway/backend/app/models""encoding/json"+ "github.com/tracewayapp/traceway/backend/app/models""time""github.com/google/uuid"@@ -170,12 +170,12 @@ func (c *ClientSpan) ParsedId() uuid.UUID {func (c *ClientSpan) ToSpan(traceId uuid.UUID) models.Span {return models.Span{- Id: c.ParsedId(),- TraceId: traceId,- Name: c.Name,- StartTime: c.StartTime,- Duration: c.Duration,- RecordedAt: time.Now(),+ Id: c.ParsedId(),+ TraceId: traceId,+ Name: c.Name,+ StartTime: c.StartTime,+ Duration: c.Duration,+ RecordedAt: time.Now(),}}diff --git a/backend/app/models/endpoint.model.go b/backend/app/models/endpoint.model.goindex 48cd94dd..0334136b 100644--- a/backend/app/models/endpoint.model.go+++ b/backend/app/models/endpoint.model.go@@ -10,29 +10,29 @@ type Endpoint struct {Id uuid.UUID `json:"id" ch:"id"`ProjectId uuid.UUID `json:"projectId" ch:"project_id"`// endpoint is the route from the router/does not contain actual params so it's safe to group on it- Endpoint string `json:"endpoint" ch:"endpoint"`- Duration time.Duration `json:"duration" ch:"duration"`- RecordedAt time.Time `json:"recordedAt" ch:"recorded_at"`- StatusCode int16 `json:"statusCode" ch:"status_code"`- BodySize int32 `json:"bodySize" ch:"body_size"`- ClientIP string `json:"clientIP" ch:"client_ip"`- Attributes map[string]string `json:"attributes" ch:"attributes"`+ Endpoint string `json:"endpoint" ch:"endpoint"`+ Duration time.Duration `json:"duration" ch:"duration"`+ RecordedAt time.Time `json:"recordedAt" ch:"recorded_at"`+ StatusCode int16 `json:"statusCode" ch:"status_code"`+ BodySize int32 `json:"bodySize" ch:"body_size"`+ ClientIP string `json:"clientIP" ch:"client_ip"`+ Attributes map[string]string `json:"attributes" ch:"attributes"`AppVersion string `json:"appVersion" ch:"app_version"`ServerName string `json:"serverName" ch:"server_name"`DistributedTraceId *uuid.UUID `json:"distributedTraceId,omitempty" ch:"distributed_trace_id"`SpanId *uuid.UUID `json:"spanId,omitempty" ch:"span_id"`- IsStream bool `json:"isStream" ch:"is_stream"`- IsRoot bool `json:"isRoot" ch:"is_root"`+ IsStream bool `json:"isStream" ch:"is_stream"`+ IsRoot bool `json:"isRoot" ch:"is_root"`}type EndpointStats struct {- Endpoint string `json:"endpoint"`- Count uint64 `json:"count"`- P50Duration time.Duration `json:"p50Duration"`- P95Duration time.Duration `json:"p95Duration"`- P99Duration time.Duration `json:"p99Duration"`- AvgDuration time.Duration `json:"avgDuration"`- LastSeen time.Time `json:"lastSeen"`+ Endpoint string `json:"endpoint"`+ Count uint64 `json:"count"`+ P50Duration time.Duration `json:"p50Duration"`+ P95Duration time.Duration `json:"p95Duration"`+ P99Duration time.Duration `json:"p99Duration"`+ AvgDuration time.Duration `json:"avgDuration"`+ LastSeen time.Time `json:"lastSeen"`Impact float64 `json:"impact"` // 0-1 impact scoreImpactReason string `json:"impactReason"` // human-readable explanation of the dominant impact factorIsStream bool `json:"isStream"` // true => latency/Apdex/impact intentionally zerodiff --git a/backend/app/models/exception_stack_trace.model.go b/backend/app/models/exception_stack_trace.model.goindex 0ce045d3..c7a7eb7e 100644--- a/backend/app/models/exception_stack_trace.model.go+++ b/backend/app/models/exception_stack_trace.model.go@@ -7,14 +7,14 @@ import ()type ExceptionStackTrace struct {- Id uuid.UUID `json:"id" ch:"id"`- ProjectId uuid.UUID `json:"projectId" ch:"project_id"`- TraceId *uuid.UUID `json:"traceId" ch:"trace_id"`- TraceType string `json:"traceType" ch:"trace_type"` // "endpoint" or "task"- ExceptionHash string `json:"exceptionHash" ch:"exception_hash"`- StackTrace string `json:"stackTrace" ch:"stack_trace"`- RecordedAt time.Time `json:"recordedAt" ch:"recorded_at"`- Attributes map[string]string `json:"attributes" ch:"attributes"`+ Id uuid.UUID `json:"id" ch:"id"`+ ProjectId uuid.UUID `json:"projectId" ch:"project_id"`+ TraceId *uuid.UUID `json:"traceId" ch:"trace_id"`+ TraceType string `json:"traceType" ch:"trace_type"` // "endpoint" or "task"+ ExceptionHash string `json:"exceptionHash" ch:"exception_hash"`+ StackTrace string `json:"stackTrace" ch:"stack_trace"`+ RecordedAt time.Time `json:"recordedAt" ch:"recorded_at"`+ Attributes map[string]string `json:"attributes" ch:"attributes"`AppVersion string `json:"appVersion" ch:"app_version"`ServerName string `json:"serverName" ch:"server_name"`IsMessage bool `json:"isMessage" ch:"is_message"`diff --git a/backend/app/models/invitation.model.go b/backend/app/models/invitation.model.goindex e3e1186b..477a8930 100644--- a/backend/app/models/invitation.model.go+++ b/backend/app/models/invitation.model.go@@ -41,9 +41,9 @@ type AcceptInvitationRequest struct {}type InvitationInfoResponse struct {- Email string `json:"email"`+ Email string `json:"email"`OrganizationName string `json:"organizationName"`- InviterName string `json:"inviterName"`- ExistsAsUser bool `json:"existsAsUser"`- Role string `json:"role"`+ InviterName string `json:"inviterName"`+ ExistsAsUser bool `json:"existsAsUser"`+ Role string `json:"role"`}diff --git a/backend/app/models/organization.model.go b/backend/app/models/organization.model.goindex 6cac0809..724c9ad2 100644--- a/backend/app/models/organization.model.go+++ b/backend/app/models/organization.model.go@@ -30,10 +30,10 @@ type OrganizationMember struct {// OrganizationSettingsResponse is returned for the settings pagetype OrganizationSettingsResponse struct {- Organization *Organization `json:"organization"`- Members []*OrganizationMember `json:"members"`- Invitations []*InvitationWithInviter `json:"invitations"`- UserRole string `json:"userRole"`+ Organization *Organization `json:"organization"`+ Members []*OrganizationMember `json:"members"`+ Invitations []*InvitationWithInviter `json:"invitations"`+ UserRole string `json:"userRole"`}// UpdateMemberRoleRequest is the request body for updating a member's rolediff --git a/backend/app/models/task.model.go b/backend/app/models/task.model.goindex 56102556..0d4f655d 100644--- a/backend/app/models/task.model.go+++ b/backend/app/models/task.model.go@@ -7,13 +7,13 @@ import ()type Task struct {- Id uuid.UUID `json:"id" ch:"id"`- ProjectId uuid.UUID `json:"projectId" ch:"project_id"`- TaskName string `json:"taskName" ch:"task_name"`- Duration time.Duration `json:"duration" ch:"duration"`- RecordedAt time.Time `json:"recordedAt" ch:"recorded_at"`- ClientIP string `json:"clientIP" ch:"client_ip"`- Attributes map[string]string `json:"attributes" ch:"attributes"`+ Id uuid.UUID `json:"id" ch:"id"`+ ProjectId uuid.UUID `json:"projectId" ch:"project_id"`+ TaskName string `json:"taskName" ch:"task_name"`+ Duration time.Duration `json:"duration" ch:"duration"`+ RecordedAt time.Time `json:"recordedAt" ch:"recorded_at"`+ ClientIP string `json:"clientIP" ch:"client_ip"`+ Attributes map[string]string `json:"attributes" ch:"attributes"`AppVersion string `json:"appVersion" ch:"app_version"`ServerName string `json:"serverName" ch:"server_name"`DistributedTraceId *uuid.UUID `json:"distributedTraceId,omitempty" ch:"distributed_trace_id"`diff --git a/backend/app/notifications/evaluator_polled.go b/backend/app/notifications/evaluator_polled.goindex 30e77e15..f07cda2a 100644--- a/backend/app/notifications/evaluator_polled.go+++ b/backend/app/notifications/evaluator_polled.go@@ -42,8 +42,8 @@ var polledEvaluators = map[string]RuleEvaluator{type errorRateConfig struct {ThresholdPercent float64 `json:"thresholdPercent"`- LookbackMinutes int `json:"lookbackMinutes"`- MinRequests int `json:"minRequests"`+ LookbackMinutes int `json:"lookbackMinutes"`+ MinRequests int `json:"minRequests"`}func evaluateErrorRateThreshold(ctx context.Context, rule *models.NotificationRule, projectId uuid.UUID) (*EvalResult, error) {diff --git a/backend/app/profiling/otlp_decoder_test.go b/backend/app/profiling/otlp_decoder_test.goindex 90c36710..f618c845 100644--- a/backend/app/profiling/otlp_decoder_test.go+++ b/backend/app/profiling/otlp_decoder_test.go@@ -6,8 +6,8 @@ import ("time""github.com/google/pprof/profile"- commonpb "go.opentelemetry.io/proto/otlp/common/v1"colprofilespb "go.opentelemetry.io/proto/otlp/collector/profiles/v1development"+ commonpb "go.opentelemetry.io/proto/otlp/common/v1"profilespb "go.opentelemetry.io/proto/otlp/profiles/v1development"resourcepb "go.opentelemetry.io/proto/otlp/resource/v1""google.golang.org/protobuf/proto"diff --git a/backend/app/recordings/uploader_test.go b/backend/app/recordings/uploader_test.goindex 7b2b0ad8..70c99887 100644--- a/backend/app/recordings/uploader_test.go+++ b/backend/app/recordings/uploader_test.go@@ -127,4 +127,3 @@ func TestEnqueue_NoSingleton_NoOps(t *testing.T) {Enqueue(makeJob())}-diff --git a/backend/app/repositories/telemetry/clickhouse/endpoint.repository.go b/backend/app/repositories/telemetry/clickhouse/endpoint.repository.goindex d0237560..3aac4022 100644--- a/backend/app/repositories/telemetry/clickhouse/endpoint.repository.go+++ b/backend/app/repositories/telemetry/clickhouse/endpoint.repository.go@@ -7,7 +7,6 @@ import ("database/sql""encoding/json""errors"- "strings""time""github.com/tracewayapp/traceway/backend/app/chdb"@@ -99,33 +98,33 @@ func (e *endpointRepository) FindAll(ctx context.Context, projectId uuid.UUID, freturn endpoints, int64(count), nil}-func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectId uuid.UUID, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string, search string, rootFilter string, methodFilter string) ([]models.EndpointStats, int64, error) {- // Build WHERE clause with optional search filter- // Count query uses bare column names; main query uses e. prefix for LEFT JOIN- whereClause := "project_id = ? AND recorded_at >= ? AND recorded_at <= ?"- joinWhereClause := "e.project_id = ? AND e.recorded_at >= ? AND e.recorded_at <= ?"- args := []interface{}{projectId, fromDate, toDate}-+func endpointFilterClause(col, search, rootFilter, methodFilter string) (string, []interface{}) {+ clause := ""+ var args []interface{}if search != "" {- whereClause += " AND positionCaseInsensitive(endpoint, ?) > 0"- joinWhereClause += " AND positionCaseInsensitive(e.endpoint, ?) > 0"+ clause += " AND positionCaseInsensitive(" + col + "endpoint, ?) > 0"args = append(args, search)}-switch rootFilter {case "root":- whereClause += " AND is_root = 1"- joinWhereClause += " AND e.is_root = 1"+ clause += " AND " + col + "is_root = 1"case "non_root":- whereClause += " AND is_root = 0"- joinWhereClause += " AND e.is_root = 0"+ clause += " AND " + col + "is_root = 0"}-if methodFilter != "" {- whereClause += " AND startsWith(endpoint, ?)"- joinWhereClause += " AND startsWith(e.endpoint, ?)"- args = append(args, strings.ToUpper(methodFilter)+" ")+ clause += " AND startsWith(" + col + "endpoint, ?)"+ args = append(args, shared.MethodPrefix(methodFilter))}+ return clause, args+}++func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectId uuid.UUID, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string, search string, rootFilter string, methodFilter string) ([]models.EndpointStats, int64, error) {+ // Count query uses bare column names; main query uses e. prefix for LEFT JOIN+ filterClause, filterArgs := endpointFilterClause("", search, rootFilter, methodFilter)+ joinFilterClause, _ := endpointFilterClause("e.", search, rootFilter, methodFilter)+ whereClause := "project_id = ? AND recorded_at >= ? AND recorded_at <= ?" + filterClause+ joinWhereClause := "e.project_id = ? AND e.recorded_at >= ? AND e.recorded_at <= ?" + joinFilterClause+ args := append([]interface{}{projectId, fromDate, toDate}, filterArgs...)// Count unique endpointsvar count uint64@@ -709,41 +708,31 @@ func (e *endpointRepository) GetEndpointStats(ctx context.Context, projectId uui}// GetEndpointStackedChart returns time-bucketed data for top 5 endpoints by metric + "Other"-func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projectId uuid.UUID, start, end time.Time, intervalMinutes int, metricType string) (*models.EndpointStackedChartResponse, error) {- // Step 1: Get top 5 endpoints ranked by selected metric (streams excluded)- var rankQuery string+func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projectId uuid.UUID, start, end time.Time, intervalMinutes int, metricType string, search, rootFilter, methodFilter string) (*models.EndpointStackedChartResponse, error) {+ filterClause, filterArgs := endpointFilterClause("", search, rootFilter, methodFilter)++ var metricExpr stringswitch metricType {case "total_time":- rankQuery = `SELECT endpoint, count() * quantile(0.5)(duration) / 1000000 as metric_value- FROM endpoints- WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ? AND is_stream = 0- GROUP BY endpoint- ORDER BY metric_value DESC- LIMIT 5`+ metricExpr = "count() * quantile(0.5)(duration) / 1000000"case "p95":- rankQuery = `SELECT endpoint, quantile(0.95)(duration) / 1000000 as metric_value- FROM endpoints- WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ? AND is_stream = 0- GROUP BY endpoint- ORDER BY metric_value DESC- LIMIT 5`+ metricExpr = "quantile(0.95)(duration) / 1000000"case "p99":- rankQuery = `SELECT endpoint, quantile(0.99)(duration) / 1000000 as metric_value- FROM endpoints- WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ? AND is_stream = 0- GROUP BY endpoint- ORDER BY metric_value DESC- LIMIT 5`+ metricExpr = "quantile(0.99)(duration) / 1000000"default: // p50- rankQuery = `SELECT endpoint, quantile(0.5)(duration) / 1000000 as metric_value- FROM endpoints- WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ? AND is_stream = 0- GROUP BY endpoint- ORDER BY metric_value DESC- LIMIT 5`+ metricExpr = "quantile(0.5)(duration) / 1000000"}- rows, err := chdb.Conn.Query(ctx, rankQuery, projectId, start, end)+ // Step 1: Get top 5 endpoints ranked by selected metric (streams excluded)+ rankQuery := `SELECT endpoint, ` + metricExpr + ` as metric_value+ FROM endpoints+ WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ? AND is_stream = 0` + filterClause + `+ GROUP BY endpoint+ ORDER BY metric_value DESC+ LIMIT 5`++ rankArgs := append([]interface{}{projectId, start, end}, filterArgs...)+ rows, err := chdb.Conn.Query(ctx, rankQuery, rankArgs...)if err != nil {return nil, err}@@ -768,18 +757,6 @@ func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projec}// Step 2: Build the time-bucketed query with top endpoints + "Other"- var metricExpr string- switch metricType {- case "total_time":- metricExpr = "count() * quantile(0.5)(duration) / 1000000"- case "p95":- metricExpr = "quantile(0.95)(duration) / 1000000"- case "p99":- metricExpr = "quantile(0.99)(duration) / 1000000"- default: // p50- metricExpr = "quantile(0.5)(duration) / 1000000"- }-caseExpr := "multiIf("for range topEndpoints {caseExpr += "endpoint = ?, ?, "@@ -791,16 +768,17 @@ func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projec` + caseExpr + ` as endpoint_category,` + metricExpr + ` as metric_valueFROM endpoints- WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ? AND is_stream = 0+ WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ? AND is_stream = 0` + filterClause + `GROUP BY bucket, endpoint_categoryORDER BY bucket ASC, endpoint_category ASC`- args := make([]interface{}, 0, len(topEndpoints)*2+4)+ args := make([]interface{}, 0, len(topEndpoints)*2+4+len(filterArgs))args = append(args, intervalMinutes)for _, ep := range topEndpoints {args = append(args, ep, ep)}args = append(args, projectId, start, end)+ args = append(args, filterArgs...)rows, err = chdb.Conn.Query(ctx, timeSeriesQuery, args...)if err != nil {diff --git a/backend/app/repositories/telemetry/duckdb/endpoint.repository.go b/backend/app/repositories/telemetry/duckdb/endpoint.repository.goindex a0dcc38d..f93ea8a6 100644--- a/backend/app/repositories/telemetry/duckdb/endpoint.repository.go+++ b/backend/app/repositories/telemetry/duckdb/endpoint.repository.go@@ -219,19 +219,25 @@ func (e *endpointRepository) FindAll(ctx context.Context, projectId uuid.UUID, freturn endpoints, count, nil}-func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectId uuid.UUID, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string, search string, rootFilter string, methodFilter string) ([]models.EndpointStats, int64, error) {- params := lit.P{"project_id": projectId, "from": fromDate.UTC(), "to": toDate.UTC()}-- whereClause := "e.project_id = :project_id AND e.recorded_at >= :from AND e.recorded_at <= :to"+func endpointFilterClause(params lit.P, col, search, rootFilter, methodFilter string) string {+ clause := ""if search != "" {- whereClause += " AND INSTR(LOWER(e.endpoint), LOWER(:search)) > 0"+ clause += " AND INSTR(LOWER(" + col + "endpoint), LOWER(:search)) > 0"params["search"] = search}- if methodFilter != "" {- params["method"] = strings.ToUpper(methodFilter) + " %"+ clause += shared.RootFilterClause(col+"is_root", rootFilter)+ if methodClause, method := shared.MethodFilterClause(col+"endpoint", methodFilter); methodClause != "" {+ clause += methodClause+ params["method"] = method}- whereClause += shared.RootFilterClause("e.is_root", rootFilter)- whereClause += shared.MethodFilterClause("e.endpoint", methodFilter)+ return clause+}++func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectId uuid.UUID, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string, search string, rootFilter string, methodFilter string) ([]models.EndpointStats, int64, error) {+ params := lit.P{"project_id": projectId, "from": fromDate.UTC(), "to": toDate.UTC()}++ whereClause := "e.project_id = :project_id AND e.recorded_at >= :from AND e.recorded_at <= :to"+ whereClause += endpointFilterClause(params, "e.", search, rootFilter, methodFilter)groupQuery := `SELECTe.endpoint,@@ -627,10 +633,11 @@ func (e *endpointRepository) GetEndpointStats(ctx context.Context, projectId uuireturn &stats, nil}-func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projectId uuid.UUID, start, end time.Time, intervalMinutes int, metricType string) (*models.EndpointStackedChartResponse, error) {+func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projectId uuid.UUID, start, end time.Time, intervalMinutes int, metricType string, search, rootFilter, methodFilter string) (*models.EndpointStackedChartResponse, error) {params := lit.P{"project_id": projectId, "from": start.UTC(), "to": end.UTC()}+ filterClause := endpointFilterClause(params, "", search, rootFilter, methodFilter)- topEndpoints, err := getTopEndpointsByMetric(ctx, projectId, start, end, metricType)+ topEndpoints, err := getTopEndpointsByMetric(ctx, projectId, start, end, metricType, search, rootFilter, methodFilter)if err != nil {return nil, err}@@ -645,7 +652,7 @@ func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projecsecs := intervalMinutes * 60if metricType == "p50" || metricType == "p95" || metricType == "p99" || metricType == "" {- return e.getStackedChartWithPercentiles(ctx, projectId, start, end, secs, topEndpoints, metricType)+ return e.getStackedChartWithPercentiles(ctx, projectId, start, end, secs, topEndpoints, metricType, search, rootFilter, methodFilter)}caseExpr := "CASE "@@ -669,9 +676,9 @@ func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projec%s as endpoint_category,%s as metric_valueFROM endpoints- WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0+ WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0%sGROUP BY bucket, endpoint_category- ORDER BY bucket ASC, endpoint_category ASC`, timeBucketExpr("recorded_at", secs), caseExpr, metricExpr)+ ORDER BY bucket ASC, endpoint_category ASC`, timeBucketExpr("recorded_at", secs), caseExpr, metricExpr, filterClause)parsedQuery, args, err := lit.ParseNamedQuery(db.Driver, timeSeriesQuery, params)if err != nil {@@ -712,7 +719,7 @@ func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projec}, nil}-func (e *endpointRepository) getStackedChartWithPercentiles(ctx context.Context, projectId uuid.UUID, start, end time.Time, bucketSecs int, topEndpoints []string, metricType string) (*models.EndpointStackedChartResponse, error) {+func (e *endpointRepository) getStackedChartWithPercentiles(ctx context.Context, projectId uuid.UUID, start, end time.Time, bucketSecs int, topEndpoints []string, metricType string, search, rootFilter, methodFilter string) (*models.EndpointStackedChartResponse, error) {percentile := 0.5switch metricType {case "p95":@@ -722,6 +729,7 @@ func (e *endpointRepository) getStackedChartWithPercentiles(ctx context.Context,}params := lit.P{"project_id": projectId, "from": start.UTC(), "to": end.UTC()}+ filterClause := endpointFilterClause(params, "", search, rootFilter, methodFilter)caseExpr := "CASE "for i, ep := range topEndpoints {@@ -736,9 +744,9 @@ func (e *endpointRepository) getStackedChartWithPercentiles(ctx context.Context,%s as endpoint_category,quantile_cont(duration, %g) / 1000000.0 as metric_valueFROM endpoints- WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0+ WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0%sGROUP BY bucket, endpoint_category- ORDER BY bucket ASC, endpoint_category ASC`, timeBucketExpr("recorded_at", bucketSecs), caseExpr, percentile)+ ORDER BY bucket ASC, endpoint_category ASC`, timeBucketExpr("recorded_at", bucketSecs), caseExpr, percentile, filterClause)parsedQuery, args, err := lit.ParseNamedQuery(db.Driver, query, params)if err != nil {@@ -839,13 +847,14 @@ func sortEndpointStats(stats []models.EndpointStats, orderBy string, sortDirecti})}-func getTopEndpointsByMetric(ctx context.Context, projectId uuid.UUID, from, to time.Time, metricType string) ([]string, error) {+func getTopEndpointsByMetric(ctx context.Context, projectId uuid.UUID, from, to time.Time, metricType string, search, rootFilter, methodFilter string) ([]string, error) {params := lit.P{"project_id": projectId, "from": from.UTC(), "to": to.UTC()}+ filterClause := endpointFilterClause(params, "", search, rootFilter, methodFilter)if metricType == "total_time" {results, err := lit.SelectNamed[endpointMetricRow](db.TelemetryDB,`SELECT endpoint, COUNT(*) * AVG(duration) / 1000000.0 as metric_value- FROM endpoints WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0+ FROM endpoints WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0`+filterClause+`GROUP BY endpoint ORDER BY metric_value DESC LIMIT 5`,params)if err != nil {@@ -869,8 +878,8 @@ func getTopEndpointsByMetric(ctx context.Context, projectId uuid.UUID, from, toresults, err := lit.SelectNamed[endpointMetricRow](db.TelemetryDB,fmt.Sprintf(`SELECT endpoint, quantile_cont(duration, %g) / 1000000.0 as metric_value- FROM endpoints WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0- GROUP BY endpoint ORDER BY metric_value DESC LIMIT 5`, percentile),+ FROM endpoints WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0%s+ GROUP BY endpoint ORDER BY metric_value DESC LIMIT 5`, percentile, filterClause),params)if err != nil {return nil, errdiff --git a/backend/app/repositories/telemetry/endpoint_repository_test.go b/backend/app/repositories/telemetry/endpoint_repository_test.goindex 0e2806bb..7ea23e41 100644--- a/backend/app/repositories/telemetry/endpoint_repository_test.go+++ b/backend/app/repositories/telemetry/endpoint_repository_test.go@@ -2,6 +2,7 @@ package telemetryimport ("context"+ "fmt""testing""time"@@ -186,6 +187,88 @@ func TestEndpointRepository_FindGroupedByEndpoint_Search(t *testing.T) {}}+func TestEndpointRepository_FindGroupedByEndpoint_MethodFilter(t *testing.T) {+ setupTestDB(t)+ ctx := context.Background()+ projectId := uuid.New()+ now := truncateMs(time.Now().UTC())++ endpoints := []models.Endpoint{+ makeEndpoint(projectId, "GET /api/users", 100*time.Millisecond, 200, now),+ makeEndpoint(projectId, "POST /api/users", 200*time.Millisecond, 201, now.Add(time.Minute)),+ makeEndpoint(projectId, "GETAWAY /api/cars", 100*time.Millisecond, 200, now.Add(2*time.Minute)),+ makeEndpoint(projectId, "get /api/lowercase", 100*time.Millisecond, 200, now.Add(3*time.Minute)),+ }++ if err := EndpointRepository.InsertAsync(ctx, endpoints); err != nil {+ t.Fatalf("InsertAsync failed: %v", err)+ }++ stats, total, err := EndpointRepository.FindGroupedByEndpoint(ctx, projectId, now.Add(-time.Hour), now.Add(time.Hour), 1, 10, "count", "desc", "", "", "get")+ if err != nil {+ t.Fatalf("FindGroupedByEndpoint with method filter failed: %v", err)+ }++ if total != 1 {+ t.Errorf("expected 1 matching endpoint, got %d", total)+ }+ if len(stats) != 1 {+ t.Fatalf("expected 1 grouped stat, got %d", len(stats))+ }+ if stats[0].Endpoint != "GET /api/users" {+ t.Errorf("expected 'GET /api/users', got %q", stats[0].Endpoint)+ }+}++func TestEndpointRepository_GetEndpointStackedChart_Filters(t *testing.T) {+ setupTestDB(t)+ ctx := context.Background()+ projectId := uuid.New()+ now := truncateMs(time.Now().UTC())++ var endpoints []models.Endpoint+ for i := range 6 {+ name := fmt.Sprintf("GET /api/g%d", i)+ endpoints = append(endpoints, makeEndpoint(projectId, name, time.Duration(i+1)*100*time.Millisecond, 200, now))+ }+ endpoints = append(endpoints, makeEndpoint(projectId, "POST /api/p", time.Second, 201, now))++ if err := EndpointRepository.InsertAsync(ctx, endpoints); err != nil {+ t.Fatalf("InsertAsync failed: %v", err)+ }++ for _, metricType := range []string{"total_time", "p95"} {+ chart, err := EndpointRepository.GetEndpointStackedChart(ctx, projectId, now.Add(-time.Hour), now.Add(time.Hour), 5, metricType, "", "", "get")+ if err != nil {+ t.Fatalf("%s: GetEndpointStackedChart failed: %v", metricType, err)+ }+ if len(chart.Endpoints) != 6 || chart.Endpoints[5] != "Other" {+ t.Errorf("%s: expected five GET endpoints plus Other, got %v", metricType, chart.Endpoints)+ }+ for _, name := range chart.Endpoints {+ if name == "POST /api/p" {+ t.Errorf("%s: POST endpoint leaked into the filtered chart", metricType)+ }+ }+ if len(chart.Series) == 0 {+ t.Errorf("%s: expected series points", metricType)+ }+ for _, p := range chart.Series {+ if p.Endpoint == "POST /api/p" {+ t.Errorf("%s: POST endpoint leaked into the series", metricType)+ }+ }+ }++ chart, err := EndpointRepository.GetEndpointStackedChart(ctx, projectId, now.Add(-time.Hour), now.Add(time.Hour), 5, "total_time", "api/p", "", "")+ if err != nil {+ t.Fatalf("GetEndpointStackedChart with search failed: %v", err)+ }+ if len(chart.Endpoints) != 1 || chart.Endpoints[0] != "POST /api/p" {+ t.Errorf("expected the search to leave only POST /api/p, got %v", chart.Endpoints)+ }+}+func TestEndpointRepository_FindByEndpoint(t *testing.T) {setupTestDB(t)ctx := context.Background()diff --git a/backend/app/repositories/telemetry/shared/sqlfilter.go b/backend/app/repositories/telemetry/shared/sqlfilter.goindex 51da6ded..45143d2c 100644--- a/backend/app/repositories/telemetry/shared/sqlfilter.go+++ b/backend/app/repositories/telemetry/shared/sqlfilter.go@@ -1,6 +1,10 @@package shared-import "sort"+import (+ "fmt"+ "sort"+ "strings"+)// RootFilterClause returns the WHERE fragment for the issues/endpoints// root-vs-non-root filter; both embedded backends store is_root as 0/1.@@ -14,11 +18,17 @@ func RootFilterClause(qualifiedCol, rootFilter string) string {return ""}}-func MethodFilterClause(qualifiedCol, methodFilter string) string {- if methodFilter != "" {- return " AND " + qualifiedCol + " LIKE :method"++func MethodPrefix(method string) string {+ return strings.ToUpper(method) + " "+}++func MethodFilterClause(qualifiedCol, method string) (clause string, param string) {+ if method == "" {+ return "", ""}- return ""+ prefix := MethodPrefix(method)+ return fmt.Sprintf(" AND SUBSTR(%s, 1, %d) = :method", qualifiedCol, len(prefix)), prefix}// SortedKeys returns map keys in stable order so generated SQL and itsdiff --git a/backend/app/repositories/telemetry/shared/types.go b/backend/app/repositories/telemetry/shared/types.goindex 42897866..50896fed 100644--- a/backend/app/repositories/telemetry/shared/types.go+++ b/backend/app/repositories/telemetry/shared/types.go@@ -27,18 +27,18 @@ type FiredNotification struct {// scheduled time (the uptime timeline position); ExecutedAt is when the probe// actually ran.type CheckResult struct {- ProjectId uuid.UUID- CheckId int- RunId int- CheckType string- RecordedAt time.Time- ExecutedAt time.Time- Status string- LatencyMs float64- StatusCode int- ErrorMsg string- ExecutedBy string- ScreenshotKey string+ ProjectId uuid.UUID+ CheckId int+ RunId int+ CheckType string+ RecordedAt time.Time+ ExecutedAt time.Time+ Status string+ LatencyMs float64+ StatusCode int+ ErrorMsg string+ ExecutedBy string+ ScreenshotKey string// OutputKey references the stored Playwright output (stdout/stderr tail// + report error) of a failed browser run, next to the screenshot.OutputKey stringdiff --git a/backend/app/repositories/telemetry/sqlite/endpoint.repository.go b/backend/app/repositories/telemetry/sqlite/endpoint.repository.goindex 745f6123..11fdcc9a 100644--- a/backend/app/repositories/telemetry/sqlite/endpoint.repository.go+++ b/backend/app/repositories/telemetry/sqlite/endpoint.repository.go@@ -215,19 +215,25 @@ func (e *endpointRepository) FindAll(ctx context.Context, projectId uuid.UUID, freturn endpoints, count, nil}-func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectId uuid.UUID, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string, search string, rootFilter string, methodFilter string) ([]models.EndpointStats, int64, error) {- params := lit.P{"project_id": projectId, "from": sqlitetypes.NewSQLiteTime(fromDate), "to": sqlitetypes.NewSQLiteTime(toDate)}-- whereClause := "e.project_id = :project_id AND e.recorded_at >= :from AND e.recorded_at <= :to"+func endpointFilterClause(params lit.P, col, search, rootFilter, methodFilter string) string {+ clause := ""if search != "" {- whereClause += " AND INSTR(LOWER(e.endpoint), LOWER(:search)) > 0"+ clause += " AND INSTR(LOWER(" + col + "endpoint), LOWER(:search)) > 0"params["search"] = search}- if methodFilter != "" {- params["method"] = strings.ToUpper(methodFilter) + " %"+ clause += shared.RootFilterClause(col+"is_root", rootFilter)+ if methodClause, method := shared.MethodFilterClause(col+"endpoint", methodFilter); methodClause != "" {+ clause += methodClause+ params["method"] = method}- whereClause += shared.RootFilterClause("e.is_root", rootFilter)- whereClause += shared.MethodFilterClause("e.endpoint", methodFilter)+ return clause+}++func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectId uuid.UUID, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string, search string, rootFilter string, methodFilter string) ([]models.EndpointStats, int64, error) {+ params := lit.P{"project_id": projectId, "from": sqlitetypes.NewSQLiteTime(fromDate), "to": sqlitetypes.NewSQLiteTime(toDate)}++ whereClause := "e.project_id = :project_id AND e.recorded_at >= :from AND e.recorded_at <= :to"+ whereClause += endpointFilterClause(params, "e.", search, rootFilter, methodFilter)countQuery := "SELECT COUNT(DISTINCT e.endpoint) AS count FROM endpoints e WHERE " + whereClausetotalResult, err := lit.SelectSingleNamed[models.CountResult](db.TelemetryDB, countQuery, params)@@ -628,10 +634,11 @@ func (e *endpointRepository) GetEndpointStats(ctx context.Context, projectId uuireturn &stats, nil}-func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projectId uuid.UUID, start, end time.Time, intervalMinutes int, metricType string) (*models.EndpointStackedChartResponse, error) {+func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projectId uuid.UUID, start, end time.Time, intervalMinutes int, metricType string, search, rootFilter, methodFilter string) (*models.EndpointStackedChartResponse, error) {params := lit.P{"project_id": projectId, "from": sqlitetypes.NewSQLiteTime(start), "to": sqlitetypes.NewSQLiteTime(end)}+ filterClause := endpointFilterClause(params, "", search, rootFilter, methodFilter)- topEndpoints, err := getTopEndpointsByMetric(ctx, projectId, start, end, metricType)+ topEndpoints, err := getTopEndpointsByMetric(ctx, projectId, start, end, metricType, search, rootFilter, methodFilter)if err != nil {return nil, err}@@ -646,7 +653,7 @@ func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projecsecs := intervalMinutes * 60if metricType == "p50" || metricType == "p95" || metricType == "p99" || metricType == "" {- return e.getStackedChartWithPercentiles(ctx, projectId, start, end, secs, topEndpoints, metricType)+ return e.getStackedChartWithPercentiles(ctx, projectId, start, end, secs, topEndpoints, metricType, search, rootFilter, methodFilter)}caseExpr := "CASE "@@ -670,9 +677,9 @@ func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projec%s as endpoint_category,%s as metric_valueFROM endpoints- WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0+ WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0%sGROUP BY bucket, endpoint_category- ORDER BY bucket ASC, endpoint_category ASC`, secs, secs, caseExpr, metricExpr)+ ORDER BY bucket ASC, endpoint_category ASC`, secs, secs, caseExpr, metricExpr, filterClause)parsedQuery, args, err := lit.ParseNamedQuery(db.Driver, timeSeriesQuery, params)if err != nil {@@ -713,7 +720,7 @@ func (e *endpointRepository) GetEndpointStackedChart(ctx context.Context, projec}, nil}-func (e *endpointRepository) getStackedChartWithPercentiles(ctx context.Context, projectId uuid.UUID, start, end time.Time, bucketSecs int, topEndpoints []string, metricType string) (*models.EndpointStackedChartResponse, error) {+func (e *endpointRepository) getStackedChartWithPercentiles(ctx context.Context, projectId uuid.UUID, start, end time.Time, bucketSecs int, topEndpoints []string, metricType string, search, rootFilter, methodFilter string) (*models.EndpointStackedChartResponse, error) {percentile := 0.5switch metricType {case "p95":@@ -727,16 +734,18 @@ func (e *endpointRepository) getStackedChartWithPercentiles(ctx context.Context,topSet[ep] = true}+ params := lit.P{"project_id": projectId, "from": sqlitetypes.NewSQLiteTime(start), "to": sqlitetypes.NewSQLiteTime(end)}+ filterClause := endpointFilterClause(params, "", search, rootFilter, methodFilter)+query := fmt.Sprintf(`SELECTdatetime((strftime('%%s', recorded_at) / %d) * %d, 'unixepoch') as bucket,endpoint,durationFROM endpoints- WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0- ORDER BY bucket ASC, endpoint ASC, duration ASC`, bucketSecs, bucketSecs)+ WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0%s+ ORDER BY bucket ASC, endpoint ASC, duration ASC`, bucketSecs, bucketSecs, filterClause)- parsedQuery, args, err := lit.ParseNamedQuery(db.Driver, query,- lit.P{"project_id": projectId, "from": sqlitetypes.NewSQLiteTime(start), "to": sqlitetypes.NewSQLiteTime(end)})+ parsedQuery, args, err := lit.ParseNamedQuery(db.Driver, query, params)if err != nil {return nil, err}@@ -874,13 +883,14 @@ func sortEndpointStats(stats []models.EndpointStats, orderBy string, sortDirecti})}-func getTopEndpointsByMetric(ctx context.Context, projectId uuid.UUID, from, to time.Time, metricType string) ([]string, error) {+func getTopEndpointsByMetric(ctx context.Context, projectId uuid.UUID, from, to time.Time, metricType string, search, rootFilter, methodFilter string) ([]string, error) {params := lit.P{"project_id": projectId, "from": sqlitetypes.NewSQLiteTime(from), "to": sqlitetypes.NewSQLiteTime(to)}+ filterClause := endpointFilterClause(params, "", search, rootFilter, methodFilter)if metricType == "total_time" {results, err := lit.SelectNamed[endpointMetricRow](db.TelemetryDB,`SELECT endpoint, COUNT(*) * AVG(duration) / 1000000.0 as metric_value- FROM endpoints WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0+ FROM endpoints WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0`+filterClause+`GROUP BY endpoint ORDER BY metric_value DESC LIMIT 5`,params)if err != nil {@@ -903,7 +913,7 @@ func getTopEndpointsByMetric(ctx context.Context, projectId uuid.UUID, from, to}epRows, err := lit.SelectNamed[distinctEndpointRow](db.TelemetryDB,- `SELECT DISTINCT endpoint FROM endpoints WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0`,+ `SELECT DISTINCT endpoint FROM endpoints WHERE project_id = :project_id AND recorded_at >= :from AND recorded_at <= :to AND is_stream = 0`+filterClause,params)if err != nil {return nil, errdiff --git a/backend/app/repositories/telemetry/testhelper_clickhouse_test.go b/backend/app/repositories/telemetry/testhelper_clickhouse_test.goindex 9f095e76..a2c0885c 100644--- a/backend/app/repositories/telemetry/testhelper_clickhouse_test.go+++ b/backend/app/repositories/telemetry/testhelper_clickhouse_test.go@@ -10,11 +10,11 @@ import ("testing""github.com/ClickHouse/clickhouse-go/v2"+ _ "github.com/lib/pq""github.com/tracewayapp/lit/v2""github.com/tracewayapp/traceway/backend/app/chdb""github.com/tracewayapp/traceway/backend/app/db""github.com/tracewayapp/traceway/backend/app/models"- _ "github.com/lib/pq")func setupTestDB(t *testing.T) {diff --git a/backend/app/services/grafana/convert.go b/backend/app/services/grafana/convert.goindex dac2b0e7..bc462e0f 100644--- a/backend/app/services/grafana/convert.go+++ b/backend/app/services/grafana/convert.go@@ -47,17 +47,17 @@ type grafanaTarget struct {}var panelTypeMap = map[string]string{- "timeseries": "line_chart",- "graph": "line_chart",- "stat": "single_value",- "singlestat": "single_value",- "gauge": "gauge",- "bargauge": "gauge",- "barchart": "bar_chart",- "bar chart": "bar_chart",- "table": "table",- "table-old": "table",- "piechart": "bar_chart",+ "timeseries": "line_chart",+ "graph": "line_chart",+ "stat": "single_value",+ "singlestat": "single_value",+ "gauge": "gauge",+ "bargauge": "gauge",+ "barchart": "bar_chart",+ "bar chart": "bar_chart",+ "table": "table",+ "table-old": "table",+ "piechart": "bar_chart","state-timeline": "line_chart",}diff --git a/backend/cmd/run.go b/backend/cmd/run.goindex e490dea4..2bc2c91a 100644--- a/backend/cmd/run.go+++ b/backend/cmd/run.go@@ -86,10 +86,10 @@ func Run(opts ...Option) {if err := services.InitJWT(); err != nil {// A missing signing key is a configuration mistake, not a crash: print// something actionable instead of burying the message under a panic- // stack trace. There is deliberately no default -- a key committed to- // the repo would be identical in every clone.- config.Logln("FATAL: " + err.Error())- config.Logln("Generate one with: openssl rand -hex 32")+ // stack trace. The standalone binary deliberately has no default -- a+ // key committed to the repo would be identical in every clone.+ fmt.Fprintln(os.Stderr, "FATAL: "+err.Error())+ fmt.Fprintln(os.Stderr, "Generate one with: openssl rand -hex 32")os.Exit(1)}@@ -293,12 +293,7 @@ func Run(opts ...Option) {// unconfigured). That made the same failure either fatal or invisible// depending on the order of PORTS.var listeners []net.Listener- for _, port := range strings.Split(ports, ",") {- port = strings.TrimSpace(port)- if port == "" {- continue- }-+ for _, port := range parsePorts(ports) {addr := ":" + portlistener, err := net.Listen("tcp", addr)if err != nil {@@ -315,8 +310,6 @@ func Run(opts ...Option) {for _, listener := range listeners[1:] {go func(listener net.Listener) {- defer traceway.Recover()-config.Logln("Starting server on " + listener.Addr().String())serveHTTP(router, listener)}(listener)@@ -327,6 +320,16 @@ func Run(opts ...Option) {serveHTTP(router, listeners[0])}+func parsePorts(ports string) []string {+ var out []string+ for _, port := range strings.Split(ports, ",") {+ if port = strings.TrimSpace(port); port != "" {+ out = append(out, port)+ }+ }+ return out+}+func warnOnUntrustedForwardedFor(proxies []string) gin.HandlerFunc {detect := newUntrustedForwarderDetector(proxies)return func(c *gin.Context) {diff --git a/backend/cmd/run_test.go b/backend/cmd/run_test.goindex 810c6fd7..d70a73bf 100644--- a/backend/cmd/run_test.go+++ b/backend/cmd/run_test.go@@ -4,6 +4,7 @@ import ("net""net/http""net/http/httptest"+ "slices""testing""github.com/gin-gonic/gin"@@ -97,3 +98,19 @@ func TestUntrustedForwarderDetectorFiresOnceForPeersOutsideTheList(t *testing.T)t.Fatal("fired a second time")}}++func TestParsePorts(t *testing.T) {+ cases := map[string][]string{+ "80,8082": {"80", "8082"},+ " 8082 , ": {"8082"},+ ",8082": {"8082"},+ "8082": {"8082"},+ ",": nil,+ "": nil,+ }+ for in, want := range cases {+ if got := parsePorts(in); !slices.Equal(got, want) {+ t.Errorf("parsePorts(%q) = %v, want %v", in, got, want)+ }+ }+}diff --git a/benchmarks/README.md b/benchmarks/README.mdindex 13e38736..7dee5475 100644--- a/benchmarks/README.md+++ b/benchmarks/README.md@@ -331,6 +331,16 @@ historical folders (`benchmarks/results/2026-05-15/` etc.) from beforethis layout change are kept in git for reference but are no longer writtento.+### Metrics store benchmark++`.github/workflows/benchmark-metricsdb.yml`, `workflow_dispatch` only. It+provisions one dedicated-core Hetzner box per database (VictoriaMetrics,+ClickHouse, DuckDB, Firebolt) and tears it down afterwards; a full run of the+default four on ccx33 is about EUR 2.50. It uses the same two secrets as the+hardware benchmark. The `benchmarks/metricsdb` tree it builds and runs is not+on `main` yet (`.gitignore` excludes it while it lives on a branch), so a+dispatch fails at the build job until that tree lands.+## Running against managed ClickHouseSetting `modes=managed-ch` in the workflow dispatch (or `--mode managed-ch`diff --git a/cli/.envrc b/cli/.envrcdeleted file mode 100644index a70aa849..00000000--- a/cli/.envrc+++ /dev/null@@ -1,2 +0,0 @@-use flake-[[ -f .envrc.local ]] && source_env .envrc.localdiff --git a/cli/flake.lock b/cli/flake.lockdeleted file mode 100644index 503ff2a9..00000000--- a/cli/flake.lock+++ /dev/null@@ -1,61 +0,0 @@-{- "nodes": {- "flake-utils": {- "inputs": {- "systems": "systems"- },- "locked": {- "lastModified": 1731533236,- "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",- "owner": "numtide",- "repo": "flake-utils",- "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",- "type": "github"- },- "original": {- "owner": "numtide",- "repo": "flake-utils",- "type": "github"- }- },- "nixpkgs": {- "locked": {- "lastModified": 1779357205,- "narHash": "sha256-cCO8aTqss5x9Ky8GWkpY0Hy5fyTZEbtifSUV8QjSzic=",- "owner": "NixOS",- "repo": "nixpkgs",- "rev": "f83fc3c307e74bc5fd5adb7eb6b8b13ffd2a36e1",- "type": "github"- },- "original": {- "owner": "NixOS",- "ref": "nixos-unstable",- "repo": "nixpkgs",- "type": "github"- }- },- "root": {- "inputs": {- "flake-utils": "flake-utils",- "nixpkgs": "nixpkgs"- }- },- "systems": {- "locked": {- "lastModified": 1681028828,- "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",- "owner": "nix-systems",- "repo": "default",- "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",- "type": "github"- },- "original": {- "owner": "nix-systems",- "repo": "default",- "type": "github"- }- }- },- "root": "root",- "version": 7-}diff --git a/cli/flake.nix b/cli/flake.nixdeleted file mode 100644index 4a342668..00000000--- a/cli/flake.nix+++ /dev/null@@ -1,53 +0,0 @@-{- description = "traceway-cli — command-line client for Traceway observability";-- inputs = {- nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";- flake-utils.url = "github:numtide/flake-utils";- };-- outputs =- { nixpkgs, flake-utils, ... }:- flake-utils.lib.eachDefaultSystem (- system:- let- pkgs = import nixpkgs { inherit system; };- in- {- devShells.default = pkgs.mkShell {- packages = with pkgs; [- go- gopls- gotools- delve- golangci-lint- gofumpt- govulncheck- gomodifytags- impl- gotestsum-- gh- git- jq- just- ];-- shellHook = ''- export GOPATH="$PWD/.go"- export GOCACHE="$PWD/.go/cache"- export GOBIN="$PWD/.go/bin"- export PATH="$GOBIN:$PATH"-- echo "traceway-cli dev shell"- echo " go $(go version | cut -d' ' -f3)"- echo " golangci-lint $(golangci-lint version --short 2>/dev/null || echo unknown)"- echo " dlv $(dlv version 2>/dev/null | grep Version | awk '{print $2}')"- echo " gh $(gh --version | head -1 | cut -d' ' -f3)"- '';- };-- formatter = pkgs.nixfmt;- }- );-}diff --git a/docs/pages/learn/contributing.mdx b/docs/pages/learn/contributing.mdxindex 1031d165..a8feb70d 100644--- a/docs/pages/learn/contributing.mdx+++ b/docs/pages/learn/contributing.mdx@@ -52,7 +52,8 @@ Maintainers add labels after the issue is filed. You don't need to set them your## Prerequisites- **Go** 1.26 or later-- **Node.js** 18+ and npm+- **Node.js** 22 and npm (`frontend/package.json` pins `engines.node` and `frontend/.npmrc` enforces it)+- **Nix** (optional): `nix develop` at the repository root opens a shell with the pinned Go and Node plus `just`, `golangci-lint` and `govulncheck`. `.envrc` wires it into direnv, and `.envrc.local` (gitignored) is the place for `JWT_SECRET`.- **Docker** (for running the full ClickHouse + PostgreSQL test suite)- **ClickHouse** and **PostgreSQL** (only if running the standalone server locally; not needed for embedded/SQLite mode)@@ -293,6 +294,8 @@ Then create a pull request on GitHub. Include:- Steps to test, if applicable- Screenshots for UI changes+The backend and CLI workflows do not start on their own when a PR is opened. A maintainer applies the `ci` label to run them against the PR as it stands, and re-applies it after new pushes. That is why the local checks above matter: they are the only feedback until the label goes on.+### Keeping your fork up to date```bashdiff --git a/docs/pages/server/local-setup.mdx b/docs/pages/server/local-setup.mdxindex 125e5f80..04a8fe2c 100644--- a/docs/pages/server/local-setup.mdx+++ b/docs/pages/server/local-setup.mdx@@ -86,9 +86,9 @@ POSTGRES_SSLMODE=disableFor local OAuth testing, register the provider's callback URL as `http://localhost:5173/api/auth/callback/github` (or `.../google`).-3. Run the backend:+3. Run the backend with the standalone build tags. Without them you get the embedded build, which ignores the ClickHouse and PostgreSQL variables above and opens a local SQLite database instead:```bash-go run ./cmd/traceway+go run -tags "transactional_pg telemetry_ch" ./cmd/traceway```The backend will start on port **8082** and automatically run database migrations.diff --git a/flake.nix b/flake.nixindex 3c557113..5258e065 100644--- a/flake.nix+++ b/flake.nix@@ -15,10 +15,13 @@# Toolchain versions are derived from the manifests rather than# restated here, so bumping backend/go.mod or frontend/package.json- # moves the dev shell with it and the two cannot drift apart.- goVersion = builtins.match ".*\ngo ([0-9]+)\\.([0-9]+)\\.[0-9]+.*" (- builtins.readFile ./backend/go.mod- );+ # moves the dev shell with it and the two cannot drift apart. The+ # `toolchain` directive is what builds the backend, so it wins over the+ # `go` floor when present.+ goMod = builtins.readFile ./backend/go.mod;+ goToolchain = builtins.match ".*\ntoolchain go([0-9]+)\\.([0-9]+)(\\.[0-9]+)?.*" goMod;+ goFloor = builtins.match ".*\ngo ([0-9]+)\\.([0-9]+)(\\.[0-9]+)?.*" goMod;+ goVersion = if goToolchain != null then goToolchain else goFloor;go = pkgs."go_${builtins.elemAt goVersion 0}_${builtins.elemAt goVersion 1}";frontendPackage = builtins.fromJSON (builtins.readFile ./frontend/package.json);@@ -53,10 +56,12 @@# would capture it. Versions are interpolated at eval time rather than# probed, so entering a shell does not fork go/node.#- # Nothing here exports backend configuration: the backend supplies its- # own defaults, so a dev shell that set them would only shadow- # backend/.env (godotenv.Load never overwrites an already-set variable)- # and would drift from the code it duplicates.+ # Nothing here exports backend configuration: the backend defaults+ # everything except JWT_SECRET, so a dev shell that set the rest would+ # only shadow backend/.env (godotenv.Load never overwrites an+ # already-set variable) and would drift from the code it duplicates.+ # JWT_SECRET belongs in the gitignored .envrc.local, which .envrc+ # sources; the banner says so.mkShell ={name,@@ -75,12 +80,14 @@goBanner = ''echo " go ${go.version}"'';nodeBanner = ''echo " node ${nodejs.version}"'';+ secretBanner = ''echo " env export JWT_SECRET (32+ chars, e.g. openssl rand -hex 32) in .envrc.local"'';goShell = mkShell {name = "backend";packages = goTools ++ sharedTools;banner = ''${goBanner}+ ${secretBanner}echo " run cd backend && go run ./cmd/traceway"echo " duckdb go build -tags telemetry_duckdb ./cmd/traceway"'';@@ -94,6 +101,7 @@banner = ''${goBanner}${nodeBanner}+ ${secretBanner}echo " commands: see the Quick Start table in CLAUDE.md"'';};diff --git a/frontend/src/lib/components/organization-project-switcher.svelte b/frontend/src/lib/components/organization-project-switcher.svelteindex 705ca29d..b37a8f14 100644--- a/frontend/src/lib/components/organization-project-switcher.svelte+++ b/frontend/src/lib/components/organization-project-switcher.svelte@@ -99,7 +99,7 @@<DropdownMenu.Separator />{/if}<DropdownMenu.Group>- {#if group.projects.length > 1}+ {#if group.projects.length !== 1}<DropdownMenu.Itemonclick={() => selectOrganization(group.organization.id)}class="cursor-pointer py-2"diff --git a/frontend/src/lib/components/traceway/toolbar-select.svelte b/frontend/src/lib/components/traceway/toolbar-select.svelteindex 5f44f6d5..da9bb481 100644--- a/frontend/src/lib/components/traceway/toolbar-select.svelte+++ b/frontend/src/lib/components/traceway/toolbar-select.svelte@@ -6,18 +6,19 @@interface Props {value?: string;- options: Option[];+ options: readonly Option[];class?: string;+ ariaLabel?: string;onChange?: (value: string) => void;}- let { value = $bindable(''), options, class: className, onChange }: Props = $props();+ let { value = $bindable(''), options, class: className, ariaLabel, onChange }: Props = $props();const label = $derived(options.find((o) => o.value === value)?.label ?? options[0]?.label ?? '');</script><Select.Root type="single" bind:value onValueChange={(v) => onChange?.(v ?? '')}>- <Select.Trigger class={cn('h-9 w-[140px]', className)}>+ <Select.Trigger class={cn('h-9 w-[140px]', className)} aria-label={ariaLabel}>{label}</Select.Trigger><Select.Content>diff --git a/frontend/src/lib/components/ui/endpoint-filter/endpoint-filter.svelte b/frontend/src/lib/components/ui/endpoint-filter/endpoint-filter.svelteindex 0d083652..af1116a3 100644--- a/frontend/src/lib/components/ui/endpoint-filter/endpoint-filter.svelte+++ b/frontend/src/lib/components/ui/endpoint-filter/endpoint-filter.svelte@@ -1,12 +1,20 @@<script lang="ts">import * as Select from '$lib/components/ui/select';+ import { RootFilter } from '$lib/components/ui/root-filter';+ import { cn } from '$lib/utils.js';+ import { METHOD_OPTIONS } from './methods';type Props = {rootValue?: string;methodValue?: string;+ class?: string;};- let { rootValue = $bindable('all'), methodValue = $bindable('all') }: Props = $props();+ let {+ rootValue = $bindable('all'),+ methodValue = $bindable('all'),+ class: className = 'sm:rounded-none sm:border-r-0'+ }: Props = $props();const METHOD_COLORS: Record<string, string> = {GET: 'text-sky-600 dark:text-sky-400',@@ -18,39 +26,27 @@OPTIONS: 'text-violet-600 dark:text-violet-400'};- const rootOptions = [- { value: 'all', label: 'All' },- { value: 'root', label: 'Root' },- { value: 'non_root', label: 'Non-root' }- ];-- const methodOptions = [- { value: 'all', label: 'Endpoints' },- { value: 'get', label: 'GET' },- { value: 'post', label: 'POST' },- { value: 'put', label: 'PUT' },- { value: 'patch', label: 'PATCH' },- { value: 'delete', label: 'DELETE' },- { value: 'options', label: 'OPTIONS' },- { value: 'head', label: 'HEAD' }- ];-- const rootLabel = $derived(- rootOptions.find((option) => option.value === rootValue)?.label ?? 'All'- );- const methodLabel = $derived(- methodOptions.find((option) => option.value === methodValue)?.label ?? 'Endpoints'+ const selectedMethod = $derived(+ METHOD_OPTIONS.find((option) => option.value === methodValue) ?? METHOD_OPTIONS[0]);</script><Select.Root type="single" bind:value={methodValue}>- <Select.Trigger class="h-9 w-[120px] shrink-0 shadow-none sm:rounded-none sm:border-r-0">- <span class={METHOD_COLORS[methodLabel] ?? ''}>- {methodLabel}+ <Select.Trigger+ aria-label="Filter by HTTP method"+ class={cn('h-9 w-[130px] shrink-0 shadow-none', className)}+ >+ <span+ class={cn(+ selectedMethod.value !== 'all' && 'font-mono text-sm',+ METHOD_COLORS[selectedMethod.label]+ )}+ >+ {selectedMethod.label}</span></Select.Trigger><Select.Content>- {#each methodOptions as option (option.value)}+ {#each METHOD_OPTIONS as option (option.value)}<Select.Itemvalue={option.value}label={option.label}@@ -62,13 +58,4 @@</Select.Content></Select.Root>-<Select.Root type="single" bind:value={rootValue}>- <Select.Trigger class="h-9 w-[110px] shrink-0 shadow-none sm:rounded-none sm:border-r-0">- {rootLabel}- </Select.Trigger>- <Select.Content>- {#each rootOptions as option (option.value)}- <Select.Item value={option.value} label={option.label}>{option.label}</Select.Item>- {/each}- </Select.Content>-</Select.Root>+<RootFilter bind:value={rootValue} class={cn('h-9 w-[110px] shrink-0 shadow-none', className)} />diff --git a/frontend/src/lib/components/ui/endpoint-filter/index.ts b/frontend/src/lib/components/ui/endpoint-filter/index.tsindex 7b210112..1279b1fd 100644--- a/frontend/src/lib/components/ui/endpoint-filter/index.ts+++ b/frontend/src/lib/components/ui/endpoint-filter/index.ts@@ -1 +1,2 @@export { default as EndpointFilter } from './endpoint-filter.svelte';+export { METHOD_OPTIONS, isMethodFilterValue, type MethodFilterValue } from './methods';diff --git a/frontend/src/lib/components/ui/endpoint-filter/methods.ts b/frontend/src/lib/components/ui/endpoint-filter/methods.tsnew file mode 100644index 00000000..0d0e4113--- /dev/null+++ b/frontend/src/lib/components/ui/endpoint-filter/methods.ts@@ -0,0 +1,16 @@+export const METHOD_OPTIONS = [+ { value: 'all', label: 'All methods' },+ { value: 'get', label: 'GET' },+ { value: 'post', label: 'POST' },+ { value: 'put', label: 'PUT' },+ { value: 'patch', label: 'PATCH' },+ { value: 'delete', label: 'DELETE' },+ { value: 'options', label: 'OPTIONS' },+ { value: 'head', label: 'HEAD' }+] as const;++export type MethodFilterValue = (typeof METHOD_OPTIONS)[number]['value'];++export function isMethodFilterValue(value: string | null): value is MethodFilterValue {+ return METHOD_OPTIONS.some((option) => option.value === value);+}diff --git a/frontend/src/lib/components/ui/root-filter/index.ts b/frontend/src/lib/components/ui/root-filter/index.tsindex 2438e3e2..db3c65fe 100644--- a/frontend/src/lib/components/ui/root-filter/index.ts+++ b/frontend/src/lib/components/ui/root-filter/index.ts@@ -1 +1,2 @@export { default as RootFilter } from './root-filter.svelte';+export { ROOT_FILTER_OPTIONS, isRootFilterValue, type RootFilterValue } from './options';diff --git a/frontend/src/lib/components/ui/root-filter/options.ts b/frontend/src/lib/components/ui/root-filter/options.tsnew file mode 100644index 00000000..933f9c99--- /dev/null+++ b/frontend/src/lib/components/ui/root-filter/options.ts@@ -0,0 +1,11 @@+export const ROOT_FILTER_OPTIONS = [+ { value: 'all', label: 'All' },+ { value: 'root', label: 'Root' },+ { value: 'non_root', label: 'Non-root' }+] as const;++export type RootFilterValue = (typeof ROOT_FILTER_OPTIONS)[number]['value'];++export function isRootFilterValue(value: string | null): value is RootFilterValue {+ return ROOT_FILTER_OPTIONS.some((option) => option.value === value);+}diff --git a/frontend/src/lib/components/ui/root-filter/root-filter.svelte b/frontend/src/lib/components/ui/root-filter/root-filter.svelteindex cb521afa..d88f7fe8 100644--- a/frontend/src/lib/components/ui/root-filter/root-filter.svelte+++ b/frontend/src/lib/components/ui/root-filter/root-filter.svelte@@ -1,5 +1,6 @@<script lang="ts">import ToolbarSelect from '$lib/components/traceway/toolbar-select.svelte';+ import { ROOT_FILTER_OPTIONS } from './options';type Props = {value?: string;@@ -7,12 +8,11 @@};let { value = $bindable('all'), class: className = 'w-[120px]' }: Props = $props();-- const options = [- { value: 'all', label: 'All' },- { value: 'root', label: 'Root' },- { value: 'non_root', label: 'Non-root' }- ];</script>-<ToolbarSelect bind:value {options} class={className} />+<ToolbarSelect+ bind:value+ options={ROOT_FILTER_OPTIONS}+ class={className}+ ariaLabel="Filter by root or non-root"+/>diff --git a/frontend/src/lib/components/ui/search-bar/search-bar.svelte b/frontend/src/lib/components/ui/search-bar/search-bar.svelteindex 3c27d305..f9d80644 100644--- a/frontend/src/lib/components/ui/search-bar/search-bar.svelte+++ b/frontend/src/lib/components/ui/search-bar/search-bar.svelte@@ -26,7 +26,7 @@* Optional slot rendered inside the joined search unit, between the type* select (if any) and the Go button. Use for a control that should share* the pill's borders instead of standing on its own - style it with- * `rounded-none border-r-0` to match.+ * `sm:rounded-none sm:border-r-0` to match.*/pillEnd?: Snippet;};@@ -61,7 +61,7 @@{#if typeOptions.length > 0}<Select.Root type="single" bind:value={typeValue}><Select.Trigger- class="h-9 w-fit shrink-0 shadow-none sm:rounded-none sm:border-r-0"+ class="h-9 min-w-[110px] shrink-0 shadow-none sm:rounded-none sm:border-r-0">{typeLabel}</Select.Trigger>diff --git a/frontend/src/lib/state/projects.svelte.ts b/frontend/src/lib/state/projects.svelte.tsindex 1955e7f0..332eda48 100644--- a/frontend/src/lib/state/projects.svelte.ts+++ b/frontend/src/lib/state/projects.svelte.ts@@ -151,6 +151,7 @@ class ProjectsState {currentProjectId = $state<string | null>(localStorage.getItem('CURRENT_PROJECT_ID'));loading = $state(false);error = $state<string | null>(null);+ loaded = $state(false);currentProject = $derived(this.projects.find((p) => p.id === this.currentProjectId) || this.projects[0] || null@@ -178,6 +179,7 @@ class ProjectsState {setProjects(projects: Project[]) {this.projects = projects;+ this.loaded = true;// If no current project selected or current project not in list, select first oneif (!this.currentProjectId || !this.projects.find((p) => p.id === this.currentProjectId)) {@@ -206,6 +208,7 @@ class ProjectsState {}} finally {this.loading = false;+ this.loaded = true;}}@@ -284,6 +287,7 @@ class ProjectsState {clear() {this.projects = [];this.currentProjectId = null;+ this.loaded = false;localStorage.removeItem(PROJECTS_CACHE_KEY);}diff --git a/frontend/src/routes/ai-traces/conversations/+page.svelte b/frontend/src/routes/ai-traces/conversations/+page.svelteindex 13135674..9ce56a23 100644--- a/frontend/src/routes/ai-traces/conversations/+page.svelte+++ b/frontend/src/routes/ai-traces/conversations/+page.svelte@@ -390,19 +390,19 @@onChange={applyFilterChange}class="h-9 w-[130px] shrink-0 shadow-none sm:rounded-none sm:border-r-0"/>- <ToolbarSelect- bind:value={modelFilter}- options={modelOptions}- class="h-9 w-[160px] shrink-0 shadow-none sm:rounded-none sm:border-r-0"- onChange={applyFilterChange}- />- <ToolbarSelect- bind:value={toolFilter}- options={toolOptions}- class="h-9 w-[150px] shrink-0 shadow-none sm:rounded-none sm:border-r-0"- onChange={applyFilterChange}- />{/snippet}+ <ToolbarSelect+ bind:value={modelFilter}+ options={modelOptions}+ class="w-[160px]"+ onChange={applyFilterChange}+ />+ <ToolbarSelect+ bind:value={toolFilter}+ options={toolOptions}+ class="w-[150px]"+ onChange={applyFilterChange}+ /></SearchBar>{#if filterPills.length > 0}diff --git a/frontend/src/routes/endpoints/+page.svelte b/frontend/src/routes/endpoints/+page.svelteindex efaa925c..f53190db 100644--- a/frontend/src/routes/endpoints/+page.svelte+++ b/frontend/src/routes/endpoints/+page.svelte@@ -42,7 +42,8 @@handleSortClick,type SortDirection} from '$lib/utils/sort-storage';- import { EndpointFilter } from '$lib/components/ui/endpoint-filter';+ import { EndpointFilter, isMethodFilterValue } from '$lib/components/ui/endpoint-filter';+ import { isRootFilterValue } from '$lib/components/ui/root-filter';const timezone = $derived(getTimezone());const initialTimezone = getTimezone();@@ -109,16 +110,27 @@let total = $state(0);let totalPages = $state(0);- // Parse URL params including search + rootFilter+ // Parse URL params including search + rootFilter + methodFilterfunction parseEndpointsUrlParams() {- if (!browser) return { preset: '24h', from: null, to: null, search: '', rootFilter: 'all', methodFilter: 'all' };+ if (!browser) {+ return {+ preset: '24h',+ from: null,+ to: null,+ search: '',+ rootFilter: 'all',+ methodFilter: 'all'+ };+ }const params = new URLSearchParams(window.location.search);const timeParams = parseTimeRangeFromUrl(timezone, '24h');+ const rootParam = params.get('rootFilter');+ const methodParam = params.get('methodFilter');return {...timeParams,search: params.get('search') || '',- rootFilter: params.get('rootFilter') || 'all',- methodFilter: params.get('methodFilter') || 'all'+ rootFilter: isRootFilterValue(rootParam) ? rootParam : 'all',+ methodFilter: isMethodFilterValue(methodParam) ? methodParam : 'all'};}@@ -237,6 +249,14 @@return 240; // 4 hours}+ function filterRequestFields() {+ return {+ search: searchQuery.trim(),+ rootFilter: rootFilter === 'all' ? '' : rootFilter,+ methodFilter: methodFilter === 'all' ? '' : methodFilter+ };+ }+async function loadChartData() {chartLoading = true;@@ -251,7 +271,8 @@fromDate: fromStr,toDate: toStr,metricType: selectedMetric,- intervalMinutes: interval+ intervalMinutes: interval,+ ...filterRequestFields()},{ projectId: projectsState.currentProjectId ?? undefined })) as ChartResponse;@@ -298,9 +319,7 @@page: page,pageSize: pageSize},- search: searchQuery.trim(),- rootFilter: rootFilter === 'all' ? '' : rootFilter,- methodFilter: methodFilter === 'all' ? '' : methodFilter,+ ...filterRequestFields()};const response = await api.post('/endpoints/grouped', requestBody, {diff --git a/frontend/src/routes/organization/+page.svelte b/frontend/src/routes/organization/+page.svelteindex 774e91af..0264c919 100644--- a/frontend/src/routes/organization/+page.svelte+++ b/frontend/src/routes/organization/+page.svelte@@ -70,10 +70,18 @@setTabParam(tab);}+ $effect(() => {+ if (!projectsState.loaded) return;+ const tab = page.url.searchParams.get('tab');+ if (tab && !tabs.some((t) => t.value === tab)) {+ setTabParam('overview');+ }+ });+$effect(() => {const organizationId = currentOrganizationId;if (organizationId === null) return;- if (singleProject) {+ if (projectsState.loaded && singleProject) {gotoHref(`/?projectId=${singleProject.id}`, { replaceState: true });return;}@@ -94,8 +102,10 @@});</script>-{#if singleProject}- <LoadingCircle size="xlg" />+{#if !projectsState.loaded || singleProject}+ <div class="flex h-48 items-center justify-center">+ <LoadingCircle size="xlg" />+ </div>{:else}<div class="space-y-4"><PageHeaderdiff --git a/frontend/src/routes/organization/overview-tab.svelte b/frontend/src/routes/organization/overview-tab.svelteindex 7593861c..7702c597 100644--- a/frontend/src/routes/organization/overview-tab.svelte+++ b/frontend/src/routes/organization/overview-tab.svelte@@ -542,8 +542,14 @@</div></a>{:else}- <div class="px-5 py-4">- <div class="text-xs text-muted-foreground">Active response</div>+ <a+ href="#pages-heading"+ class="group px-5 py-4 transition-colors hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset"+ >+ <div class="flex items-center justify-between text-xs text-muted-foreground">+ Active response+ <ArrowRight class="size-3.5 opacity-0 transition-opacity group-hover:opacity-100" />+ </div><divclass="mt-1 font-mono text-xl font-semibold tabular-nums {openPagesCount > 0? 'text-rose-600 dark:text-rose-400'@@ -551,7 +557,7 @@>{pagesLoading || pagesError ? '—' : openPagesCount}</div>- </div>+ </a>{/if}</div></section>