From f81a350f3bdf37cc854d3c57baac16c329bb821a Mon Sep 17 00:00:00 2001 From: yasin-cs-ko-ak Date: Wed, 7 Dec 2022 16:16:18 +0530 Subject: [PATCH] [fix] bind port connection added in db Signed-off-by: yasin-cs-ko-ak --- src/libs/dbHandler.go | 6 +++++- src/libs/sqliteHandler.go | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libs/dbHandler.go b/src/libs/dbHandler.go index ad38eeb7..cb84d955 100644 --- a/src/libs/dbHandler.go +++ b/src/libs/dbHandler.go @@ -406,7 +406,7 @@ func UpsertSystemSummary(cfg types.ConfigDB, summaryMap map[types.SystemSummary] func upsertSysSummarySQL(db *sql.DB, summary types.SystemSummary, timeCount types.SysSummaryTimeCount) error { queryString := `cluster_name = ? and cluster_id = ? and workspace_id = ? and namespace_name = ? and namespace_id = ? and container_name = ? and container_image = ? and container_id = ? and podname = ? and operation = ? and labels = ? and deployment_name = ? and source = ? and destination = ? - and destination_namespace = ? and destination_labels = ? and type = ? and ip = ? and port = ? and protocol = ? and action = ?` + and destination_namespace = ? and destination_labels = ? and type = ? and ip = ? and port = ? and protocol = ? and action = ? and bind_port = ? and bind_address = ?` query := "UPDATE " + TableSystemSummarySQLite + " SET count=count+?, updated_time=? WHERE " + queryString + " " @@ -440,6 +440,8 @@ func upsertSysSummarySQL(db *sql.DB, summary types.SystemSummary, timeCount type summary.Port, summary.Protocol, summary.Action, + summary.BindPort, + summary.BindAddress, ) if err != nil { log.Error().Msg(err.Error()) @@ -611,6 +613,8 @@ func getSysSummarySQL(db *sql.DB, dbName string, filterOptions types.SystemSumma &localSum.Action, &localSum.Count, &localSum.UpdatedTime, + &localSum.BindPort, + &localSum.BindAddress, ); err != nil { return nil, err } diff --git a/src/libs/sqliteHandler.go b/src/libs/sqliteHandler.go index 77033cd8..932c156e 100644 --- a/src/libs/sqliteHandler.go +++ b/src/libs/sqliteHandler.go @@ -732,6 +732,8 @@ func CreateSystemSummaryTableSQLite(cfg types.ConfigDB) error { " `action` varchar(10) DEFAULT NULL," + " `count` int NOT NULL," + " `updated_time` bigint NOT NULL," + + " `bind_port` varchar(10) DEFAULT NULL," + + " `bind_address` varchar(10) DEFAULT NULL," + " PRIMARY KEY (`id`)" + " );"