Skip to content

Commit

Permalink
Merge pull request #626 from yasin-cs-ko-ak/fixbind
Browse files Browse the repository at this point in the history
[fix] bind port connection added in db
  • Loading branch information
nyrahul authored Dec 8, 2022
2 parents 45c77dd + f81a350 commit 9c436a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libs/dbHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 + " "

Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions src/libs/sqliteHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`)" +
" );"

Expand Down

0 comments on commit 9c436a7

Please sign in to comment.