From 516e646d1d2bf6a7491cfbd79897faf907dd7abe Mon Sep 17 00:00:00 2001 From: Thibault Le Ouay Date: Wed, 9 Oct 2024 18:49:46 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20tcp=20timestamp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/checker/handlers/tcp.go | 5 +++++ packages/tinybird/datasources/tcp_response.datasource | 2 ++ 2 files changed, 7 insertions(+) diff --git a/apps/checker/handlers/tcp.go b/apps/checker/handlers/tcp.go index cec219aab6..c5baa8e905 100644 --- a/apps/checker/handlers/tcp.go +++ b/apps/checker/handlers/tcp.go @@ -28,6 +28,7 @@ type TCPData struct { Timing string `json:"timing"` ErrorMessage string `json:"errorMessage"` Region string `json:"region"` + Trigger string `json:"trigger"` RequestId int64 `json:"requestId,omitempty"` WorkspaceID int64 `json:"workspaceId"` @@ -111,6 +112,7 @@ func (h Handler) TCPHandler(c *gin.Context) { Timing: string(timingAsString), Latency: latency, CronTimestamp: req.CronTimestamp, + Trigger: "cron", } if req.Status == "active" && req.DegradedAfter > 0 && latency > req.DegradedAfter { @@ -167,6 +169,7 @@ func (h Handler) TCPHandler(c *gin.Context) { Region: h.Region, MonitorID: monitorId, Error: 1, + Trigger: "cron", }, dataSourceName); err != nil { log.Ctx(ctx).Error().Err(err).Msg("failed to send event to tinybird") } @@ -277,6 +280,7 @@ func (h Handler) TCPHandlerRegion(c *gin.Context) { Timing: string(timingAsString), Latency: latency, RequestId: req.RequestId, + Trigger: "API", } if req.RequestId != 0 { @@ -297,6 +301,7 @@ func (h Handler) TCPHandlerRegion(c *gin.Context) { MonitorID: monitorId, Error: 1, RequestId: req.RequestId, + Trigger: "api", }, dataSourceName); err != nil { log.Ctx(ctx).Error().Err(err).Msg("failed to send event to tinybird") } diff --git a/packages/tinybird/datasources/tcp_response.datasource b/packages/tinybird/datasources/tcp_response.datasource index e6e05440a6..a9fdb476cb 100644 --- a/packages/tinybird/datasources/tcp_response.datasource +++ b/packages/tinybird/datasources/tcp_response.datasource @@ -10,6 +10,8 @@ SCHEMA > `latency` Int64 `json:$.latency`, `errorMessage` Nullable(String) `json:$.errorMessage`, `error` Int16 `json:$.error` + `trigger` Nullable(String) `json:$.trigger`, + ENGINE "MergeTree" ENGINE_PARTITION_KEY "toYYYYMM(fromUnixTimestamp64Milli(timestamp))"