Skip to content

Commit

Permalink
Merge pull request #194 from intelops/data
Browse files Browse the repository at this point in the history
Client changes
  • Loading branch information
vijeyash1 authored Sep 2, 2023
2 parents 6e742c8 + d24f9fd commit 2895d81
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions client/pkg/clickhouse/db_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ func (c *DBClient) InsertKubvizEvent(metrics model.Metrics) {
)
defer stmt.Close()
eventJson, _ := json.Marshal(metrics.Event)
formattedFirstTimestamp := metrics.Event.FirstTimestamp.Time.UTC().Format("2006-01-02 15:04:05")
formattedLastTimestamp := metrics.Event.LastTimestamp.Time.UTC().Format("2006-01-02 15:04:05")

if _, err := stmt.Exec(
metrics.ClusterName,
string(metrics.Event.UID),
Expand All @@ -270,8 +273,8 @@ func (c *DBClient) InsertKubvizEvent(metrics model.Metrics) {
metrics.Event.Reason,
metrics.Event.Source.Host,
string(eventJson),
metrics.Event.FirstTimestamp.Time.UTC(),
metrics.Event.LastTimestamp.Time.UTC(),
formattedFirstTimestamp,
formattedLastTimestamp,
); err != nil {
log.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions client/pkg/clickhouse/statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const kubvizTable DBStatement = `
Reason String,
Host String,
Event String,
FirstTime DateTime('UTC'),
LastTime DateTime('UTC')
FirstTime String,
LastTime String
) engine=File(TabSeparated)
`
const rakeesTable DBStatement = `
Expand Down

0 comments on commit 2895d81

Please sign in to comment.