-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[v2][feat] Introduce ClickHouse connection configuration #6664
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
service: | ||
extensions: [jaeger_storage, jaeger_query, healthcheckv2] | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
processors: [batch] | ||
exporters: [jaeger_storage_exporter] | ||
telemetry: | ||
resource: | ||
service.name: jaeger | ||
metrics: | ||
level: detailed | ||
address: 0.0.0.0:8888 | ||
logs: | ||
level: debug | ||
# TODO Initialize telemetry tracer once OTEL released new feature. | ||
# https://github.com/open-telemetry/opentelemetry-collector/issues/10663 | ||
|
||
extensions: | ||
healthcheckv2: | ||
use_v2: true | ||
http: | ||
|
||
jaeger_query: | ||
storage: | ||
traces: some_storage | ||
traces_archive: another_storage | ||
ui: | ||
config_file: ./cmd/jaeger/config-ui.json | ||
|
||
jaeger_storage: | ||
backends: | ||
some_storage: | ||
clickhouse: | ||
connection: | ||
addresses: "127.0.0.1:9000" | ||
auth: | ||
database: "jeager" | ||
username: "default" | ||
password: "" | ||
|
||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
http: | ||
|
||
jaeger: | ||
protocols: | ||
grpc: | ||
thrift_binary: | ||
thrift_compact: | ||
thrift_http: | ||
|
||
processors: | ||
batch: | ||
|
||
exporters: | ||
jaeger_storage_exporter: | ||
trace_storage: some_storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright (c) 2025 The Jaeger Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package config | ||
|
||
import ( | ||
"crypto/tls" | ||
"time" | ||
|
||
"go.opentelemetry.io/collector/config/configopaque" | ||
) | ||
|
||
const ( | ||
dialTimeout = 10 * time.Second | ||
connMaxLifetime = 10 * time.Minute | ||
|
||
maxOpenConns = 5 | ||
maxIdleConns = 5 | ||
blockBufferSize uint8 = 10 | ||
) | ||
|
||
// Configuration describes the configuration properties needed to connect to an ElasticSearch cluster | ||
type Configuration struct { | ||
Connection Connection `mapstructure:"connection"` | ||
} | ||
|
||
// Connection More details see: https://clickhouse.com/docs/en/integrations/go#connecting | ||
type Connection struct { | ||
// Addresses A slice of addresses including port. | ||
Addresses []string `mapstructure:"addresses"` | ||
// Auth Specify an auth struct in the connection details to specify a username and password. | ||
Auth Authentication `mapstructure:"auth"` | ||
// TLS options. A non-nil value enables TLS. | ||
TLS *tls.Config `mapstructure:"tls"` | ||
// DialTimeout the maximum time to establish a connection. | ||
DialTimeout time.Duration `mapstructure:"dial_timeout"` | ||
// MaxOpenConns max connections for use at any time. More or fewer connections may be in the idle pool, | ||
// but only this number can be used at any time. | ||
MaxOpenConns int `mapstructure:"max_open_conns"` | ||
// MaxIdleConns number of connections to maintain in the pool. Connections will be reused if possible. | ||
MaxIdleConns int `mapstructure:"max_idle_conns"` | ||
// ConnMaxLifetime maximum lifetime to keep a connection available. Connections are destroyed after this time, | ||
// with new connections added to the pool as required. | ||
ConnMaxLifetime time.Duration `mapstructure:"conn_max_lifetime"` | ||
// BlockBufferSize maximum number of blocks to decode into the buffer at once. | ||
// larger values will increase parallelization at the expense of memory. | ||
// block sizes are query dependent so while you can set this on the connection, | ||
BlockBufferSize uint8 `mapstructure:"block_buffer_size"` | ||
} | ||
|
||
type Authentication struct { | ||
Database string `mapstructure:"database"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is database part of auth? Can't I auth via TLS and still specify database? |
||
Username string `mapstructure:"username"` | ||
Password configopaque.String `mapstructure:"password"` | ||
} | ||
|
||
func DefaultConfiguration() Configuration { | ||
return Configuration{ | ||
Connection: Connection{ | ||
Addresses: []string{"127.0.0.1:9000"}, | ||
Auth: Authentication{ | ||
Database: "jeager", | ||
Username: "default", | ||
Password: "", | ||
}, | ||
//nolint: gosec // G402 | ||
TLS: &tls.Config{InsecureSkipVerify: true}, | ||
Check failure Code scanning / CodeQL Disabled TLS certificate check High
InsecureSkipVerify should not be used in production code.
|
||
DialTimeout: dialTimeout, | ||
MaxOpenConns: maxOpenConns, | ||
MaxIdleConns: maxIdleConns, | ||
ConnMaxLifetime: connMaxLifetime, | ||
BlockBufferSize: blockBufferSize, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2025 The Jaeger Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package config | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"go.opentelemetry.io/collector/config/configopaque" | ||
|
||
"github.com/jaegertracing/jaeger/pkg/testutils" | ||
) | ||
|
||
func TestDefaultConfiguration(t *testing.T) { | ||
cfg := DefaultConfiguration() | ||
conn := cfg.Connection | ||
assert.Equal(t, []string{"127.0.0.1:9000"}, conn.Addresses) | ||
assert.Equal(t, "jeager", conn.Auth.Database) | ||
assert.Equal(t, "default", conn.Auth.Username) | ||
assert.Equal(t, configopaque.String(""), conn.Auth.Password) | ||
assert.Equal(t, 10*time.Second, conn.DialTimeout) | ||
assert.Equal(t, 5, conn.MaxOpenConns) | ||
assert.Equal(t, 5, conn.MaxIdleConns) | ||
assert.Equal(t, 10*time.Minute, conn.ConnMaxLifetime) | ||
assert.Equal(t, uint8(10), conn.BlockBufferSize) | ||
} | ||
|
||
func TestMain(m *testing.M) { | ||
testutils.VerifyGoLeaks(m) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't work, see how other configs are doing TLS