From 2a0b8e1c1ff5cbf697cd0d32b1822798a3494e93 Mon Sep 17 00:00:00 2001 From: vijeyash Date: Wed, 12 Jul 2023 12:20:54 +0530 Subject: [PATCH] patch for datetime overflow --- client/pkg/clickhouse/db_client.go | 6 +++--- client/pkg/clickhouse/statements.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/pkg/clickhouse/db_client.go b/client/pkg/clickhouse/db_client.go index 5511befd..749f1e80 100644 --- a/client/pkg/clickhouse/db_client.go +++ b/client/pkg/clickhouse/db_client.go @@ -210,7 +210,7 @@ func (c *DBClient) InsertKubvizEvent(metrics model.Metrics) { if _, err := stmt.Exec( metrics.ClusterName, string(metrics.Event.UID), - time.Now(), + time.Now().Format("2006-01-02 15:04:05"), metrics.Type, metrics.Event.Name, metrics.Event.Namespace, @@ -219,8 +219,8 @@ func (c *DBClient) InsertKubvizEvent(metrics model.Metrics) { metrics.Event.Reason, metrics.Event.Source.Host, string(eventJson), - metrics.Event.FirstTimestamp.Time, - metrics.Event.LastTimestamp.Time, + metrics.Event.FirstTimestamp.Time.Format("2006-01-02 15:04:05"), + metrics.Event.LastTimestamp.Time.Format("2006-01-02 15:04:05"), ); err != nil { log.Fatal(err) } diff --git a/client/pkg/clickhouse/statements.go b/client/pkg/clickhouse/statements.go index ae2e7ca0..43c5ab68 100644 --- a/client/pkg/clickhouse/statements.go +++ b/client/pkg/clickhouse/statements.go @@ -6,7 +6,7 @@ const kubvizTable DBStatement = ` CREATE TABLE IF NOT EXISTS events ( ClusterName String, Id String, - EventTime DateTime64, + EventTime String, OpType String, Name String, Namespace String, @@ -15,8 +15,8 @@ const kubvizTable DBStatement = ` Reason String, Host String, Event String, - FirstTime DateTime64, - LastTime DateTime64 + FirstTime String, + LastTime String ) engine=File(TabSeparated) ` const rakeesTable DBStatement = `