The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
rebased migrations + added uuids for ids
ddux92ed482dc3b2
diff --git a/backend/app/cache/project_cache.go b/backend/app/cache/project_cache.goindex 7fe48d38..b08d1767 100644--- a/backend/app/cache/project_cache.go+++ b/backend/app/cache/project_cache.go@@ -7,11 +7,13 @@ import ("sort""sync""time"++ "github.com/google/uuid")type projectCache struct {- projects map[string]*models.Project // key: token- projectsById map[string]*models.Project // key: id+ projects map[string]*models.Project // key: token+ projectsById map[uuid.UUID]*models.Project // key: idmu sync.RWMutexlastRefresh time.Time}@@ -19,7 +21,7 @@ type projectCache struct {// ProjectCache is the global project cache instancevar ProjectCache = &projectCache{projects: make(map[string]*models.Project),- projectsById: make(map[string]*models.Project),+ projectsById: make(map[uuid.UUID]*models.Project),}// Init initializes the cache by loading all projects from the database@@ -38,7 +40,7 @@ func (c *projectCache) Refresh(ctx context.Context) error {defer c.mu.Unlock()c.projects = make(map[string]*models.Project)- c.projectsById = make(map[string]*models.Project)+ c.projectsById = make(map[uuid.UUID]*models.Project)for i := range projects {proj := &projects[i]@@ -58,7 +60,7 @@ func (c *projectCache) GetByToken(token string) *models.Project {}// GetById returns a project by its ID, or nil if not found-func (c *projectCache) GetById(id string) *models.Project {+func (c *projectCache) GetById(id uuid.UUID) *models.Project {c.mu.RLock()defer c.mu.RUnlock()return c.projectsById[id]diff --git a/backend/app/controllers/clientcontrollers/client.controller.go b/backend/app/controllers/clientcontrollers/client.controller.goindex e042fe30..3a42d0bd 100644--- a/backend/app/controllers/clientcontrollers/client.controller.go+++ b/backend/app/controllers/clientcontrollers/client.controller.go@@ -53,7 +53,7 @@ func (e clientController) Report(c *gin.Context) {// Extract segments from transactionfor _, cs := range ct.Segments {- seg := cs.ToSegment(ct.Id)+ seg := cs.ToSegment(ct.ParsedId())seg.ProjectId = projectIdsegmentsToInsert = append(segmentsToInsert, seg)}@@ -61,7 +61,7 @@ func (e clientController) Report(c *gin.Context) {for _, cst := range cf.StackTraces {est := cst.ToExceptionStackTrace(computeExceptionHash(cst.StackTrace, cst.IsMessage), request.AppVersion, request.ServerName)- est.Id = uuid.New().String()+ est.Id = uuid.New()est.ProjectId = projectIdexceptionStackTraceToInsert = append(exceptionStackTraceToInsert, est)}diff --git a/backend/app/controllers/dashboard.controller.go b/backend/app/controllers/dashboard.controller.goindex 1e15a58b..86c5e149 100644--- a/backend/app/controllers/dashboard.controller.go+++ b/backend/app/controllers/dashboard.controller.go@@ -9,6 +9,7 @@ import ("time""github.com/gin-gonic/gin"+ "github.com/google/uuid")type dashboardController struct{}@@ -19,7 +20,11 @@ type DashboardOverviewResponse struct {}func (d dashboardController) GetDashboardOverview(c *gin.Context) {- projectId := c.Query("projectId")+ projectId, err := uuid.Parse(c.Query("projectId"))+ if err != nil {+ c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid project ID"})+ return+ }now := time.Now()start := now.Add(-24 * time.Hour)@@ -43,7 +48,11 @@ func (d dashboardController) GetDashboardOverview(c *gin.Context) {}func (d dashboardController) GetDashboard(c *gin.Context) {- projectId := c.Query("projectId")+ projectId, err := uuid.Parse(c.Query("projectId"))+ if err != nil {+ c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid project ID"})+ return+ }serversParam := c.Query("servers")// Parse selected serversdiff --git a/backend/app/controllers/endpoint.controller.go b/backend/app/controllers/endpoint.controller.goindex e24b7413..dd1fd352 100644--- a/backend/app/controllers/endpoint.controller.go+++ b/backend/app/controllers/endpoint.controller.go@@ -8,12 +8,13 @@ import ("time""github.com/gin-gonic/gin"+ "github.com/google/uuid")type endpointController struct{}type EndpointSearchRequest struct {- ProjectId string `json:"projectId"`+ ProjectId uuid.UUID `json:"projectId"`FromDate time.Time `json:"fromDate"`ToDate time.Time `json:"toDate"`OrderBy string `json:"orderBy"`@@ -22,7 +23,7 @@ type EndpointSearchRequest struct {}type EndpointInstancesRequest struct {- ProjectId string `json:"projectId"`+ ProjectId uuid.UUID `json:"projectId"`FromDate time.Time `json:"fromDate"`ToDate time.Time `json:"toDate"`OrderBy string `json:"orderBy"`diff --git a/backend/app/controllers/endpoint_detail.controller.go b/backend/app/controllers/endpoint_detail.controller.goindex e9ccfc2b..75c8c0ce 100644--- a/backend/app/controllers/endpoint_detail.controller.go+++ b/backend/app/controllers/endpoint_detail.controller.go@@ -6,12 +6,13 @@ import ("net/http""github.com/gin-gonic/gin"+ "github.com/google/uuid")type endpointDetailController struct{}type EndpointDetailRequest struct {- ProjectId string `json:"projectId"`+ ProjectId uuid.UUID `json:"projectId"`}type EndpointExceptionInfo struct {@@ -21,7 +22,7 @@ type EndpointExceptionInfo struct {}type EndpointMessageInfo struct {- Id string `json:"id"`+ Id uuid.UUID `json:"id"`ExceptionHash string `json:"exceptionHash"`StackTrace string `json:"stackTrace"`RecordedAt string `json:"recordedAt"`@@ -37,9 +38,9 @@ type EndpointDetailResponse struct {}func (c endpointDetailController) GetEndpointDetail(ctx *gin.Context) {- endpointId := ctx.Param("endpointId")- if endpointId == "" {- ctx.JSON(http.StatusBadRequest, gin.H{"error": "endpointId is required"})+ endpointId, err := uuid.Parse(ctx.Param("endpointId"))+ if err != nil {+ ctx.JSON(http.StatusBadRequest, gin.H{"error": "invalid endpointId"})return}diff --git a/backend/app/controllers/exception_stack_trace.controller.go b/backend/app/controllers/exception_stack_trace.controller.goindex 7bf68208..73115bd5 100644--- a/backend/app/controllers/exception_stack_trace.controller.go+++ b/backend/app/controllers/exception_stack_trace.controller.go@@ -8,12 +8,13 @@ import ("time""github.com/gin-gonic/gin"+ "github.com/google/uuid")type exceptionStackTraceController struct{}type ExceptionSearchRequest struct {- ProjectId string `json:"projectId"`+ ProjectId uuid.UUID `json:"projectId"`FromDate time.Time `json:"fromDate"`ToDate time.Time `json:"toDate"`OrderBy string `json:"orderBy"`@@ -24,12 +25,12 @@ type ExceptionSearchRequest struct {}type ArchiveRequest struct {- ProjectId string `json:"projectId"`- Hashes []string `json:"hashes"`+ ProjectId uuid.UUID `json:"projectId"`+ Hashes []string `json:"hashes"`}type ExceptionDetailRequest struct {- ProjectId string `json:"projectId"`+ ProjectId uuid.UUID `json:"projectId"`Pagination PaginationParams `json:"pagination"`}@@ -163,14 +164,14 @@ func (e exceptionStackTraceController) UnarchiveExceptions(c *gin.Context) {}func (e exceptionStackTraceController) FindById(c *gin.Context) {- exceptionId := c.Param("exceptionId")- if exceptionId == "" {- c.JSON(http.StatusBadRequest, gin.H{"error": "exception id is required"})+ exceptionId, err := uuid.Parse(c.Param("exceptionId"))+ if err != nil {+ c.JSON(http.StatusBadRequest, gin.H{"error": "invalid exception id"})return}var request struct {- ProjectId string `json:"projectId"`+ ProjectId uuid.UUID `json:"projectId"`}if err := c.ShouldBindJSON(&request); err != nil {c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})diff --git a/backend/app/controllers/metric_record.controller.go b/backend/app/controllers/metric_record.controller.goindex 61e5d92e..f044251b 100644--- a/backend/app/controllers/metric_record.controller.go+++ b/backend/app/controllers/metric_record.controller.go@@ -7,12 +7,13 @@ import ("time""github.com/gin-gonic/gin"+ "github.com/google/uuid")type metricRecordController struct{}type HomepageStatsRequest struct {- ProjectId string `json:"projectId"`+ ProjectId uuid.UUID `json:"projectId"`}func (e metricRecordController) FindHomepageStats(c *gin.Context) {diff --git a/backend/app/controllers/metrics.controller.go b/backend/app/controllers/metrics.controller.goindex fa8284f4..d25634c7 100644--- a/backend/app/controllers/metrics.controller.go+++ b/backend/app/controllers/metrics.controller.go@@ -7,6 +7,7 @@ import ("time""github.com/gin-gonic/gin"+ "github.com/google/uuid")type metricsController struct{}@@ -32,7 +33,11 @@ type ServerMetricsResponse struct {// GetApplicationMetrics returns Go application metrics (Go Routines, Heap Objects, GC Cycles, GC Pause)// Always returns ALL servers' data - ignores server selectorfunc (m metricsController) GetApplicationMetrics(c *gin.Context) {- projectId := c.Query("projectId")+ projectId, err := uuid.Parse(c.Query("projectId"))+ if err != nil {+ c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid project ID"})+ return+ }now := time.Now()start, end := parseTimeRange(c, now)@@ -104,7 +109,11 @@ func (m metricsController) GetApplicationMetrics(c *gin.Context) {// GetStatsMetrics returns request/exception stats (Requests, Exceptions, Avg Response Time, Error Rate)// These are NOT per-server metricsfunc (m metricsController) GetStatsMetrics(c *gin.Context) {- projectId := c.Query("projectId")+ projectId, err := uuid.Parse(c.Query("projectId"))+ if err != nil {+ c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid project ID"})+ return+ }now := time.Now()start, end := parseTimeRange(c, now)@@ -165,7 +174,11 @@ func (m metricsController) GetStatsMetrics(c *gin.Context) {// GetServerMetrics returns server resource metrics (CPU Usage, Memory Usage, Total Memory)// Always returns ALL servers' data - ignores server selectorfunc (m metricsController) GetServerMetrics(c *gin.Context) {- projectId := c.Query("projectId")+ projectId, err := uuid.Parse(c.Query("projectId"))+ if err != nil {+ c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid project ID"})+ return+ }now := time.Now()start, end := parseTimeRange(c, now)diff --git a/backend/app/controllers/project.controller.go b/backend/app/controllers/project.controller.goindex ab4ab4cf..c1a6fcdc 100644--- a/backend/app/controllers/project.controller.go+++ b/backend/app/controllers/project.controller.go@@ -9,6 +9,7 @@ import ("unicode/utf8""github.com/gin-gonic/gin"+ "github.com/google/uuid")// Valid framework values@@ -83,7 +84,11 @@ func (p projectController) CreateProject(c *gin.Context) {// GetProject returns a project by ID with its token (for connection page)func (p projectController) GetProject(c *gin.Context) {- projectId := c.Param("id")+ projectId, err := uuid.Parse(c.Param("id"))+ if err != nil {+ c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid project ID"})+ return+ }project := cache.ProjectCache.GetById(projectId)if project == nil {diff --git a/backend/app/controllers/task.controller.go b/backend/app/controllers/task.controller.goindex dc662e0e..3954125e 100644--- a/backend/app/controllers/task.controller.go+++ b/backend/app/controllers/task.controller.go@@ -8,12 +8,13 @@ import ("time""github.com/gin-gonic/gin"+ "github.com/google/uuid")type taskController struct{}type TaskSearchRequest struct {- ProjectId string `json:"projectId"`+ ProjectId uuid.UUID `json:"projectId"`FromDate time.Time `json:"fromDate"`ToDate time.Time `json:"toDate"`OrderBy string `json:"orderBy"`@@ -22,7 +23,7 @@ type TaskSearchRequest struct {}type TaskInstancesRequest struct {- ProjectId string `json:"projectId"`+ ProjectId uuid.UUID `json:"projectId"`FromDate time.Time `json:"fromDate"`ToDate time.Time `json:"toDate"`OrderBy string `json:"orderBy"`diff --git a/backend/app/controllers/task_detail.controller.go b/backend/app/controllers/task_detail.controller.goindex ef71f1a2..529dd12f 100644--- a/backend/app/controllers/task_detail.controller.go+++ b/backend/app/controllers/task_detail.controller.go@@ -6,12 +6,13 @@ import ("net/http""github.com/gin-gonic/gin"+ "github.com/google/uuid")type taskDetailController struct{}type TaskDetailRequest struct {- ProjectId string `json:"projectId"`+ ProjectId uuid.UUID `json:"projectId"`}type TaskExceptionInfo struct {@@ -21,7 +22,7 @@ type TaskExceptionInfo struct {}type TaskMessageInfo struct {- Id string `json:"id"`+ Id uuid.UUID `json:"id"`ExceptionHash string `json:"exceptionHash"`StackTrace string `json:"stackTrace"`RecordedAt string `json:"recordedAt"`@@ -37,9 +38,9 @@ type TaskDetailResponse struct {}func (c taskDetailController) GetTaskDetail(ctx *gin.Context) {- taskId := ctx.Param("taskId")- if taskId == "" {- ctx.JSON(http.StatusBadRequest, gin.H{"error": "taskId is required"})+ taskId, err := uuid.Parse(ctx.Param("taskId"))+ if err != nil {+ ctx.JSON(http.StatusBadRequest, gin.H{"error": "invalid taskId"})return}diff --git a/backend/app/middleware/use_client_auth.middleware.go b/backend/app/middleware/use_client_auth.middleware.goindex 33065a66..29a1b1ed 100644--- a/backend/app/middleware/use_client_auth.middleware.go+++ b/backend/app/middleware/use_client_auth.middleware.go@@ -6,6 +6,7 @@ import ("strings""github.com/gin-gonic/gin"+ "github.com/google/uuid")const ProjectContextKey = "project"@@ -41,9 +42,9 @@ func InitUseClientAuth() {}// GetProjectId retrieves the project ID from the Gin context-func GetProjectId(c *gin.Context) string {+func GetProjectId(c *gin.Context) uuid.UUID {if id, exists := c.Get(ProjectIdContextKey); exists {- return id.(string)+ return id.(uuid.UUID)}- return ""+ return uuid.Nil}diff --git a/backend/app/migrations/ch/0001_create_projects.up.sql b/backend/app/migrations/ch/0001_create_projects.up.sqlnew file mode 100644index 00000000..3652723a--- /dev/null+++ b/backend/app/migrations/ch/0001_create_projects.up.sql@@ -0,0 +1,13 @@+CREATE TABLE IF NOT EXISTS projects+(+ `id` UUID,+ `name` String,+ `token` String,+ `framework` LowCardinality(String) DEFAULT 'custom',+ `created_at` DateTime DEFAULT now(),+ INDEX idx_token token TYPE bloom_filter(0.001) GRANULARITY 1,+ INDEX idx_id id TYPE bloom_filter(0.001) GRANULARITY 1+)+ENGINE = MergeTree+ORDER BY id+SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0001_created_transactions.up.sql b/backend/app/migrations/ch/0001_created_transactions.up.sqldeleted file mode 100644index 8ada6f52..00000000--- a/backend/app/migrations/ch/0001_created_transactions.up.sql+++ /dev/null@@ -1,11 +0,0 @@-CREATE TABLE IF NOT EXISTS transactions (- id String,- endpoint String,- duration Int64,- recorded_at DateTime,- status_code Int32,- body_size Int32,- client_ip String-) ENGINE = MergeTree()-PARTITION BY toYYYYMM(recorded_at)-ORDER BY (recorded_at, endpoint);diff --git a/backend/app/migrations/ch/0002_create_endpoints.up.sql b/backend/app/migrations/ch/0002_create_endpoints.up.sqlnew file mode 100644index 00000000..cacc0d97--- /dev/null+++ b/backend/app/migrations/ch/0002_create_endpoints.up.sql@@ -0,0 +1,21 @@+CREATE TABLE IF NOT EXISTS endpoints+(+ `id` UUID,+ `project_id` UUID,+ `endpoint` LowCardinality(String),+ `duration` Int64,+ `recorded_at` DateTime,+ `status_code` Int16,+ `body_size` Int32,+ `client_ip` String,+ `scope` String DEFAULT '{}',+ `app_version` LowCardinality(String) DEFAULT '',+ `server_name` LowCardinality(String) DEFAULT '',+ INDEX idx_endpoint endpoint TYPE bloom_filter(0.01) GRANULARITY 4,+ INDEX idx_status_code status_code TYPE set(100) GRANULARITY 4,+ INDEX idx_id id TYPE bloom_filter(0.001) GRANULARITY 1+)+ENGINE = MergeTree+PARTITION BY toYYYYMMDD(recorded_at)+ORDER BY (project_id, recorded_at, endpoint)+SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0002_created_metric_records.up.sql b/backend/app/migrations/ch/0002_created_metric_records.up.sqldeleted file mode 100644index bf35f643..00000000--- a/backend/app/migrations/ch/0002_created_metric_records.up.sql+++ /dev/null@@ -1,12 +0,0 @@-CREATE TABLE IF NOT EXISTS metric_records (- project_id LowCardinality(String) DEFAULT '00000000-0000-0000-0000-000000000001',- name LowCardinality(String),- value Float64,- recorded_at DateTime,- server_name LowCardinality(String) DEFAULT '',-- INDEX idx_server_name server_name TYPE bloom_filter(0.01) GRANULARITY 4-) ENGINE = MergeTree()-PARTITION BY toYYYYMMDD(recorded_at)-ORDER BY (project_id, name, recorded_at)-SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0003_create_tasks.up.sql b/backend/app/migrations/ch/0003_create_tasks.up.sqlnew file mode 100644index 00000000..2c22626e--- /dev/null+++ b/backend/app/migrations/ch/0003_create_tasks.up.sql@@ -0,0 +1,18 @@+CREATE TABLE IF NOT EXISTS tasks+(+ `id` UUID,+ `project_id` UUID,+ `task_name` LowCardinality(String),+ `duration` Int64,+ `recorded_at` DateTime,+ `client_ip` String,+ `scope` String DEFAULT '{}',+ `app_version` LowCardinality(String) DEFAULT '',+ `server_name` LowCardinality(String) DEFAULT '',+ INDEX idx_task_name task_name TYPE bloom_filter(0.01) GRANULARITY 4,+ INDEX idx_id id TYPE bloom_filter(0.001) GRANULARITY 1+)+ENGINE = MergeTree+PARTITION BY toYYYYMMDD(recorded_at)+ORDER BY (project_id, recorded_at, task_name)+SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0003_created_exception_stack_traces.up.sql b/backend/app/migrations/ch/0003_created_exception_stack_traces.up.sqldeleted file mode 100644index 4390804b..00000000--- a/backend/app/migrations/ch/0003_created_exception_stack_traces.up.sql+++ /dev/null@@ -1,22 +0,0 @@-CREATE TABLE IF NOT EXISTS exception_stack_traces (- id String DEFAULT '',- project_id LowCardinality(String) DEFAULT '00000000-0000-0000-0000-000000000001',- transaction_id Nullable(String),- transaction_type LowCardinality(String) DEFAULT 'endpoint',- exception_hash String,- stack_trace String,- recorded_at DateTime,- scope String DEFAULT '{}',- app_version LowCardinality(String) DEFAULT '',- server_name LowCardinality(String) DEFAULT '',- is_message UInt8 DEFAULT 0,-- INDEX idx_exception_hash exception_hash TYPE bloom_filter(0.01) GRANULARITY 4,- INDEX idx_transaction_id transaction_id TYPE bloom_filter(0.01) GRANULARITY 4,- INDEX idx_is_message is_message TYPE set(2) GRANULARITY 1,- INDEX idx_id id TYPE bloom_filter(0.001) GRANULARITY 1,- INDEX idx_stack_trace stack_trace TYPE tokenbf_v1(10240, 3, 0) GRANULARITY 4-) ENGINE = MergeTree()-PARTITION BY toYYYYMMDD(recorded_at)-ORDER BY (project_id, recorded_at, exception_hash)-SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0004_create_segments.up.sql b/backend/app/migrations/ch/0004_create_segments.up.sqlnew file mode 100644index 00000000..1be014df--- /dev/null+++ b/backend/app/migrations/ch/0004_create_segments.up.sql@@ -0,0 +1,15 @@+CREATE TABLE IF NOT EXISTS segments+(+ `id` UUID,+ `transaction_id` UUID,+ `project_id` UUID,+ `name` LowCardinality(String),+ `start_time` DateTime64(6),+ `duration` Int64,+ `recorded_at` DateTime,+ INDEX idx_transaction_id transaction_id TYPE bloom_filter(0.001) GRANULARITY 1+)+ENGINE = MergeTree+PARTITION BY toYYYYMMDD(recorded_at)+ORDER BY (project_id, transaction_id, start_time)+SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0004_created_projects.up.sql b/backend/app/migrations/ch/0004_created_projects.up.sqldeleted file mode 100644index 9938831a..00000000--- a/backend/app/migrations/ch/0004_created_projects.up.sql+++ /dev/null@@ -1,12 +0,0 @@-CREATE TABLE IF NOT EXISTS projects (- id String,- name String,- token String,- framework LowCardinality(String) DEFAULT 'custom',- created_at DateTime DEFAULT now(),-- INDEX idx_token token TYPE bloom_filter(0.001) GRANULARITY 1,- INDEX idx_id id TYPE bloom_filter(0.001) GRANULARITY 1-) ENGINE = MergeTree()-ORDER BY (id)-SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0005_create_exception_stack_traces.up.sql b/backend/app/migrations/ch/0005_create_exception_stack_traces.up.sqlnew file mode 100644index 00000000..572bedfc--- /dev/null+++ b/backend/app/migrations/ch/0005_create_exception_stack_traces.up.sql@@ -0,0 +1,23 @@+CREATE TABLE IF NOT EXISTS exception_stack_traces+(+ `id` UUID,+ `project_id` UUID,+ `transaction_id` Nullable(UUID),+ `transaction_type` LowCardinality(String) DEFAULT 'endpoint',+ `exception_hash` String,+ `stack_trace` String,+ `recorded_at` DateTime,+ `scope` String DEFAULT '{}',+ `app_version` LowCardinality(String) DEFAULT '',+ `server_name` LowCardinality(String) DEFAULT '',+ `is_message` UInt8 DEFAULT 0,+ INDEX idx_exception_hash exception_hash TYPE bloom_filter(0.01) GRANULARITY 4,+ INDEX idx_transaction_id transaction_id TYPE bloom_filter(0.01) GRANULARITY 4,+ INDEX idx_is_message is_message TYPE set(2) GRANULARITY 1,+ INDEX idx_id id TYPE bloom_filter(0.001) GRANULARITY 1,+ INDEX idx_stack_trace stack_trace TYPE tokenbf_v1(10240, 3, 0) GRANULARITY 4+)+ENGINE = MergeTree+PARTITION BY toYYYYMMDD(recorded_at)+ORDER BY (project_id, recorded_at, exception_hash)+SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0006_add_project_id_to_transactions.up.sql b/backend/app/migrations/ch/0006_add_project_id_to_transactions.up.sqldeleted file mode 100644index 275ab33a..00000000--- a/backend/app/migrations/ch/0006_add_project_id_to_transactions.up.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE transactions ADD COLUMN IF NOT EXISTS project_id String DEFAULT '00000000-0000-0000-0000-000000000001'diff --git a/backend/app/migrations/ch/0006_create_metric_records.up.sql b/backend/app/migrations/ch/0006_create_metric_records.up.sqlnew file mode 100644index 00000000..304a121d--- /dev/null+++ b/backend/app/migrations/ch/0006_create_metric_records.up.sql@@ -0,0 +1,13 @@+CREATE TABLE IF NOT EXISTS metric_records+(+ `project_id` UUID,+ `name` LowCardinality(String),+ `value` Float64,+ `recorded_at` DateTime,+ `server_name` LowCardinality(String) DEFAULT '',+ INDEX idx_server_name server_name TYPE bloom_filter(0.01) GRANULARITY 4+)+ENGINE = MergeTree+PARTITION BY toYYYYMMDD(recorded_at)+ORDER BY (project_id, name, recorded_at)+SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0007_add_project_id_to_metric_records.up.sql b/backend/app/migrations/ch/0007_add_project_id_to_metric_records.up.sqldeleted file mode 100644index bd67ff27..00000000--- a/backend/app/migrations/ch/0007_add_project_id_to_metric_records.up.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE metric_records ADD COLUMN IF NOT EXISTS project_id String DEFAULT '00000000-0000-0000-0000-000000000001'diff --git a/backend/app/migrations/ch/0007_create_archived_exceptions.up.sql b/backend/app/migrations/ch/0007_create_archived_exceptions.up.sqlnew file mode 100644index 00000000..56357d04--- /dev/null+++ b/backend/app/migrations/ch/0007_create_archived_exceptions.up.sql@@ -0,0 +1,9 @@+CREATE TABLE IF NOT EXISTS archived_exceptions+(+ `project_id` UUID,+ `exception_hash` String,+ `archived_at` DateTime DEFAULT now()+)+ENGINE = ReplacingMergeTree(archived_at)+ORDER BY (project_id, exception_hash)+SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0008_add_project_id_to_exception_stack_traces.up.sql b/backend/app/migrations/ch/0008_add_project_id_to_exception_stack_traces.up.sqldeleted file mode 100644index d8a9ff14..00000000--- a/backend/app/migrations/ch/0008_add_project_id_to_exception_stack_traces.up.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE exception_stack_traces ADD COLUMN IF NOT EXISTS project_id String DEFAULT '00000000-0000-0000-0000-000000000001'diff --git a/backend/app/migrations/ch/0008_create_transactions_legacy.up.sql b/backend/app/migrations/ch/0008_create_transactions_legacy.up.sqlnew file mode 100644index 00000000..ee1979db--- /dev/null+++ b/backend/app/migrations/ch/0008_create_transactions_legacy.up.sql@@ -0,0 +1,18 @@+CREATE TABLE IF NOT EXISTS transactions+(+ `id` String,+ `endpoint` String,+ `duration` Int64,+ `recorded_at` DateTime,+ `status_code` Int32,+ `body_size` Int32,+ `client_ip` String,+ `project_id` String DEFAULT '00000000-0000-0000-0000-000000000001',+ `scope` String DEFAULT '{}',+ `app_version` String DEFAULT '',+ `server_name` String DEFAULT ''+)+ENGINE = MergeTree+PARTITION BY toYYYYMM(recorded_at)+ORDER BY (recorded_at, endpoint)+SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0009_add_framework_to_projects.up.sql b/backend/app/migrations/ch/0009_add_framework_to_projects.up.sqldeleted file mode 100644index b9704214..00000000--- a/backend/app/migrations/ch/0009_add_framework_to_projects.up.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE projects ADD COLUMN IF NOT EXISTS framework String DEFAULT 'custom';diff --git a/backend/app/migrations/ch/0005_insert_default_project.up.sql b/backend/app/migrations/ch/0009_insert_default_project.up.sqlsimilarity index 100%rename from backend/app/migrations/ch/0005_insert_default_project.up.sqlrename to backend/app/migrations/ch/0009_insert_default_project.up.sqldiff --git a/backend/app/migrations/ch/0010_add_scope_to_exception_stack_traces.down.sql b/backend/app/migrations/ch/0010_add_scope_to_exception_stack_traces.down.sqldeleted file mode 100644index 1d157be2..00000000--- a/backend/app/migrations/ch/0010_add_scope_to_exception_stack_traces.down.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE exception_stack_traces DROP COLUMN IF EXISTS scope;diff --git a/backend/app/migrations/ch/0010_add_scope_to_exception_stack_traces.up.sql b/backend/app/migrations/ch/0010_add_scope_to_exception_stack_traces.up.sqldeleted file mode 100644index f627e7da..00000000--- a/backend/app/migrations/ch/0010_add_scope_to_exception_stack_traces.up.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE exception_stack_traces ADD COLUMN IF NOT EXISTS scope String DEFAULT '{}';diff --git a/backend/app/migrations/ch/0011_add_scope_to_transactions.down.sql b/backend/app/migrations/ch/0011_add_scope_to_transactions.down.sqldeleted file mode 100644index 6f3110dd..00000000--- a/backend/app/migrations/ch/0011_add_scope_to_transactions.down.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE transactions DROP COLUMN IF EXISTS scope;diff --git a/backend/app/migrations/ch/0011_add_scope_to_transactions.up.sql b/backend/app/migrations/ch/0011_add_scope_to_transactions.up.sqldeleted file mode 100644index 407f02ad..00000000--- a/backend/app/migrations/ch/0011_add_scope_to_transactions.up.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE transactions ADD COLUMN IF NOT EXISTS scope String DEFAULT '{}';diff --git a/backend/app/migrations/ch/0012_add_archived_exceptions.down.sql b/backend/app/migrations/ch/0012_add_archived_exceptions.down.sqldeleted file mode 100644index 84c948ba..00000000--- a/backend/app/migrations/ch/0012_add_archived_exceptions.down.sql+++ /dev/null@@ -1 +0,0 @@-DROP TABLE IF EXISTS archived_exceptions;diff --git a/backend/app/migrations/ch/0012_add_archived_exceptions.up.sql b/backend/app/migrations/ch/0012_add_archived_exceptions.up.sqldeleted file mode 100644index 529049f8..00000000--- a/backend/app/migrations/ch/0012_add_archived_exceptions.up.sql+++ /dev/null@@ -1,6 +0,0 @@-CREATE TABLE IF NOT EXISTS archived_exceptions (- project_id String,- exception_hash String,- archived_at DateTime DEFAULT now()-) ENGINE = ReplacingMergeTree(archived_at)-ORDER BY (project_id, exception_hash);diff --git a/backend/app/migrations/ch/0013_add_app_version_to_transactions.up.sql b/backend/app/migrations/ch/0013_add_app_version_to_transactions.up.sqldeleted file mode 100644index b55b2086..00000000--- a/backend/app/migrations/ch/0013_add_app_version_to_transactions.up.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE transactions ADD COLUMN IF NOT EXISTS app_version String DEFAULT '';diff --git a/backend/app/migrations/ch/0014_add_server_name_to_transactions.up.sql b/backend/app/migrations/ch/0014_add_server_name_to_transactions.up.sqldeleted file mode 100644index e743b316..00000000--- a/backend/app/migrations/ch/0014_add_server_name_to_transactions.up.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE transactions ADD COLUMN IF NOT EXISTS server_name String DEFAULT '';diff --git a/backend/app/migrations/ch/0015_add_app_version_to_exceptions.up.sql b/backend/app/migrations/ch/0015_add_app_version_to_exceptions.up.sqldeleted file mode 100644index ab9c577d..00000000--- a/backend/app/migrations/ch/0015_add_app_version_to_exceptions.up.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE exception_stack_traces ADD COLUMN IF NOT EXISTS app_version String DEFAULT '';diff --git a/backend/app/migrations/ch/0016_add_server_name_to_exceptions.up.sql b/backend/app/migrations/ch/0016_add_server_name_to_exceptions.up.sqldeleted file mode 100644index ea2aea42..00000000--- a/backend/app/migrations/ch/0016_add_server_name_to_exceptions.up.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE exception_stack_traces ADD COLUMN IF NOT EXISTS server_name String DEFAULT '';diff --git a/backend/app/migrations/ch/0017_add_is_message_to_exceptions.up.sql b/backend/app/migrations/ch/0017_add_is_message_to_exceptions.up.sqldeleted file mode 100644index 4f628fe9..00000000--- a/backend/app/migrations/ch/0017_add_is_message_to_exceptions.up.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE exception_stack_traces ADD COLUMN IF NOT EXISTS is_message UInt8 DEFAULT 0;diff --git a/backend/app/migrations/ch/0019_create_segments.up.sql b/backend/app/migrations/ch/0019_create_segments.up.sqldeleted file mode 100644index 78d12250..00000000--- a/backend/app/migrations/ch/0019_create_segments.up.sql+++ /dev/null@@ -1,14 +0,0 @@-CREATE TABLE IF NOT EXISTS segments (- id String,- transaction_id String,- project_id LowCardinality(String),- name LowCardinality(String),- start_time DateTime64(6),- duration Int64,- recorded_at DateTime,-- INDEX idx_transaction_id transaction_id TYPE bloom_filter(0.001) GRANULARITY 1-) ENGINE = MergeTree()-PARTITION BY toYYYYMMDD(recorded_at)-ORDER BY (project_id, transaction_id, start_time)-SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0020_create_endpoints.up.sql b/backend/app/migrations/ch/0020_create_endpoints.up.sqldeleted file mode 100644index d55f6cf4..00000000--- a/backend/app/migrations/ch/0020_create_endpoints.up.sql+++ /dev/null@@ -1,20 +0,0 @@-CREATE TABLE IF NOT EXISTS endpoints (- id String,- project_id LowCardinality(String),- endpoint LowCardinality(String),- duration Int64,- recorded_at DateTime,- status_code Int16,- body_size Int32,- client_ip String,- scope String DEFAULT '{}',- app_version LowCardinality(String) DEFAULT '',- server_name LowCardinality(String) DEFAULT '',-- INDEX idx_endpoint endpoint TYPE bloom_filter(0.01) GRANULARITY 4,- INDEX idx_status_code status_code TYPE set(100) GRANULARITY 4,- INDEX idx_id id TYPE bloom_filter(0.001) GRANULARITY 1-) ENGINE = MergeTree()-PARTITION BY toYYYYMMDD(recorded_at)-ORDER BY (project_id, recorded_at, endpoint)-SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0021_create_tasks.up.sql b/backend/app/migrations/ch/0021_create_tasks.up.sqldeleted file mode 100644index 8056e640..00000000--- a/backend/app/migrations/ch/0021_create_tasks.up.sql+++ /dev/null@@ -1,17 +0,0 @@-CREATE TABLE IF NOT EXISTS tasks (- id String,- project_id LowCardinality(String),- task_name LowCardinality(String),- duration Int64,- recorded_at DateTime,- client_ip String,- scope String DEFAULT '{}',- app_version LowCardinality(String) DEFAULT '',- server_name LowCardinality(String) DEFAULT '',-- INDEX idx_task_name task_name TYPE bloom_filter(0.01) GRANULARITY 4,- INDEX idx_id id TYPE bloom_filter(0.001) GRANULARITY 1-) ENGINE = MergeTree()-PARTITION BY toYYYYMMDD(recorded_at)-ORDER BY (project_id, recorded_at, task_name)-SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0022_add_transaction_type_to_exceptions.up.sql b/backend/app/migrations/ch/0022_add_transaction_type_to_exceptions.up.sqldeleted file mode 100644index 3698487b..00000000--- a/backend/app/migrations/ch/0022_add_transaction_type_to_exceptions.up.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE exception_stack_traces ADD COLUMN IF NOT EXISTS transaction_type String DEFAULT 'endpoint';diff --git a/backend/app/migrations/ch/0023_migrate_transactions_to_endpoints.up.sql b/backend/app/migrations/ch/0023_migrate_transactions_to_endpoints.up.sqldeleted file mode 100644index de2b40a4..00000000--- a/backend/app/migrations/ch/0023_migrate_transactions_to_endpoints.up.sql+++ /dev/null@@ -1 +0,0 @@-INSERT INTO endpoints SELECT * FROM transactions;diff --git a/backend/app/models/clientmodels/clientmodels.model.go b/backend/app/models/clientmodels/clientmodels.model.goindex 9cee2cc9..fb402dae 100644--- a/backend/app/models/clientmodels/clientmodels.model.go+++ b/backend/app/models/clientmodels/clientmodels.model.go@@ -3,6 +3,8 @@ package clientmodelsimport ("backend/app/models""time"++ "github.com/google/uuid")type ClientExceptionStackTrace struct {@@ -19,9 +21,17 @@ func (c *ClientExceptionStackTrace) ToExceptionStackTrace(exceptionHash, appVersif c.IsTask {transactionType = "task"}++ var transactionId *uuid.UUID+ if c.TransactionId != nil {+ if parsed, err := uuid.Parse(*c.TransactionId); err == nil {+ transactionId = &parsed+ }+ }+return models.ExceptionStackTrace{ExceptionHash: exceptionHash,- TransactionId: c.TransactionId,+ TransactionId: transactionId,TransactionType: transactionType,StackTrace: c.StackTrace,RecordedAt: c.RecordedAt,@@ -60,9 +70,17 @@ type ClientTransaction struct {IsTask bool `json:"isTask"`}+// ParsedId returns the transaction ID as uuid.UUID+func (c *ClientTransaction) ParsedId() uuid.UUID {+ if parsed, err := uuid.Parse(c.Id); err == nil {+ return parsed+ }+ return uuid.New()+}+func (c *ClientTransaction) ToEndpoint(appVersion, serverName string) models.Endpoint {return models.Endpoint{- Id: c.Id,+ Id: c.ParsedId(),Endpoint: c.Endpoint,Duration: c.Duration,RecordedAt: c.RecordedAt,@@ -77,7 +95,7 @@ func (c *ClientTransaction) ToEndpoint(appVersion, serverName string) models.Endfunc (c *ClientTransaction) ToTask(appVersion, serverName string) models.Task {return models.Task{- Id: c.Id,+ Id: c.ParsedId(),TaskName: c.Endpoint, // Endpoint field is used as task nameDuration: c.Duration,RecordedAt: c.RecordedAt,@@ -95,9 +113,17 @@ type ClientSegment struct {Duration time.Duration `json:"duration"`}-func (c *ClientSegment) ToSegment(transactionId string) models.Segment {+// ParsedId returns the segment ID as uuid.UUID+func (c *ClientSegment) ParsedId() uuid.UUID {+ if parsed, err := uuid.Parse(c.Id); err == nil {+ return parsed+ }+ return uuid.New()+}++func (c *ClientSegment) ToSegment(transactionId uuid.UUID) models.Segment {return models.Segment{- Id: c.Id,+ Id: c.ParsedId(),TransactionId: transactionId,Name: c.Name,StartTime: c.StartTime,diff --git a/backend/app/models/endpoint.model.go b/backend/app/models/endpoint.model.goindex d2663e6b..cf942648 100644--- a/backend/app/models/endpoint.model.go+++ b/backend/app/models/endpoint.model.go@@ -1,10 +1,14 @@package models-import "time"+import (+ "time"++ "github.com/google/uuid"+)type Endpoint struct {- Id string `json:"id" ch:"id"`- ProjectId string `json:"projectId" ch:"project_id"`+ 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 itEndpoint string `json:"endpoint" ch:"endpoint"`Duration time.Duration `json:"duration" ch:"duration"`diff --git a/backend/app/models/exception_stack_trace.model.go b/backend/app/models/exception_stack_trace.model.goindex 73a3582b..ca895ccf 100644--- a/backend/app/models/exception_stack_trace.model.go+++ b/backend/app/models/exception_stack_trace.model.go@@ -1,11 +1,15 @@package models-import "time"+import (+ "time"++ "github.com/google/uuid"+)type ExceptionStackTrace struct {- Id string `json:"id" ch:"id"`- ProjectId string `json:"projectId" ch:"project_id"`- TransactionId *string `json:"transactionId" ch:"transaction_id"`+ Id uuid.UUID `json:"id" ch:"id"`+ ProjectId uuid.UUID `json:"projectId" ch:"project_id"`+ TransactionId *uuid.UUID `json:"transactionId" ch:"transaction_id"`TransactionType string `json:"transactionType" ch:"transaction_type"` // "endpoint" or "task"ExceptionHash string `json:"exceptionHash" ch:"exception_hash"`StackTrace string `json:"stackTrace" ch:"stack_trace"`diff --git a/backend/app/models/metric_record.model.go b/backend/app/models/metric_record.model.goindex 22109f24..7e8ca87e 100644--- a/backend/app/models/metric_record.model.go+++ b/backend/app/models/metric_record.model.go@@ -1,9 +1,13 @@package models-import "time"+import (+ "time"++ "github.com/google/uuid"+)type MetricRecord struct {- ProjectId string `json:"projectId" ch:"project_id"`+ ProjectId uuid.UUID `json:"projectId" ch:"project_id"`Name string `json:"name" ch:"name"`Value float64 `json:"value" ch:"value"`RecordedAt time.Time `json:"recordedAt" ch:"recorded_at"`diff --git a/backend/app/models/project.model.go b/backend/app/models/project.model.goindex 87c8e30a..94c196c0 100644--- a/backend/app/models/project.model.go+++ b/backend/app/models/project.model.go@@ -1,9 +1,13 @@package models-import "time"+import (+ "time"++ "github.com/google/uuid"+)type Project struct {- Id string `json:"id" ch:"id"`+ Id uuid.UUID `json:"id" ch:"id"`Name string `json:"name" ch:"name"`Token string `json:"token" ch:"token"`Framework string `json:"framework" ch:"framework"`@@ -12,7 +16,7 @@ type Project struct {// ProjectResponse omits the token for security in listing endpointstype ProjectResponse struct {- Id string `json:"id"`+ Id uuid.UUID `json:"id"`Name string `json:"name"`Framework string `json:"framework"`CreatedAt time.Time `json:"createdAt"`@@ -20,7 +24,7 @@ type ProjectResponse struct {// ProjectWithToken includes token - used when creating or viewing connection detailstype ProjectWithToken struct {- Id string `json:"id"`+ Id uuid.UUID `json:"id"`Name string `json:"name"`Token string `json:"token"`Framework string `json:"framework"`diff --git a/backend/app/models/segment.model.go b/backend/app/models/segment.model.goindex 006c3299..2213987c 100644--- a/backend/app/models/segment.model.go+++ b/backend/app/models/segment.model.go@@ -1,11 +1,15 @@package models-import "time"+import (+ "time"++ "github.com/google/uuid"+)type Segment struct {- Id string `json:"id" ch:"id"`- TransactionId string `json:"transactionId" ch:"transaction_id"`- ProjectId string `json:"projectId" ch:"project_id"`+ Id uuid.UUID `json:"id" ch:"id"`+ TransactionId uuid.UUID `json:"transactionId" ch:"transaction_id"`+ ProjectId uuid.UUID `json:"projectId" ch:"project_id"`Name string `json:"name" ch:"name"`StartTime time.Time `json:"startTime" ch:"start_time"`Duration time.Duration `json:"duration" ch:"duration"`diff --git a/backend/app/models/task.model.go b/backend/app/models/task.model.goindex ec6a79dd..855d1c7d 100644--- a/backend/app/models/task.model.go+++ b/backend/app/models/task.model.go@@ -1,10 +1,14 @@package models-import "time"+import (+ "time"++ "github.com/google/uuid"+)type Task struct {- Id string `json:"id" ch:"id"`- ProjectId string `json:"projectId" ch:"project_id"`+ 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"`diff --git a/backend/app/repositories/endpoint.repository.go b/backend/app/repositories/endpoint.repository.goindex d7c548ce..7a3a8734 100644--- a/backend/app/repositories/endpoint.repository.go+++ b/backend/app/repositories/endpoint.repository.go@@ -8,6 +8,7 @@ import ("time""github.com/ClickHouse/clickhouse-go/v2"+ "github.com/google/uuid")type endpointRepository struct{}@@ -31,13 +32,13 @@ func (e *endpointRepository) InsertAsync(ctx context.Context, lines []models.Endreturn batch.Send()}-func (e *endpointRepository) CountBetween(ctx context.Context, projectId string, start, end time.Time) (int64, error) {+func (e *endpointRepository) CountBetween(ctx context.Context, projectId uuid.UUID, start, end time.Time) (int64, error) {var count uint64err := (*chdb.Conn).QueryRow(ctx, "SELECT count() FROM endpoints WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?", projectId, start, end).Scan(&count)return int64(count), err}-func (e *endpointRepository) FindAll(ctx context.Context, projectId string, fromDate, toDate time.Time, page, pageSize int, orderBy string) ([]models.Endpoint, int64, error) {+func (e *endpointRepository) FindAll(ctx context.Context, projectId uuid.UUID, fromDate, toDate time.Time, page, pageSize int, orderBy string) ([]models.Endpoint, int64, error) {var count uint64err := (*chdb.Conn).QueryRow(ctx, "SELECT count() FROM endpoints WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?", projectId, fromDate, toDate).Scan(&count)if err != nil {@@ -83,7 +84,7 @@ func (e *endpointRepository) FindAll(ctx context.Context, projectId string, fromreturn endpoints, int64(count), nil}-func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectId string, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string) ([]models.EndpointStats, int64, error) {+func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectId uuid.UUID, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string) ([]models.EndpointStats, int64, error) {// Count unique endpointsvar count uint64err := (*chdb.Conn).QueryRow(ctx, "SELECT uniq(endpoint) FROM endpoints WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?", projectId, fromDate, toDate).Scan(&count)@@ -149,7 +150,7 @@ func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectIreturn stats, int64(count), nil}-func (e *endpointRepository) FindByEndpoint(ctx context.Context, projectId string, endpoint string, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string) ([]models.Endpoint, int64, error) {+func (e *endpointRepository) FindByEndpoint(ctx context.Context, projectId uuid.UUID, endpoint string, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string) ([]models.Endpoint, int64, error) {var count uint64err := (*chdb.Conn).QueryRow(ctx, "SELECT count() FROM endpoints WHERE project_id = ? AND endpoint = ? AND recorded_at >= ? AND recorded_at <= ?", projectId, endpoint, fromDate, toDate).Scan(&count)if err != nil {@@ -202,7 +203,7 @@ func (e *endpointRepository) FindByEndpoint(ctx context.Context, projectId strin}// FindById returns a single endpoint by ID-func (e *endpointRepository) FindById(ctx context.Context, projectId, endpointId string) (*models.Endpoint, error) {+func (e *endpointRepository) FindById(ctx context.Context, projectId, endpointId uuid.UUID) (*models.Endpoint, error) {query := `SELECT id, project_id, endpoint, duration, recorded_at, status_code, body_size, client_ip, scope, app_version, server_nameFROM endpointsWHERE project_id = ? AND id = ?@@ -230,7 +231,7 @@ func (e *endpointRepository) FindById(ctx context.Context, projectId, endpointId}// CountByHour returns endpoint counts grouped by hour-func (e *endpointRepository) CountByHour(ctx context.Context, projectId string, start, end time.Time) ([]models.TimeSeriesPoint, error) {+func (e *endpointRepository) CountByHour(ctx context.Context, projectId uuid.UUID, start, end time.Time) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfHour(recorded_at) as hour,toFloat64(count()) as count@@ -258,7 +259,7 @@ func (e *endpointRepository) CountByHour(ctx context.Context, projectId string,}// AvgDurationByHour returns average response time in ms grouped by hour-func (e *endpointRepository) AvgDurationByHour(ctx context.Context, projectId string, start, end time.Time) ([]models.TimeSeriesPoint, error) {+func (e *endpointRepository) AvgDurationByHour(ctx context.Context, projectId uuid.UUID, start, end time.Time) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfHour(recorded_at) as hour,avg(duration) / 1000000 as avg_duration_ms@@ -286,7 +287,7 @@ func (e *endpointRepository) AvgDurationByHour(ctx context.Context, projectId st}// ErrorRateByHour returns error rate (percentage) grouped by hour-func (e *endpointRepository) ErrorRateByHour(ctx context.Context, projectId string, start, end time.Time) ([]models.TimeSeriesPoint, error) {+func (e *endpointRepository) ErrorRateByHour(ctx context.Context, projectId uuid.UUID, start, end time.Time) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfHour(recorded_at) as hour,countIf(status_code >= 400) * 100.0 / count() as error_rate@@ -314,7 +315,7 @@ func (e *endpointRepository) ErrorRateByHour(ctx context.Context, projectId stri}// CountByInterval returns endpoint counts grouped by configurable interval in minutes-func (e *endpointRepository) CountByInterval(ctx context.Context, projectId string, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {+func (e *endpointRepository) CountByInterval(ctx context.Context, projectId uuid.UUID, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfInterval(recorded_at, INTERVAL ? MINUTE) as bucket,toFloat64(count()) as count@@ -342,7 +343,7 @@ func (e *endpointRepository) CountByInterval(ctx context.Context, projectId stri}// AvgDurationByInterval returns average response time in ms grouped by configurable interval-func (e *endpointRepository) AvgDurationByInterval(ctx context.Context, projectId string, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {+func (e *endpointRepository) AvgDurationByInterval(ctx context.Context, projectId uuid.UUID, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfInterval(recorded_at, INTERVAL ? MINUTE) as bucket,avg(duration) / 1000000 as avg_duration_ms@@ -370,7 +371,7 @@ func (e *endpointRepository) AvgDurationByInterval(ctx context.Context, projectI}// ErrorRateByInterval returns error rate (percentage) grouped by configurable interval-func (e *endpointRepository) ErrorRateByInterval(ctx context.Context, projectId string, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {+func (e *endpointRepository) ErrorRateByInterval(ctx context.Context, projectId uuid.UUID, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfInterval(recorded_at, INTERVAL ? MINUTE) as bucket,countIf(status_code >= 400) * 100.0 / count() as error_rate@@ -399,7 +400,7 @@ func (e *endpointRepository) ErrorRateByInterval(ctx context.Context, projectId// FindWorstEndpoints returns endpoints ordered by impact score (count * variance)// Higher call volume + larger variance = higher impact-func (e *endpointRepository) FindWorstEndpoints(ctx context.Context, projectId string, start, end time.Time, limit int) ([]models.EndpointStats, error) {+func (e *endpointRepository) FindWorstEndpoints(ctx context.Context, projectId uuid.UUID, start, end time.Time, limit int) ([]models.EndpointStats, error) {query := `SELECTendpoint,count() as count,@@ -436,7 +437,7 @@ func (e *endpointRepository) FindWorstEndpoints(ctx context.Context, projectId s}// GetEndpointStats returns aggregate statistics for a specific endpoint-func (e *endpointRepository) GetEndpointStats(ctx context.Context, projectId, endpoint string, start, end time.Time) (*models.EndpointDetailStats, error) {+func (e *endpointRepository) GetEndpointStats(ctx context.Context, projectId uuid.UUID, endpoint string, start, end time.Time) (*models.EndpointDetailStats, error) {// Calculate time range duration for throughput calculationdurationMinutes := end.Sub(start).Minutes()if durationMinutes < 1 {diff --git a/backend/app/repositories/exception_stack_trace.repository.go b/backend/app/repositories/exception_stack_trace.repository.goindex a58957cb..02556859 100644--- a/backend/app/repositories/exception_stack_trace.repository.go+++ b/backend/app/repositories/exception_stack_trace.repository.go@@ -10,6 +10,7 @@ import ("time""github.com/ClickHouse/clickhouse-go/v2"+ "github.com/google/uuid")var ErrExceptionNotFound = errors.New("exception not found")@@ -43,13 +44,13 @@ func (e *exceptionStackTraceRepository) InsertAsync(ctx context.Context, lines [return batch.Send()}-func (e *exceptionStackTraceRepository) CountBetween(ctx context.Context, projectId string, start, end time.Time) (int64, error) {+func (e *exceptionStackTraceRepository) CountBetween(ctx context.Context, projectId uuid.UUID, start, end time.Time) (int64, error) {var count uint64err := (*chdb.Conn).QueryRow(ctx, "SELECT count() FROM exception_stack_traces WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?", projectId, start, end).Scan(&count)return int64(count), err}-func (e *exceptionStackTraceRepository) FindGrouped(ctx context.Context, projectId string, fromDate, toDate time.Time, page, pageSize int, orderBy string, search string, searchType string, includeArchived bool) ([]models.ExceptionGroup, int64, error) {+func (e *exceptionStackTraceRepository) FindGrouped(ctx context.Context, projectId uuid.UUID, fromDate, toDate time.Time, page, pageSize int, orderBy string, search string, searchType string, includeArchived bool) ([]models.ExceptionGroup, int64, error) {offset := (page - 1) * pageSize// Parse sort direction from orderBy (e.g., "last_seen_asc" -> "last_seen", "ASC")@@ -145,7 +146,7 @@ func (e *exceptionStackTraceRepository) FindGrouped(ctx context.Context, projectreturn groups, int64(count), nil}-func (e *exceptionStackTraceRepository) FindByHash(ctx context.Context, projectId string, exceptionHash string, page, pageSize int) (*models.ExceptionGroup, []models.ExceptionStackTrace, int64, error) {+func (e *exceptionStackTraceRepository) FindByHash(ctx context.Context, projectId uuid.UUID, exceptionHash string, page, pageSize int) (*models.ExceptionGroup, []models.ExceptionStackTrace, int64, error) {offset := (page - 1) * pageSize// Get grouped info@@ -189,7 +190,7 @@ func (e *exceptionStackTraceRepository) FindByHash(ctx context.Context, projectI}// CountByHour returns exception counts grouped by hour-func (e *exceptionStackTraceRepository) CountByHour(ctx context.Context, projectId string, start, end time.Time) ([]models.TimeSeriesPoint, error) {+func (e *exceptionStackTraceRepository) CountByHour(ctx context.Context, projectId uuid.UUID, start, end time.Time) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfHour(recorded_at) as hour,toFloat64(count()) as count@@ -217,7 +218,7 @@ func (e *exceptionStackTraceRepository) CountByHour(ctx context.Context, project}// CountByInterval returns exception counts grouped by configurable interval in minutes-func (e *exceptionStackTraceRepository) CountByInterval(ctx context.Context, projectId string, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {+func (e *exceptionStackTraceRepository) CountByInterval(ctx context.Context, projectId uuid.UUID, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfInterval(recorded_at, INTERVAL ? MINUTE) as bucket,toFloat64(count()) as count@@ -245,7 +246,7 @@ func (e *exceptionStackTraceRepository) CountByInterval(ctx context.Context, pro}// GetHourlyTrendForHashes returns hourly counts for specific exception hashes-func (e *exceptionStackTraceRepository) GetHourlyTrendForHashes(ctx context.Context, projectId string, hashes []string, start, end time.Time) (map[string][]models.ExceptionTrendPoint, error) {+func (e *exceptionStackTraceRepository) GetHourlyTrendForHashes(ctx context.Context, projectId uuid.UUID, hashes []string, start, end time.Time) (map[string][]models.ExceptionTrendPoint, error) {if len(hashes) == 0 {return make(map[string][]models.ExceptionTrendPoint), nil}@@ -279,7 +280,7 @@ func (e *exceptionStackTraceRepository) GetHourlyTrendForHashes(ctx context.Cont}// ArchiveByHashes archives exceptions by their hashes-func (e *exceptionStackTraceRepository) ArchiveByHashes(ctx context.Context, projectId string, hashes []string) error {+func (e *exceptionStackTraceRepository) ArchiveByHashes(ctx context.Context, projectId uuid.UUID, hashes []string) error {if len(hashes) == 0 {return nil}@@ -299,7 +300,7 @@ func (e *exceptionStackTraceRepository) ArchiveByHashes(ctx context.Context, pro}// UnarchiveByHashes removes exceptions from the archive-func (e *exceptionStackTraceRepository) UnarchiveByHashes(ctx context.Context, projectId string, hashes []string) error {+func (e *exceptionStackTraceRepository) UnarchiveByHashes(ctx context.Context, projectId uuid.UUID, hashes []string) error {if len(hashes) == 0 {return nil}@@ -310,7 +311,7 @@ func (e *exceptionStackTraceRepository) UnarchiveByHashes(ctx context.Context, p}// IsArchived checks if a specific exception hash is archived-func (e *exceptionStackTraceRepository) IsArchived(ctx context.Context, projectId string, hash string) (bool, error) {+func (e *exceptionStackTraceRepository) IsArchived(ctx context.Context, projectId uuid.UUID, hash string) (bool, error) {var count uint64err := (*chdb.Conn).QueryRow(ctx,"SELECT count() FROM archived_exceptions FINAL WHERE project_id = ? AND exception_hash = ?",@@ -321,7 +322,7 @@ func (e *exceptionStackTraceRepository) IsArchived(ctx context.Context, projectIreturn count > 0, nil}-func (e *exceptionStackTraceRepository) FindExceptionByTransactionId(ctx context.Context, projectId string, transactionId string) (*models.ExceptionStackTrace, error) {+func (e *exceptionStackTraceRepository) FindExceptionByTransactionId(ctx context.Context, projectId uuid.UUID, transactionId uuid.UUID) (*models.ExceptionStackTrace, error) {var est models.ExceptionStackTracevar scopeJSON stringvar isMessage uint8@@ -352,7 +353,7 @@ func (e *exceptionStackTraceRepository) FindExceptionByTransactionId(ctx context}// FindAllByTransactionId returns all exceptions and messages associated with a specific transaction-func (e *exceptionStackTraceRepository) FindAllByTransactionId(ctx context.Context, projectId string, transactionId string) ([]models.ExceptionStackTrace, error) {+func (e *exceptionStackTraceRepository) FindAllByTransactionId(ctx context.Context, projectId uuid.UUID, transactionId uuid.UUID) ([]models.ExceptionStackTrace, error) {rows, err := (*chdb.Conn).Query(ctx,`SELECT id, project_id, transaction_id, transaction_type, exception_hash, stack_trace, recorded_at, scope, app_version, server_name, is_messageFROM exception_stack_traces@@ -389,7 +390,7 @@ func (e *exceptionStackTraceRepository) FindAllByTransactionId(ctx context.Conte}// FindById returns a single exception by its ID-func (e *exceptionStackTraceRepository) FindById(ctx context.Context, projectId string, id string) (*models.ExceptionStackTrace, error) {+func (e *exceptionStackTraceRepository) FindById(ctx context.Context, projectId uuid.UUID, id uuid.UUID) (*models.ExceptionStackTrace, error) {var est models.ExceptionStackTracevar scopeJSON stringvar isMessage uint8diff --git a/backend/app/repositories/metric_record.repository.go b/backend/app/repositories/metric_record.repository.goindex 0a356156..a9be228c 100644--- a/backend/app/repositories/metric_record.repository.go+++ b/backend/app/repositories/metric_record.repository.go@@ -7,6 +7,7 @@ import ("time""github.com/ClickHouse/clickhouse-go/v2"+ "github.com/google/uuid")type metricRecordRepository struct{}@@ -24,14 +25,14 @@ func (e *metricRecordRepository) InsertAsync(ctx context.Context, lines []modelsreturn batch.Send()}-func (e *metricRecordRepository) GetAverageBetween(ctx context.Context, projectId string, name string, start, end time.Time) (float64, error) {+func (e *metricRecordRepository) GetAverageBetween(ctx context.Context, projectId uuid.UUID, name string, start, end time.Time) (float64, error) {var avg float64err := (*chdb.Conn).QueryRow(ctx, "SELECT coalesce(avg(value), 0) FROM metric_records WHERE project_id = ? AND name = ? AND recorded_at >= ? AND recorded_at <= ?", projectId, name, start, end).Scan(&avg)return avg, err}// GetAverageByHour returns metric averages grouped by hour-func (e *metricRecordRepository) GetAverageByHour(ctx context.Context, projectId string, name string, start, end time.Time) ([]models.TimeSeriesPoint, error) {+func (e *metricRecordRepository) GetAverageByHour(ctx context.Context, projectId uuid.UUID, name string, start, end time.Time) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfHour(recorded_at) as hour,avg(value) as avg_value@@ -59,7 +60,7 @@ func (e *metricRecordRepository) GetAverageByHour(ctx context.Context, projectId}// GetAverageByInterval returns metric averages grouped by configurable interval in minutes-func (e *metricRecordRepository) GetAverageByInterval(ctx context.Context, projectId string, name string, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {+func (e *metricRecordRepository) GetAverageByInterval(ctx context.Context, projectId uuid.UUID, name string, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfInterval(recorded_at, INTERVAL ? MINUTE) as bucket,avg(value) as avg_value@@ -87,7 +88,7 @@ func (e *metricRecordRepository) GetAverageByInterval(ctx context.Context, proje}// GetDistinctServers returns all unique server names with data in the time range-func (e *metricRecordRepository) GetDistinctServers(ctx context.Context, projectId string, start, end time.Time) ([]string, error) {+func (e *metricRecordRepository) GetDistinctServers(ctx context.Context, projectId uuid.UUID, start, end time.Time) ([]string, error) {query := `SELECT DISTINCT server_name FROM metric_recordsWHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?AND server_name != ''@@ -111,7 +112,7 @@ func (e *metricRecordRepository) GetDistinctServers(ctx context.Context, project}// GetAverageByIntervalPerServer returns metric averages grouped by interval and server-func (e *metricRecordRepository) GetAverageByIntervalPerServer(ctx context.Context, projectId string, name string, start, end time.Time, intervalMinutes int, servers []string) (map[string][]models.TimeSeriesPoint, error) {+func (e *metricRecordRepository) GetAverageByIntervalPerServer(ctx context.Context, projectId uuid.UUID, name string, start, end time.Time, intervalMinutes int, servers []string) (map[string][]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfInterval(recorded_at, INTERVAL ? MINUTE) as bucket,server_name,diff --git a/backend/app/repositories/project.repository.go b/backend/app/repositories/project.repository.goindex 703d53f5..2d65b78c 100644--- a/backend/app/repositories/project.repository.go+++ b/backend/app/repositories/project.repository.go@@ -42,7 +42,7 @@ func (p *projectRepository) FindByToken(ctx context.Context, token string) (*modreturn &proj, nil}-func (p *projectRepository) FindById(ctx context.Context, id string) (*models.Project, error) {+func (p *projectRepository) FindById(ctx context.Context, id uuid.UUID) (*models.Project, error) {var proj models.Projecterr := (*chdb.Conn).QueryRow(ctx, "SELECT id, name, token, framework, created_at FROM projects WHERE id = ?", id).Scan(&proj.Id, &proj.Name, &proj.Token, &proj.Framework, &proj.CreatedAt)@@ -53,7 +53,7 @@ func (p *projectRepository) FindById(ctx context.Context, id string) (*models.Pr}func (p *projectRepository) Create(ctx context.Context, name string, framework string) (*models.Project, error) {- id := uuid.New().String()+ id := uuid.New()token := generateSecureToken()err := (*chdb.Conn).Exec(ctx, "INSERT INTO projects (id, name, token, framework) VALUES (?, ?, ?, ?)", id, name, token, framework)diff --git a/backend/app/repositories/segment.repository.go b/backend/app/repositories/segment.repository.goindex fda356e4..14e9c437 100644--- a/backend/app/repositories/segment.repository.go+++ b/backend/app/repositories/segment.repository.go@@ -6,6 +6,7 @@ import ("context""github.com/ClickHouse/clickhouse-go/v2"+ "github.com/google/uuid")type segmentRepository struct{}@@ -38,7 +39,7 @@ func (r *segmentRepository) InsertAsync(ctx context.Context, segments []models.Sreturn batch.Send()}-func (r *segmentRepository) FindByTransactionId(ctx context.Context, projectId, transactionId string) ([]models.Segment, error) {+func (r *segmentRepository) FindByTransactionId(ctx context.Context, projectId, transactionId uuid.UUID) ([]models.Segment, error) {query := `SELECTid, transaction_id, project_id, name, start_time, duration, recorded_atFROM segmentsdiff --git a/backend/app/repositories/task.repository.go b/backend/app/repositories/task.repository.goindex 42a76417..673f355a 100644--- a/backend/app/repositories/task.repository.go+++ b/backend/app/repositories/task.repository.go@@ -8,6 +8,7 @@ import ("time""github.com/ClickHouse/clickhouse-go/v2"+ "github.com/google/uuid")type taskRepository struct{}@@ -31,13 +32,13 @@ func (e *taskRepository) InsertAsync(ctx context.Context, lines []models.Task) ereturn batch.Send()}-func (e *taskRepository) CountBetween(ctx context.Context, projectId string, start, end time.Time) (int64, error) {+func (e *taskRepository) CountBetween(ctx context.Context, projectId uuid.UUID, start, end time.Time) (int64, error) {var count uint64err := (*chdb.Conn).QueryRow(ctx, "SELECT count() FROM tasks WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?", projectId, start, end).Scan(&count)return int64(count), err}-func (e *taskRepository) FindAll(ctx context.Context, projectId string, fromDate, toDate time.Time, page, pageSize int, orderBy string) ([]models.Task, int64, error) {+func (e *taskRepository) FindAll(ctx context.Context, projectId uuid.UUID, fromDate, toDate time.Time, page, pageSize int, orderBy string) ([]models.Task, int64, error) {var count uint64err := (*chdb.Conn).QueryRow(ctx, "SELECT count() FROM tasks WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?", projectId, fromDate, toDate).Scan(&count)if err != nil {@@ -81,7 +82,7 @@ func (e *taskRepository) FindAll(ctx context.Context, projectId string, fromDatereturn tasks, int64(count), nil}-func (e *taskRepository) FindGroupedByTaskName(ctx context.Context, projectId string, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string) ([]models.TaskStats, int64, error) {+func (e *taskRepository) FindGroupedByTaskName(ctx context.Context, projectId uuid.UUID, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string) ([]models.TaskStats, int64, error) {// Count unique task namesvar count uint64err := (*chdb.Conn).QueryRow(ctx, "SELECT uniq(task_name) FROM tasks WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?", projectId, fromDate, toDate).Scan(&count)@@ -147,7 +148,7 @@ func (e *taskRepository) FindGroupedByTaskName(ctx context.Context, projectId streturn stats, int64(count), nil}-func (e *taskRepository) FindByTaskName(ctx context.Context, projectId string, taskName string, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string) ([]models.Task, int64, error) {+func (e *taskRepository) FindByTaskName(ctx context.Context, projectId uuid.UUID, taskName string, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string) ([]models.Task, int64, error) {var count uint64err := (*chdb.Conn).QueryRow(ctx, "SELECT count() FROM tasks WHERE project_id = ? AND task_name = ? AND recorded_at >= ? AND recorded_at <= ?", projectId, taskName, fromDate, toDate).Scan(&count)if err != nil {@@ -198,7 +199,7 @@ func (e *taskRepository) FindByTaskName(ctx context.Context, projectId string, t}// FindById returns a single task by ID-func (e *taskRepository) FindById(ctx context.Context, projectId, taskId string) (*models.Task, error) {+func (e *taskRepository) FindById(ctx context.Context, projectId, taskId uuid.UUID) (*models.Task, error) {query := `SELECT id, project_id, task_name, duration, recorded_at, client_ip, scope, app_version, server_nameFROM tasksWHERE project_id = ? AND id = ?@@ -226,7 +227,7 @@ func (e *taskRepository) FindById(ctx context.Context, projectId, taskId string)}// CountByHour returns task counts grouped by hour-func (e *taskRepository) CountByHour(ctx context.Context, projectId string, start, end time.Time) ([]models.TimeSeriesPoint, error) {+func (e *taskRepository) CountByHour(ctx context.Context, projectId uuid.UUID, start, end time.Time) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfHour(recorded_at) as hour,toFloat64(count()) as count@@ -254,7 +255,7 @@ func (e *taskRepository) CountByHour(ctx context.Context, projectId string, star}// AvgDurationByHour returns average duration in ms grouped by hour-func (e *taskRepository) AvgDurationByHour(ctx context.Context, projectId string, start, end time.Time) ([]models.TimeSeriesPoint, error) {+func (e *taskRepository) AvgDurationByHour(ctx context.Context, projectId uuid.UUID, start, end time.Time) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfHour(recorded_at) as hour,avg(duration) / 1000000 as avg_duration_ms@@ -282,7 +283,7 @@ func (e *taskRepository) AvgDurationByHour(ctx context.Context, projectId string}// CountByInterval returns task counts grouped by configurable interval in minutes-func (e *taskRepository) CountByInterval(ctx context.Context, projectId string, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {+func (e *taskRepository) CountByInterval(ctx context.Context, projectId uuid.UUID, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfInterval(recorded_at, INTERVAL ? MINUTE) as bucket,toFloat64(count()) as count@@ -310,7 +311,7 @@ func (e *taskRepository) CountByInterval(ctx context.Context, projectId string,}// AvgDurationByInterval returns average duration in ms grouped by configurable interval-func (e *taskRepository) AvgDurationByInterval(ctx context.Context, projectId string, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {+func (e *taskRepository) AvgDurationByInterval(ctx context.Context, projectId uuid.UUID, start, end time.Time, intervalMinutes int) ([]models.TimeSeriesPoint, error) {query := `SELECTtoStartOfInterval(recorded_at, INTERVAL ? MINUTE) as bucket,avg(duration) / 1000000 as avg_duration_ms@@ -338,7 +339,7 @@ func (e *taskRepository) AvgDurationByInterval(ctx context.Context, projectId st}// FindWorstTasks returns tasks ordered by impact score (count * variance)-func (e *taskRepository) FindWorstTasks(ctx context.Context, projectId string, start, end time.Time, limit int) ([]models.TaskStats, error) {+func (e *taskRepository) FindWorstTasks(ctx context.Context, projectId uuid.UUID, start, end time.Time, limit int) ([]models.TaskStats, error) {query := `SELECTtask_name,count() as count,@@ -375,7 +376,7 @@ func (e *taskRepository) FindWorstTasks(ctx context.Context, projectId string, s}// GetTaskStats returns aggregate statistics for a specific task-func (e *taskRepository) GetTaskStats(ctx context.Context, projectId, taskName string, start, end time.Time) (*models.TaskDetailStats, error) {+func (e *taskRepository) GetTaskStats(ctx context.Context, projectId uuid.UUID, taskName string, start, end time.Time) (*models.TaskDetailStats, error) {// Calculate time range duration for throughput calculationdurationMinutes := end.Sub(start).Minutes()if durationMinutes < 1 {