You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Noticed an inconsistency in the Metric API regarding the init and try_init methods for instrument initialization. The documentation for init says that it would panic when validation fails, while try_init is expected to return a Result, allowing for error handling.
However, it appears that neither method behaves as documented. Specifically, the SDK implementation seems to suppress the Err variant, invariably returning an Ok variant after logging an error, and continues to provide a valid instrument. This should be potentially be classified as a bug.
Proposing the following changes to address this:
Modify the SDK implementation to return a NoOp instrument instead of an actual instrument when validation fails.
Additionally, need some inputs/suggestions of the below:
Considering that the Err variant is never returned, should we remove the try_init method?
Alternatively, should we retain both init and try_init, ensuring they adhere to the current documentation—where init panics on invalid input, and try_init returns a Result? This would place the onus on the user to either handle the results or accept the possibility of a panic.
The text was updated successfully, but these errors were encountered:
Noticed an inconsistency in the Metric API regarding the
init
andtry_init
methods for instrument initialization. The documentation for init says that it would panic when validation fails, while try_init is expected to return aResult
, allowing for error handling.However, it appears that neither method behaves as documented. Specifically, the SDK implementation seems to suppress the
Err
variant, invariably returning anOk
variant after logging an error, and continues to provide a valid instrument. This should be potentially be classified as a bug.Proposing the following changes to address this:
Additionally, need some inputs/suggestions of the below:
Err
variant is never returned, should we remove thetry_init
method?init
andtry_init
, ensuring they adhere to the current documentation—whereinit
panics on invalid input, andtry_init
returns aResult
? This would place the onus on the user to either handle the results or accept the possibility of a panic.The text was updated successfully, but these errors were encountered: