From 4de4ab77373cb6a6a60f72dcca88aa0e3aca85bf Mon Sep 17 00:00:00 2001 From: an1l4 <1995anila@gmail.com> Date: Mon, 4 Mar 2024 09:52:01 +0530 Subject: [PATCH] date-issue-fixed --- client/pkg/clickhouse/db_client.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/client/pkg/clickhouse/db_client.go b/client/pkg/clickhouse/db_client.go index 7f075177..1c156a5d 100644 --- a/client/pkg/clickhouse/db_client.go +++ b/client/pkg/clickhouse/db_client.go @@ -961,7 +961,18 @@ func (c *DBClient) InsertTrivySbomMetrics(metrics model.Sbom) { log.Println("error: component not found or not in expected format") return } - timestamp, _ := metadata["timestamp"].(time.Time) + //timestamp, _ := metadata["timestamp"].(time.Time) + var timestamp time.Time + rawTimestamp, ok := metadata["timestamp"].(string) + if !ok { + log.Println("error: timestamp not found or not in expected format") + return + } + timestamp, err = time.Parse(time.RFC3339, rawTimestamp) + if err != nil { + log.Println("error parsing timestamp:", err) + return + } // inside metadata // taking component