Skip to content

Commit b5f0227

Browse files
chhetripradeepPradeep Chhetri
andauthored
Bump clickhouse-go: v1.5.4 -> v2.3.0 (#116)
* Bump clickhouse-go: v1.5.4 -> v2.3.0 This change will have some breaking change but we will have good performance gain. * ClickHouse Address will change from `tcp://localhost:9000` to `localhost:9000` * In Jaeger, `duration` is of `Time.Duration` datatype which is Int64 but ClickHouse's `durationUs` column used to be UInt64 datatype. Newer version of clickhouse client validates the datatype before writing the data. Hence we have to change the column `durationUs` to Int64 datatype. Signed-off-by: Pradeep Chhetri <pradeepchhetri4444@gmail.com> * Sanitize address if tcp:// scheme is present Signed-off-by: Pradeep Chhetri <pradeepchhetri4444@gmail.com> * Keep using UInt64 for durationUs Signed-off-by: Pradeep Chhetri <pradeepchhetri4444@gmail.com> * Cleanup Signed-off-by: Pradeep Chhetri <pradeepchhetri4444@gmail.com> * Feedbacks Signed-off-by: Pradeep Chhetri <pradeepchhetri4444@gmail.com> Signed-off-by: Pradeep Chhetri <pradeepchhetri4444@gmail.com> Co-authored-by: Pradeep Chhetri <pchhetri@cloudflare.com>
1 parent 6818bcd commit b5f0227

30 files changed

+149
-138
lines changed

cmd/jaeger-clickhouse/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"flag"
5-
"io/ioutil"
65
"net/http"
76
"os"
87
"path/filepath"
@@ -32,7 +31,7 @@ func main() {
3231
JSONFormat: true,
3332
})
3433

