open-telemetry / opentelemetry-go

OpenTelemetry Go API and SDK
https://opentelemetry.io/docs/languages/go
Apache License 2.0
5.29k stars 1.08k forks source link

Do not duplicate validation of exponential histogram configuration #4406

Closed MrAlias closed 1 year ago

MrAlias commented 1 year ago

The validation of the exponential histogram, already performed in sdk/metric/aggregation, is duplicated in the exponential histogram implementation (sdk/metric/internal/aggregate). The view will use the Err from ExponentialHistogram in sdk/metric/aggregation to validate the configuration prior to getting here:

https://github.com/open-telemetry/opentelemetry-go/blob/ab61991465d957db46e4f8a78b1dcf84546bdef8/sdk/metric/view.go#L98-L105

Having a duplicate validation of the configuration here will lead to two parts of the code-base doing the same thing and introduce the possibility for many bugs.

Similar to the explicit bucket histogram, we should just assume the configuration passed here is valid and proceed.

_Originally posted by @MrAlias in https://github.com/open-telemetry/opentelemetry-go/pull/4245#discussion_r1272494713_

MrAlias commented 1 year ago

normalizeConfig was removed in the original PR.