-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Log an error for empty view criteria #4149
Comments
Why not returning an error as suggested per the specification? I would consider changing the declaration to: func NewView(criteria Instrument, mask Stream) (View, error) {
|
Returning an error means |
That is the reason we already log an error with the global logger. It makes sense to keep the pattern here. |
On the other hand, the exporter factory functions like I see Go as a quite verbose language when it comes to error handling. I do not feel that "fluent-like" API is idiomatic. The user can always create a helper that would handle the error (e.g. log, ignore, panic). |
I don't follow. You are suggesting that precedence from a different function from a different package from a different part of the setup should take precedence for |
That is only "one" reason out of three.
(in this order) |
* Log an error for an empty view Resolves #4149 * Add changelog entry
The specification recommends:
This is not treated as an error:
opentelemetry-go/sdk/metric/view.go
Lines 57 to 59 in b2246d5
An error should be logged to match the other existing error already logged by
NewView
:opentelemetry-go/sdk/metric/view.go
Lines 94 to 98 in b2246d5
Originally posted by @MrAlias in #3645 (comment)
The text was updated successfully, but these errors were encountered: