From 3e222bf4d5a0c6e4bd9708da4fae6bcc10a8037f Mon Sep 17 00:00:00 2001 From: zhuhuijun Date: Mon, 12 May 2025 15:59:55 +0800 Subject: [PATCH] fix: update output type in config and extend connection lifetime - Changed output type in `config.yaml` from Clickhouse to file to align with new data handling strategy. - Increased `ConnMaxLifetime` in `clickhouse.go` from 3600 seconds to 3 hours for improved connection management. --- cmd/config.yaml | 2 +- pkg/client/clickhouse.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/config.yaml b/cmd/config.yaml index 6d04848..e7c9fbe 100644 --- a/cmd/config.yaml +++ b/cmd/config.yaml @@ -5,7 +5,7 @@ btf: kernel: "/sys/kernel/btf/vmlinux" output: - type: clickhouse + type: file clickhouse: host: "192.168.200.201" port: "9000" diff --git a/pkg/client/clickhouse.go b/pkg/client/clickhouse.go index 50de2c8..fa01119 100644 --- a/pkg/client/clickhouse.go +++ b/pkg/client/clickhouse.go @@ -2,6 +2,7 @@ package client import ( "fmt" + "time" "github.com/ClickHouse/clickhouse-go/v2" "github.com/cen-ngc5139/shepherd/internal/config" @@ -21,7 +22,7 @@ func NewClickHouseConn(cfg config.ClickhouseOutputConfig) (clickhouse.Conn, erro Compression: &clickhouse.Compression{ Method: clickhouse.CompressionLZ4, }, - ConnMaxLifetime: 3600, + ConnMaxLifetime: time.Hour * 3, ConnOpenStrategy: clickhouse.ConnOpenInOrder, }) if err != nil {