35-
cfgFile, err := ioutil.ReadFile(filepath.Clean(configPath))
34+
cfgFile, err := os.ReadFile(filepath.Clean(configPath))
3635
if err != nil {
3736
logger.Error("Could not read config file", "config", configPath, "error", err)
3837
os.Exit(1)

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
address: tcp://some-clickhouse-server:9000
1+
address: some-clickhouse-server:9000
22
# Directory with .sql files to run at plugin startup, mainly for integration tests.
33
# Depending on the value of "init_tables", this can be run as a
44
# replacement or supplement to creating default tables for span storage.

e2etests/config-local-multi1.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
address: tcp://chi:9000
1+
address: chi:9000
22
tenant: multi1
33
# For test purposes flush on every write
44
batch_write_size: 1

e2etests/config-local-multi2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
address: tcp://chi:9000
1+
address: chi:9000
22
tenant: multi2
33
# For test purposes flush on every write
44
batch_write_size: 1

e2etests/config-local-single.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
address: tcp://chi:9000
1+
address: chi:9000
22
# For test purposes flush on every write
33
batch_write_size: 1

e2etests/config-replication-multi1.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
address: tcp://chi:9000
1+
address: chi:9000
22
replication: true
33
tenant: multi1
44
# For test purposes flush on every write

e2etests/config-replication-multi2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
address: tcp://chi:9000
1+
address: chi:9000
22
replication: true
33
tenant: multi2
44
# For test purposes flush on every write
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
address: tcp://chi:9000
1+
address: chi:9000
22
replication: true
33
# For test purposes flush on every write
44
batch_write_size: 1

e2etests/e2e_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package e2etests
22

33
import (
44
"context"
5-
"database/sql"
65
"encoding/json"
76
"fmt"
87
"io/ioutil"
@@ -11,7 +10,7 @@ import (
1110
"testing"
1211
"time"
1312

14-
_ "github.com/ClickHouse/clickhouse-go" // import driver
13+
clickhouse "github.com/ClickHouse/clickhouse-go/v2"
1514
"github.com/ecodia/golang-awaitility/awaitility"
1615
"github.com/stretchr/testify/assert"
1716
"github.com/stretchr/testify/require"
@@ -176,7 +175,18 @@ func (c *clickhouseWaitStrategy) WaitUntilReady(ctx context.Context, target wait
176175

177176
port, err := target.MappedPort(ctx, clickhousePort)
178177
require.NoError(c.test, err)
179-
db, err := sql.Open("clickhouse", fmt.Sprintf("tcp://localhost:%d?database=default", port.Int()))
178+
179+
db := clickhouse.OpenDB(&clickhouse.Options{
180+
Addr: []string{
181+
fmt.Sprintf("localhost:%d", port.Int()),
182+
},
183+
Auth: clickhouse.Auth{
184+
Database: "default",
185+
},
186+
Compression: &clickhouse.Compression{
187+
Method: clickhouse.CompressionLZ4,
188+
},
189+
})
180190
require.NoError(c.test, err)
181191

182192
for {

go.mod

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/jaegertracing/jaeger-clickhouse
33
go 1.19
44

55
require (
6-
github.com/ClickHouse/clickhouse-go v1.5.4
6+
github.com/ClickHouse/clickhouse-go/v2 v2.3.0
77
github.com/DATA-DOG/go-sqlmock v1.5.0
88
github.com/ecodia/golang-awaitility v0.0.0-20180710094957-fb55e59708c7
99
github.com/gogo/protobuf v1.3.2
@@ -12,22 +12,23 @@ require (
1212
github.com/kr/pretty v0.3.0
1313
github.com/opentracing/opentracing-go v1.2.0
1414
github.com/prometheus/client_golang v1.12.2
15-
github.com/stretchr/testify v1.7.1
15+
github.com/stretchr/testify v1.8.0
1616
github.com/testcontainers/testcontainers-go v0.11.1
1717
github.com/uber/jaeger-lib v2.4.1+incompatible
18-
go.uber.org/zap v1.21.0
19-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
18+
go.uber.org/zap v1.22.0
19+
gopkg.in/yaml.v3 v3.0.1
2020
)
2121

2222
require (
2323
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
24+
github.com/ClickHouse/ch-go v0.47.3 // indirect
2425
github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3 // indirect
2526
github.com/Microsoft/hcsshim v0.8.16 // indirect
27+
github.com/andybalholm/brotli v1.0.4 // indirect
2628
github.com/benbjohnson/clock v1.3.0 // indirect
2729
github.com/beorn7/perks v1.0.1 // indirect
2830
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
2931
github.com/cespare/xxhash/v2 v2.1.2 // indirect
30-
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 // indirect
3132
github.com/containerd/cgroups v0.0.0-20210114181951-8a68de567b68 // indirect
3233
github.com/containerd/containerd v1.5.0-beta.4 // indirect
3334
github.com/davecgh/go-spew v1.1.1 // indirect
@@ -37,15 +38,17 @@ require (
3738
github.com/docker/go-units v0.4.0 // indirect
3839
github.com/fatih/color v1.13.0 // indirect
3940
github.com/fsnotify/fsnotify v1.5.4 // indirect
41+
github.com/go-faster/city v1.0.1 // indirect
42+
github.com/go-faster/errors v0.6.1 // indirect
4043
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
4144
github.com/golang/protobuf v1.5.2 // indirect
42-
github.com/google/go-cmp v0.5.8 // indirect
4345
github.com/google/uuid v1.3.0 // indirect
4446
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
4547
github.com/hashicorp/go-plugin v1.4.4 // indirect
4648
github.com/hashicorp/hcl v1.0.0 // indirect
4749
github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect
4850
github.com/inconshreveable/mousetrap v1.0.0 // indirect
51+
github.com/klauspost/compress v1.15.9 // indirect
4952
github.com/kr/text v0.2.0 // indirect
5053
github.com/magiconair/properties v1.8.6 // indirect
5154
github.com/mattn/go-colorable v0.1.12 // indirect
@@ -61,14 +64,18 @@ require (
6164
github.com/opencontainers/go-digest v1.0.0 // indirect
6265
github.com/opencontainers/image-spec v1.0.1 // indirect
6366
github.com/opencontainers/runc v1.0.0-rc93 // indirect
67+
github.com/paulmach/orb v0.7.1 // indirect
6468
github.com/pelletier/go-toml v1.9.4 // indirect
6569
github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect
70+
github.com/pierrec/lz4/v4 v4.1.15 // indirect
6671
github.com/pkg/errors v0.9.1 // indirect
6772
github.com/pmezard/go-difflib v1.0.0 // indirect
6873
github.com/prometheus/client_model v0.2.0 // indirect
6974
github.com/prometheus/common v0.34.0 // indirect
7075
github.com/prometheus/procfs v0.7.3 // indirect
7176
github.com/rogpeppe/go-internal v1.8.1 // indirect
77+
github.com/segmentio/asm v1.2.0 // indirect
78+
github.com/shopspring/decimal v1.3.1 // indirect
7279
github.com/sirupsen/logrus v1.8.1 // indirect
7380
github.com/spf13/afero v1.8.2 // indirect
7481
github.com/spf13/cast v1.5.0 // indirect
@@ -79,10 +86,12 @@ require (
7986
github.com/subosito/gotenv v1.2.0 // indirect
8087
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
8188
go.opencensus.io v0.23.0 // indirect
82-
go.uber.org/atomic v1.9.0 // indirect
89+
go.opentelemetry.io/otel v1.9.0 // indirect
90+
go.opentelemetry.io/otel/trace v1.9.0 // indirect
91+
go.uber.org/atomic v1.10.0 // indirect
8392
go.uber.org/multierr v1.8.0 // indirect
8493
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
85-
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
94+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
8695
golang.org/x/text v0.3.7 // indirect
8796
google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac // indirect
8897
google.golang.org/grpc v1.46.2 // indirect

0 commit comments

Comments
 (0)