The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
more fixes
ddux53ad7144c7b1
diff --git a/Dockerfile b/Dockerfileindex 2df6c2ed..6794a916 100644--- a/Dockerfile+++ b/Dockerfile@@ -29,13 +29,13 @@ WORKDIR /app/backendRUN apk add --no-cache gitCOPY backend/ ./-COPY --from=frontend-builder /app/frontend/build ./static/dist/+COPY --from=frontend-builder /app/frontend/build ./static/frontend/RUN go mod edit -dropreplace=go.tracewayapp.com -dropreplace=go.tracewayapp.com/tracewayginRUN go mod tidyRUN go mod download-RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags "localdist,pgch" -ldflags="-s -w" -o /traceway ./cmd/traceway+RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags "pgch" -ldflags="-s -w" -o /traceway ./cmd/traceway# ==============================================================================# Stage 3: ClickHouse binary sourcediff --git a/Dockerfile.minimal b/Dockerfile.minimalindex 66381b26..1c8f2283 100644--- a/Dockerfile.minimal+++ b/Dockerfile.minimal@@ -37,8 +37,8 @@ RUN apk add --no-cache git# Copy all backend sourceCOPY backend/ ./-# Copy built frontend to static/dist for embedding-COPY --from=frontend-builder /app/frontend/build ./static/dist/+# Copy built frontend for embedding+COPY --from=frontend-builder /app/frontend/build ./static/frontend/# Strip local replace directives and download dependenciesRUN go mod edit -dropreplace=go.tracewayapp.com -dropreplace=go.tracewayapp.com/tracewaygin@@ -46,7 +46,7 @@ RUN go mod tidyRUN go mod download# Build with embedded static files-RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags "localdist,pgch" -ldflags="-s -w" -o /traceway ./cmd/traceway+RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags "pgch" -ldflags="-s -w" -o /traceway ./cmd/traceway# ==============================================================================# Stage 3: Minimal runtime imagediff --git a/README.md b/README.mdindex 6086da47..a87c5501 100644--- a/README.md+++ b/README.md@@ -105,7 +105,7 @@ See the [embedded mode guide](https://docs.tracewayapp.com/learn/embedded-mode)|-----|---------|| *(none)* | SQLite storage — embedded mode, zero dependencies. This is the default. || `pgch` | ClickHouse + PostgreSQL storage — standalone server mode. |-| `localdist` | Embeds the pre-built frontend into the Go binary. Used in Docker builds. |+| `localdist` | Embeds frontend from `static/dist/` instead of `static/frontend/`. Used by traceway-cloud to inject billing UI. |```bash# Embedded mode (SQLite, default)@@ -113,9 +113,6 @@ cd backend && go build ./cmd/traceway# Standalone server (ClickHouse + PostgreSQL)cd backend && go build -tags pgch ./cmd/traceway--# Docker image (embedded frontend + CH/PG)-cd backend && go build -tags "localdist,pgch" ./cmd/traceway```## Running Testsdiff --git a/backend/app/notifications/evaluator_polled_sqlite.go b/backend/app/notifications/evaluator_polled_sqlite.goindex 7fbba491..75633d69 100644--- a/backend/app/notifications/evaluator_polled_sqlite.go+++ b/backend/app/notifications/evaluator_polled_sqlite.go@@ -7,7 +7,6 @@ import ("encoding/json""fmt""math"- "sort""sync""time"@@ -63,7 +62,7 @@ func evaluateErrorRateThreshold(ctx context.Context, rule *models.NotificationRuvar total, errors int64err := db.DB.QueryRowContext(ctx,- "SELECT COUNT(*) as total, SUM(CASE WHEN status_code >= 500 THEN 1 ELSE 0 END) as errors FROM endpoints WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?",+ "SELECT COUNT(*) as total, COALESCE(SUM(CASE WHEN status_code >= 500 THEN 1 ELSE 0 END), 0) as errors FROM endpoints WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?",projectId.String(), from.Format(time.RFC3339Nano), now.Format(time.RFC3339Nano)).Scan(&total, &errors)if err != nil {return nil, err@@ -214,8 +213,8 @@ func evaluateApdexDrop(ctx context.Context, rule *models.NotificationRule, projevar total, satisfied, tolerating int64err := db.DB.QueryRowContext(ctx,`SELECT COUNT(*) as total,- SUM(CASE WHEN duration <= 750000000 AND status_code < 500 THEN 1 ELSE 0 END) as satisfied,- SUM(CASE WHEN duration > 750000000 AND duration <= 1500000000 AND status_code < 500 THEN 1 ELSE 0 END) as tolerating+ COALESCE(SUM(CASE WHEN duration <= 750000000 AND status_code < 500 THEN 1 ELSE 0 END), 0) as satisfied,+ COALESCE(SUM(CASE WHEN duration > 750000000 AND duration <= 1500000000 AND status_code < 500 THEN 1 ELSE 0 END), 0) as toleratingFROM endpoints WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?`,projectId.String(), from.Format(time.RFC3339Nano), now.Format(time.RFC3339Nano)).Scan(&total, &satisfied, &tolerating)if err != nil {@@ -340,7 +339,6 @@ func evaluateNoData(ctx context.Context, rule *models.NotificationRule, projectI}threshold := time.Now().UTC().Add(-time.Duration(cfg.SilenceMinutes) * time.Minute)- thresholdStr := threshold.Format(time.RFC3339Nano)pid := projectId.String()if cfg.DataType == "any" {@@ -389,7 +387,6 @@ func evaluateNoData(ctx context.Context, rule *models.NotificationRule, projectI}}- _ = thresholdStrprojectName := getProjectName(projectId)msg := buildNoDataMessage(cfg.DataType, cfg.SilenceMinutes, projectName)return &EvalResult{Fired: true, Message: msg}, nil@@ -573,7 +570,7 @@ func evaluateEndpointErrorRate(ctx context.Context, rule *models.NotificationRulvar total, errors int64err := db.DB.QueryRowContext(ctx,- "SELECT COUNT(*) as total, SUM(CASE WHEN status_code >= 500 THEN 1 ELSE 0 END) as errors FROM endpoints WHERE project_id = ? AND endpoint = ? AND recorded_at >= ? AND recorded_at <= ?",+ "SELECT COUNT(*) as total, COALESCE(SUM(CASE WHEN status_code >= 500 THEN 1 ELSE 0 END), 0) as errors FROM endpoints WHERE project_id = ? AND endpoint = ? AND recorded_at >= ? AND recorded_at <= ?",pid, cfg.Endpoint, from.Format(time.RFC3339Nano), now.Format(time.RFC3339Nano)).Scan(&total, &errors)if err != nil {return nil, err@@ -625,10 +622,10 @@ func evaluateImpactScore(ctx context.Context, rule *models.NotificationRule, proCOUNT(*) as total_count,MAX(e.recorded_at) as last_seen,COALESCE(s.offset_ms, 0) as offset_ms,- SUM(CASE WHEN e.duration <= (750000000 + COALESCE(s.offset_ms, 0) * 1000000) AND e.status_code < 500 THEN 1 ELSE 0 END) as satisfied_count,- SUM(CASE WHEN e.duration > (750000000 + COALESCE(s.offset_ms, 0) * 1000000) AND e.duration <= (1500000000 + COALESCE(s.offset_ms, 0) * 1000000) AND e.status_code < 500 THEN 1 ELSE 0 END) as tolerating_count,- SUM(CASE WHEN e.duration > (1500000000 + COALESCE(s.offset_ms, 0) * 1000000) OR e.status_code >= 500 THEN 1 ELSE 0 END) as bad_count,- SUM(CASE WHEN e.status_code >= 400 AND e.status_code < 500 THEN 1 ELSE 0 END) as client_error_count+ COALESCE(SUM(CASE WHEN e.duration <= (750000000 + COALESCE(s.offset_ms, 0) * 1000000) AND e.status_code < 500 THEN 1 ELSE 0 END), 0) as satisfied_count,+ COALESCE(SUM(CASE WHEN e.duration > (750000000 + COALESCE(s.offset_ms, 0) * 1000000) AND e.duration <= (1500000000 + COALESCE(s.offset_ms, 0) * 1000000) AND e.status_code < 500 THEN 1 ELSE 0 END), 0) as tolerating_count,+ COALESCE(SUM(CASE WHEN e.duration > (1500000000 + COALESCE(s.offset_ms, 0) * 1000000) OR e.status_code >= 500 THEN 1 ELSE 0 END), 0) as bad_count,+ COALESCE(SUM(CASE WHEN e.status_code >= 400 AND e.status_code < 500 THEN 1 ELSE 0 END), 0) as client_error_countFROM endpoints eLEFT JOIN slow_endpoints s ON e.endpoint = s.endpoint AND e.project_id = s.project_idWHERE e.project_id = ? AND e.recorded_at >= ? AND e.recorded_at <= ?@@ -808,15 +805,3 @@ func evaluateImpactScoreHigh(ctx context.Context, rule *models.NotificationRule,func evaluateImpactScoreMedium(ctx context.Context, rule *models.NotificationRule, projectId uuid.UUID) (*EvalResult, error) {return evaluateImpactScore(ctx, rule, projectId, 0.25, buildImpactScoreMediumMessage)}--// helper to sort by impact-type byImpact []struct {- endpoint string- impact float64-}--func (a byImpact) Len() int { return len(a) }-func (a byImpact) Less(i, j int) bool { return a[i].impact > a[j].impact }-func (a byImpact) Swap(i, j int) { a[i], a[j] = a[j], a[i] }--var _ = sort.Sortdiff --git a/docs/pages/learn/build-tags.mdx b/docs/pages/learn/build-tags.mdxindex 11006bd5..161fc37a 100644--- a/docs/pages/learn/build-tags.mdx+++ b/docs/pages/learn/build-tags.mdx@@ -8,7 +8,7 @@ The Traceway backend uses Go build tags to switch between storage backends and t|-----|---------|| *(none)* | **SQLite** storage — embedded mode, zero external dependencies. This is the default. || `pgch` | **ClickHouse + PostgreSQL** storage — standalone server mode. |-| `localdist` | Embeds the pre-built frontend static files into the Go binary. Used in Docker builds. |+| `localdist` | Embeds frontend from `static/dist/` instead of `static/frontend/`. Used by traceway-cloud to inject billing UI into the frontend build. Not needed for open-source builds. |## Building@@ -17,7 +17,7 @@ The Traceway backend uses Go build tags to switch between storage backends and tNo tags needed — a plain `go build` gives you the embedded SQLite backend:```bash-cd backend && go build ./...+cd backend && go build ./cmd/traceway```This is what library consumers get when they `go get github.com/tracewayapp/traceway/backend` and call `tracewaybackend.Run()`.@@ -25,20 +25,20 @@ This is what library consumers get when they `go get github.com/tracewayapp/trac### Standalone server (ClickHouse + PostgreSQL)```bash-cd backend && go build -tags pgch ./...+cd backend && go build -tags pgch ./cmd/traceway```Requires `CLICKHOUSE_SERVER`, `POSTGRES_HOST`, and the other environment variables to be configured.### Docker image-The Dockerfiles combine both `localdist` (embedded frontend) and `pgch` (CH+PG storage):+The Dockerfiles build the frontend and embed it into the Go binary with the `pgch` tag:```bash-go build -tags "localdist,pgch" ./...+go build -tags pgch ./cmd/traceway```-You don't need `localdist` for local development — run the frontend dev server separately with `cd frontend && npm run dev`.+The frontend is embedded from `static/frontend/` which the Docker build populates from the SvelteKit build output. You don't need to embed the frontend for local development — run the frontend dev server separately with `cd frontend && npm run dev`.## Running Tests