Closed sakulali closed 6 months ago
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself.
edit: I see why the PR is linked :)
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers
. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself.
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers
. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself.
This issue has been closed as inactive because it has been stale for 120 days with no activity.
Component(s)
internal/kafka
Is your feature request related to a problem? Please describe.
_Originally posted by @fatsheep9146 in https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/27289#discussion_r1343303663_
Currently, we have validation logic inside kafka configure authentication refer to configureSASL. In addition, there is similar validation logic between the
validateSASLConfig
andconfigureSASL
functions. We can define a common validation function for kafka authentication which can be reused bykafkametricsreceiver
,kafkareceiver
andkafkaexporter
, to make the validation and configuration semantics clearer, and to remove redundant validation logic.Describe the solution you'd like
ValidateAuthentication
,validateTLS
andvalidateSASL
for kafka authenticationfunc validateTLS(c configtls.TLSClientSetting) (*tls.Config, error) { tlsConfig, err := c.LoadTLSConfig() if err != nil { return nil, fmt.Errorf("error loading tls config: %w", err) }
}
func validateSASL(c SASLConfig) error { if c.Username == "" { return fmt.Errorf("auth.sasl.username is required") }
}
func configureSASL(config SASLConfig, saramaConfig *sarama.Config) error { if err := validateSASL(config); err != nil { return err }
}
func configureTLS(config configtls.TLSClientSetting, saramaConfig *sarama.Config) error { tlsConfig, err := validateTLS(config) if err != nil { return err }
}
// Validate checks if the exporter configuration is valid func (cfg *Config) Validate() error { // kafka exporter config validation ...... return ValidateAuthentication(cfg.Authentication) }