opentelemetry-rust
opentelemetry-rust copied to clipboard
When invalid combination of clients are used return appropriate Result instead of panic
Suggested here: https://github.com/open-telemetry/opentelemetry-rust/issues/2673#issuecomment-2672364656
It might be possible for the provider construction to check if an invalid pair of Processor+Exporter client is used and return an Error...As of now, wrong combinations are not detected until too late, where things panic.
eg:
provider.with_batch_exporter(exporter-with_unsupported_client_like_request) should return a Result. The Err should clearly indicate the reason for failure.
I'm interested in this issue, but
provider.with_batch_exporter(exporter-with_unsupported_client_like_request) should return a Result.
Currently all with_xxx methods return Builder itself. Do you think we should change all methods (or at least with_batch_exporter's) signature to return Result?
I was referring to the .build() method to detect invalid combination and return Result.
Related to this is https://github.com/open-telemetry/opentelemetry-rust/pull/2654 which only does Exporter specific one. This issue is about the overall provider..Some detailed analysis is to be done to find a good balance.
Thanks! I will take a look at the PR and consider how to do it in providers.
Some detailed analysis is to be done to find a good balance
Do you already have any concerns to change build() to return Result?
Do you already have any concerns to change build() to return Result?
No. I prefer build() returns Result. The part that needs design is what Error enum it would return. We probably need to create a new one, with the variants reflecting the possible ways it can fail. OR return string only as Error.