Skip to content

kafkaexporter: Opt-in to use franz-go client #40364

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

Merged
Merged
Show file tree
Hide file tree
Changes from 14 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
31 changes: 31 additions & 0 deletions .chloggen/f_add-kafkaexporter-franz-go-client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: 'enhancement'

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: 'kafkaexporter'

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Add an Alpha feature gate `exporter.kafkaexporter.UseFranzGoClient` to use franz-go in the Kafka exporter for better performance."

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [40364]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
This change adds an experimental opt-in support to use the franz-go client in the Kafka exporter.
The franz-go client is a high-performance Kafka client that can improve the performance of the Kafka exporter.
The default client remains sarama, which is used by the Kafka receiver and other components.
The franz-go client can be enabled by setting `client_type=franz-go` in the configuration.

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
6 changes: 6 additions & 0 deletions exporter/kafkaexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ processors for higher throughput and resiliency. Message payload encoding is con

## Configuration settings

> [!NOTE]
> You can opt-in to use [`franz-go`](https://github.com/twmb/franz-go) client by enabling the feature gate
> `exporter.kafkaexporter.UseFranzGo` when you run the OpenTelemetry Collector. See the following page
> for more details: [Feature Gates](https://github.com/open-telemetry/opentelemetry-collector/tree/main/featuregate#controlling-gates)

There are no required settings.

The following settings can be optionally configured:

- `brokers` (default = localhost:9092): The list of kafka brokers.
- `protocol_version` (default = 2.1.0): Kafka protocol version.
- `resolve_canonical_bootstrap_servers_only` (default = false): Whether to resolve then reverse-lookup broker IPs during startup.
Expand Down
11 changes: 11 additions & 0 deletions exporter/kafkaexporter/bench.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
goos: darwin
goarch: arm64
pkg: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter
cpu: Apple M2 Pro
BenchmarkLogs-6 11415 108209 ns/op 7305 B/op 80 allocs/op
BenchmarkLogs-6 10000 101705 ns/op 7312 B/op 80 allocs/op
BenchmarkLogs-6 10000 101633 ns/op 7312 B/op 80 allocs/op
BenchmarkLogs-6 10000 102526 ns/op 7304 B/op 80 allocs/op
BenchmarkLogs-6 13101 95475 ns/op 7304 B/op 80 allocs/op
BenchmarkLogs-6 12422 94701 ns/op 7306 B/op 80 allocs/op
BenchmarkLogs-6
36 changes: 36 additions & 0 deletions exporter/kafkaexporter/franz-go.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
goos: darwin
goarch: arm64
pkg: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter
cpu: Apple M2 Pro
BenchmarkLogs-12 31820 34100 ns/op 2236 B/op 29 allocs/op
BenchmarkLogs-12 37599 32024 ns/op 2250 B/op 29 allocs/op
BenchmarkLogs-12 37064 34274 ns/op 2251 B/op 29 allocs/op
BenchmarkLogs-12 35703 34325 ns/op 2257 B/op 29 allocs/op
BenchmarkLogs-12 36334 32198 ns/op 2267 B/op 29 allocs/op
BenchmarkLogs-12 36157 32797 ns/op 2341 B/op 29 allocs/op
BenchmarkLogs-12 37051 32532 ns/op 2226 B/op 29 allocs/op
BenchmarkLogs-12 38035 34004 ns/op 2263 B/op 29 allocs/op
BenchmarkLogs-12 32408 31994 ns/op 2265 B/op 29 allocs/op
BenchmarkLogs-12 36621 34805 ns/op 2270 B/op 29 allocs/op
BenchmarkMetrics-12 33474 36901 ns/op 4426 B/op 32 allocs/op
BenchmarkMetrics-12 30530 39303 ns/op 4650 B/op 32 allocs/op
BenchmarkMetrics-12 31586 38391 ns/op 4465 B/op 32 allocs/op
BenchmarkMetrics-12 31240 39374 ns/op 4535 B/op 32 allocs/op
BenchmarkMetrics-12 28396 45172 ns/op 3901 B/op 32 allocs/op
BenchmarkMetrics-12 26986 46096 ns/op 3695 B/op 32 allocs/op
BenchmarkMetrics-12 26464 63420 ns/op 3722 B/op 32 allocs/op
BenchmarkMetrics-12 26977 40059 ns/op 3740 B/op 32 allocs/op
BenchmarkMetrics-12 34708 35470 ns/op 4783 B/op 32 allocs/op
BenchmarkMetrics-12 33321 35616 ns/op 4461 B/op 32 allocs/op
BenchmarkTraces-12 33794 35456 ns/op 3021 B/op 29 allocs/op
BenchmarkTraces-12 34214 31853 ns/op 3113 B/op 29 allocs/op
BenchmarkTraces-12 36801 40249 ns/op 3055 B/op 29 allocs/op
BenchmarkTraces-12 36147 33660 ns/op 3091 B/op 29 allocs/op
BenchmarkTraces-12 31714 33977 ns/op 2967 B/op 29 allocs/op
BenchmarkTraces-12 31849 37208 ns/op 3058 B/op 29 allocs/op
BenchmarkTraces-12 31228 50109 ns/op 2834 B/op 29 allocs/op
BenchmarkTraces-12 29637 37393 ns/op 2874 B/op 29 allocs/op
BenchmarkTraces-12 32778 34551 ns/op 3148 B/op 29 allocs/op
BenchmarkTraces-12 34215 35971 ns/op 2908 B/op 29 allocs/op
PASS
ok github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter 49.211s
36 changes: 36 additions & 0 deletions exporter/kafkaexporter/franz.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
goos: darwin
goarch: arm64
pkg: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter
cpu: Apple M2 Pro
BenchmarkLogs-12 37905 32798 ns/op 2247 B/op 28 allocs/op
BenchmarkLogs-12 33573 33944 ns/op 2190 B/op 28 allocs/op
BenchmarkLogs-12 32331 34712 ns/op 2148 B/op 28 allocs/op
BenchmarkLogs-12 33314 32738 ns/op 2292 B/op 28 allocs/op
BenchmarkLogs-12 38329 35597 ns/op 2239 B/op 28 allocs/op
BenchmarkLogs-12 25082 40580 ns/op 2095 B/op 28 allocs/op
BenchmarkLogs-12 29698 37757 ns/op 2087 B/op 28 allocs/op
BenchmarkLogs-12 30644 44639 ns/op 2070 B/op 28 allocs/op
BenchmarkLogs-12 34958 33982 ns/op 2277 B/op 28 allocs/op
BenchmarkLogs-12 31616 33788 ns/op 2250 B/op 28 allocs/op
BenchmarkMetrics-12 27564 46025 ns/op 3737 B/op 31 allocs/op
BenchmarkMetrics-12 25002 49322 ns/op 3642 B/op 31 allocs/op
BenchmarkMetrics-12 23720 53326 ns/op 3699 B/op 31 allocs/op
BenchmarkMetrics-12 23220 47419 ns/op 3605 B/op 31 allocs/op
BenchmarkMetrics-12 24519 45852 ns/op 3615 B/op 31 allocs/op
BenchmarkMetrics-12 25384 43660 ns/op 3637 B/op 31 allocs/op
BenchmarkMetrics-12 23386 49247 ns/op 3571 B/op 31 allocs/op
BenchmarkMetrics-12 25801 47621 ns/op 3638 B/op 31 allocs/op
BenchmarkMetrics-12 24204 44978 ns/op 3534 B/op 31 allocs/op
BenchmarkMetrics-12 28026 40926 ns/op 3718 B/op 31 allocs/op
BenchmarkTraces-12 35709 34335 ns/op 3093 B/op 28 allocs/op
BenchmarkTraces-12 33123 54130 ns/op 3085 B/op 28 allocs/op
BenchmarkTraces-12 31818 38882 ns/op 2865 B/op 28 allocs/op
BenchmarkTraces-12 30544 40119 ns/op 2733 B/op 28 allocs/op
BenchmarkTraces-12 29344 38750 ns/op 3190 B/op 28 allocs/op
BenchmarkTraces-12 25266 39842 ns/op 2693 B/op 28 allocs/op
BenchmarkTraces-12 31450 34433 ns/op 3003 B/op 28 allocs/op
BenchmarkTraces-12 33896 32715 ns/op 3034 B/op 28 allocs/op
BenchmarkTraces-12 35269 33231 ns/op 3012 B/op 28 allocs/op
BenchmarkTraces-12 36985 33120 ns/op 3054 B/op 28 allocs/op
PASS
ok github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter 49.604s
36 changes: 36 additions & 0 deletions exporter/kafkaexporter/franz2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
goos: darwin
goarch: arm64
pkg: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter
cpu: Apple M2 Pro
BenchmarkLogs-12 30254 37892 ns/op 2193 B/op 28 allocs/op
BenchmarkLogs-12 32016 37509 ns/op 2242 B/op 28 allocs/op
BenchmarkLogs-12 32229 37987 ns/op 2254 B/op 28 allocs/op
BenchmarkLogs-12 32034 37779 ns/op 2235 B/op 28 allocs/op
BenchmarkLogs-12 31203 40874 ns/op 2235 B/op 28 allocs/op
BenchmarkLogs-12 31506 36837 ns/op 2265 B/op 28 allocs/op
BenchmarkLogs-12 32593 37027 ns/op 2280 B/op 28 allocs/op
BenchmarkLogs-12 31680 36737 ns/op 2273 B/op 28 allocs/op
BenchmarkLogs-12 32793 37279 ns/op 2266 B/op 28 allocs/op
BenchmarkLogs-12 31646 34648 ns/op 2267 B/op 28 allocs/op
BenchmarkMetrics-12 25560 55624 ns/op 3684 B/op 31 allocs/op
BenchmarkMetrics-12 15206 78654 ns/op 3652 B/op 31 allocs/op
BenchmarkMetrics-12 21764 49204 ns/op 3624 B/op 31 allocs/op
BenchmarkMetrics-12 22341 52381 ns/op 3759 B/op 31 allocs/op
BenchmarkMetrics-12 19746 63729 ns/op 3683 B/op 31 allocs/op
BenchmarkMetrics-12 20154 51729 ns/op 3709 B/op 31 allocs/op
BenchmarkMetrics-12 23184 48399 ns/op 3636 B/op 31 allocs/op
BenchmarkMetrics-12 29370 36697 ns/op 4645 B/op 31 allocs/op
BenchmarkMetrics-12 34242 36338 ns/op 4487 B/op 31 allocs/op
BenchmarkMetrics-12 26121 45026 ns/op 3609 B/op 31 allocs/op
BenchmarkTraces-12 35298 32908 ns/op 3126 B/op 28 allocs/op
BenchmarkTraces-12 35208 32808 ns/op 2998 B/op 28 allocs/op
BenchmarkTraces-12 36322 36239 ns/op 3138 B/op 28 allocs/op
BenchmarkTraces-12 35937 38223 ns/op 3046 B/op 28 allocs/op
BenchmarkTraces-12 34375 37285 ns/op 3007 B/op 28 allocs/op
BenchmarkTraces-12 27420 43349 ns/op 2634 B/op 28 allocs/op
BenchmarkTraces-12 26535 47636 ns/op 2752 B/op 28 allocs/op
BenchmarkTraces-12 24662 42254 ns/op 2706 B/op 28 allocs/op
BenchmarkTraces-12 27678 43330 ns/op 2662 B/op 28 allocs/op
BenchmarkTraces-12 27492 43174 ns/op 2672 B/op 28 allocs/op
PASS
ok github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter 52.557s
2 changes: 1 addition & 1 deletion exporter/kafkaexporter/generated_package_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion exporter/kafkaexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.127.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.127.0
github.com/stretchr/testify v1.10.0
github.com/twmb/franz-go v1.18.1
github.com/twmb/franz-go/pkg/kfake v0.0.0-20250320172111-35ab5e5f5327
go.opentelemetry.io/collector/client v1.33.1-0.20250603105141-605011a1fea8
go.opentelemetry.io/collector/component v1.33.1-0.20250603105141-605011a1fea8
go.opentelemetry.io/collector/component/componenttest v0.127.1-0.20250603105141-605011a1fea8
Expand All @@ -26,6 +28,7 @@ require (
go.opentelemetry.io/collector/consumer/consumererror v0.127.1-0.20250603105141-605011a1fea8
go.opentelemetry.io/collector/exporter v0.127.1-0.20250603105141-605011a1fea8
go.opentelemetry.io/collector/exporter/exportertest v0.127.1-0.20250603105141-605011a1fea8
go.opentelemetry.io/collector/featuregate v1.33.1-0.20250603105141-605011a1fea8
go.opentelemetry.io/collector/pdata v1.33.1-0.20250603105141-605011a1fea8
go.opentelemetry.io/collector/pdata/testdata v0.127.1-0.20250603105141-605011a1fea8
go.uber.org/goleak v1.3.0
Expand Down Expand Up @@ -87,6 +90,9 @@ require (
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/twmb/franz-go/pkg/kmsg v1.11.2 // indirect
github.com/twmb/franz-go/pkg/sasl/kerberos v1.1.0 // indirect
github.com/twmb/franz-go/plugin/kzap v1.1.2 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
Expand All @@ -99,7 +105,6 @@ require (
go.opentelemetry.io/collector/exporter/xexporter v0.127.1-0.20250603105141-605011a1fea8 // indirect
go.opentelemetry.io/collector/extension v1.33.1-0.20250603105141-605011a1fea8 // indirect
go.opentelemetry.io/collector/extension/xextension v0.127.1-0.20250603105141-605011a1fea8 // indirect
go.opentelemetry.io/collector/featuregate v1.33.1-0.20250603105141-605011a1fea8 // indirect
go.opentelemetry.io/collector/internal/telemetry v0.127.1-0.20250603105141-605011a1fea8 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.127.1-0.20250603105141-605011a1fea8 // indirect
go.opentelemetry.io/collector/pipeline v0.127.1-0.20250603105141-605011a1fea8 // indirect
Expand Down
Loading
Loading