Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] bind port connection added in db #626

Merged
merged 1 commit into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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