Skip to content

Commit 5cd6c1b

Browse files
authored
[receiver/kafka] Remove deprecated legacy topic and encoding (open-telemetry#44568)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This PR removes the deprecated topic and encoding config <!--Please delete paragraphs that you did not use before submitting.-->
1 parent f438958 commit 5cd6c1b

File tree

4 files changed

+27
-171
lines changed

4 files changed

+27
-171
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: receiver/kafka
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Remove deprecated topic and encoding
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [44568]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [user]

receiver/kafkareceiver/config.go

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,6 @@ type Config struct {
3434
// Profiles holds configuration about how profiles should be consumed.
3535
Profiles TopicEncodingConfig `mapstructure:"profiles"`
3636

37-
// Topic holds the name of the Kafka topic from which to consume data.
38-
//
39-
// Topic has no default. If explicitly specified, it will take precedence
40-
// over the default values of Logs.Topic, Traces.Topic, and Metrics.Topic.
41-
//
42-
// Deprecated [v0.124.0]: Use Logs.Topic, Traces.Topic, and Metrics.Topic.
43-
Topic string `mapstructure:"topic"`
44-
45-
// Encoding holds the expected encoding of messages (default "otlp_proto")
46-
//
47-
// Encoding has no default. If explicitly specified, it will take precedence
48-
// over the default values of Logs.Encoding, Traces.Encoding, and
49-
// Metrics.Encoding.
50-
//
51-
// Deprecated [v0.124.0]: Use Logs.Encoding, Traces.Encoding, and
52-
// Metrics.Encoding.
53-
Encoding string `mapstructure:"encoding"`
54-
5537
// MessageMarking controls the way the messages are marked as consumed.
5638
MessageMarking MessageMarking `mapstructure:"message_marking"`
5739

@@ -70,41 +52,6 @@ func (c *Config) Unmarshal(conf *confmap.Conf) error {
7052
if err := conf.Unmarshal(c); err != nil {
7153
return err
7254
}
73-
// Check if deprecated fields have been explicitly set,
74-
// in which case they should be used instead of signal-
75-
// specific defaults.
76-
var zeroConfig Config
77-
if err := conf.Unmarshal(&zeroConfig); err != nil {
78-
return err
79-
}
80-
if c.Topic != "" {
81-
if zeroConfig.Logs.Topic == "" {
82-
c.Logs.Topic = c.Topic
83-
}
84-
if zeroConfig.Metrics.Topic == "" {
85-
c.Metrics.Topic = c.Topic
86-
}
87-
if zeroConfig.Traces.Topic == "" {
88-
c.Traces.Topic = c.Topic
89-
}
90-
if zeroConfig.Profiles.Topic == "" {
91-
c.Profiles.Topic = c.Topic
92-
}
93-
}
94-
if c.Encoding != "" {
95-
if zeroConfig.Logs.Encoding == "" {
96-
c.Logs.Encoding = c.Encoding
97-
}
98-
if zeroConfig.Metrics.Encoding == "" {
99-
c.Metrics.Encoding = c.Encoding
100-
}
101-
if zeroConfig.Traces.Encoding == "" {
102-
c.Traces.Encoding = c.Encoding
103-
}
104-
if zeroConfig.Profiles.Encoding == "" {
105-
c.Profiles.Encoding = c.Encoding
106-
}
107-
}
10855

10956
// Set OnPermanentError default value to inherit from OnError for backward compatibility
11057
// Only if OnPermanentError was not explicitly set in the config

receiver/kafkareceiver/config_test.go

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -31,104 +31,6 @@ func TestLoadConfig(t *testing.T) {
3131
expected component.Config
3232
expectedErr error
3333
}{
34-
{
35-
id: component.NewIDWithName(metadata.Type, ""),
36-
expected: &Config{
37-
ClientConfig: func() configkafka.ClientConfig {
38-
config := configkafka.NewDefaultClientConfig()
39-
config.Brokers = []string{"foo:123", "bar:456"}
40-
config.ResolveCanonicalBootstrapServersOnly = true
41-
config.ClientID = "the_client_id"
42-
return config
43-
}(),
44-
ConsumerConfig: func() configkafka.ConsumerConfig {
45-
config := configkafka.NewDefaultConsumerConfig()
46-
config.GroupID = "the_group_id"
47-
return config
48-
}(),
49-
Logs: TopicEncodingConfig{
50-
Topic: "spans",
51-
Encoding: "otlp_proto",
52-
},
53-
Metrics: TopicEncodingConfig{
54-
Topic: "spans",
55-
Encoding: "otlp_proto",
56-
},
57-
Traces: TopicEncodingConfig{
58-
Topic: "spans",
59-
Encoding: "otlp_proto",
60-
},
61-
Profiles: TopicEncodingConfig{
62-
Topic: "spans",
63-
Encoding: "otlp_proto",
64-
},
65-
Topic: "spans",
66-
ErrorBackOff: configretry.BackOffConfig{
67-
Enabled: false,
68-
},
69-
Telemetry: TelemetryConfig{
70-
Metrics: MetricsConfig{
71-
KafkaReceiverRecordsDelay: MetricConfig{
72-
Enabled: true,
73-
},
74-
},
75-
},
76-
},
77-
},
78-
{
79-
id: component.NewIDWithName(metadata.Type, "legacy_topic"),
80-
expected: &Config{
81-
ClientConfig: configkafka.NewDefaultClientConfig(),
82-
ConsumerConfig: configkafka.NewDefaultConsumerConfig(),
83-
Logs: TopicEncodingConfig{
84-
Topic: "legacy_topic",
85-
Encoding: "otlp_proto",
86-
},
87-
Metrics: TopicEncodingConfig{
88-
Topic: "metrics_topic",
89-
Encoding: "otlp_proto",
90-
},
91-
Traces: TopicEncodingConfig{
92-
Topic: "legacy_topic",
93-
Encoding: "otlp_proto",
94-
},
95-
Profiles: TopicEncodingConfig{
96-
Topic: "legacy_topic",
97-
Encoding: "otlp_proto",
98-
},
99-
Topic: "legacy_topic",
100-
ErrorBackOff: configretry.BackOffConfig{
101-
Enabled: false,
102-
},
103-
},
104-
},
105-
{
106-
id: component.NewIDWithName(metadata.Type, "legacy_encoding"),
107-
expected: &Config{
108-
ClientConfig: configkafka.NewDefaultClientConfig(),
109-
ConsumerConfig: configkafka.NewDefaultConsumerConfig(),
110-
Logs: TopicEncodingConfig{
111-
Topic: "otlp_logs",
112-
Encoding: "legacy_encoding",
113-
},
114-
Metrics: TopicEncodingConfig{
115-
Topic: "otlp_metrics",
116-
Encoding: "metrics_encoding",
117-
},
118-
Traces: TopicEncodingConfig{
119-
Topic: "otlp_spans",
120-
Encoding: "legacy_encoding",
121-
},
122-
Profiles: TopicEncodingConfig{
123-
Topic: "otlp_profiles",
124-
Encoding: "legacy_encoding",
125-
},
126-
Encoding: "legacy_encoding",
127-
ErrorBackOff: configretry.BackOffConfig{
128-
Enabled: false,
129-
},
130-
},
131-
},
13234
{
13335
id: component.NewIDWithName(metadata.Type, "logs"),
13436
expected: &Config{

receiver/kafkareceiver/testdata/config.yaml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
1-
kafka:
2-
topic: spans
3-
brokers:
4-
- "foo:123"
5-
- "bar:456"
6-
resolve_canonical_bootstrap_servers_only: true
7-
client_id: the_client_id
8-
group_id: the_group_id
9-
telemetry:
10-
metrics:
11-
kafka_receiver_records_delay:
12-
enabled: true
13-
kafka/legacy_topic:
14-
topic: legacy_topic
15-
metrics:
16-
topic: metrics_topic
17-
kafka/legacy_encoding:
18-
encoding: legacy_encoding
19-
metrics:
20-
encoding: metrics_encoding
211
kafka/logs:
222
logs:
233
topic: logs

0 commit comments

Comments
 (0)