-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[configgrpc,exporter/otlp] Move gRPC client endpoint validation to configgrpc #14221
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
base: main
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #14221 will degrade performances by 32%Comparing
|
| Benchmark | BASE |
HEAD |
Change | |
|---|---|---|---|---|
| ⚡ | zstdWithConcurrency |
26.5 µs | 9.3 µs | ×2.8 |
| ⚡ | BenchmarkSplittingBasedOnItemCountHugeMetrics |
119.2 ms | 95.2 ms | +25.28% |
| ⚡ | BenchmarkSplittingBasedOnItemCountManyMetricsSlightlyAboveLimit |
112.8 ms | 81.3 ms | +38.74% |
| ❌ | BenchmarkLogsToProto |
3.1 µs | 4.3 µs | -28.68% |
| ❌ | BenchmarkTracesToProto |
4.7 µs | 6.3 µs | -25.72% |
| ❌ | BenchmarkTraceSizeBytes |
298.8 µs | 439.4 µs | -32% |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14221 +/- ##
==========================================
- Coverage 92.17% 92.15% -0.03%
==========================================
Files 668 668
Lines 41463 41466 +3
==========================================
- Hits 38219 38211 -8
- Misses 2212 2218 +6
- Partials 1032 1037 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The Coralogix exporter has some valid configurations in which the endpoint is empty https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/5b3e9b34d1a3fde3c0527e962284b56dae1c5b89/exporter/coralogixexporter/config.go#L121-L124 I could either fix the Coralogix exporter (I guess by moving this logic to a new unmarshal function) or make 'empty endpoint' a valid config, something like the following diff: diff --git a/config/configgrpc/configgrpc.go b/config/configgrpc/configgrpc.go
index 025970c6c..27cc037f5 100644
--- a/config/configgrpc/configgrpc.go
+++ b/config/configgrpc/configgrpc.go
@@ -234,23 +234,20 @@ func (cc *ClientConfig) Validate() error {
return nil
}
- endpoint := cc.sanitizedEndpoint()
- if endpoint == "" {
- return errors.New(`requires a non-empty "endpoint"`)
- }
-
- // Validate that the port is in the address
- _, port, err := net.SplitHostPort(endpoint)
- if err != nil {
- return err
- }
- if _, err := strconv.Atoi(port); err != nil {
- return fmt.Errorf(`invalid port "%v"`, port)
- }
+ if endpoint := cc.sanitizedEndpoint(); endpoint != "" {
+ // Validate that the port is in the address
+ _, port, err := net.SplitHostPort(endpoint)
+ if err != nil {
+ return err
+ }
+ if _, err := strconv.Atoi(port); err != nil {
+ return fmt.Errorf(`invalid port "%v"`, port)
+ }
- if cc.BalancerName != "" {
- if balancer.Get(cc.BalancerName) == nil {
- return fmt.Errorf("invalid balancer_name: %s", cc.BalancerName)
+ if cc.BalancerName != "" {
+ if balancer.Get(cc.BalancerName) == nil {
+ return fmt.Errorf("invalid balancer_name: %s", cc.BalancerName)
+ }
}
}@iblancasa what do you think? |
|
Yes. It is fine as soon as the configuration for users doesn't change |
|
@iblancasa I filed open-telemetry/opentelemetry-collector-contrib/pull/44730 to unblock this PR, mind reviewing? |
Description
Moves validation of gRPC endpoint from OTLP exporter to configgrpc
Link to tracking issue
Fixes #10451