@@ -308,8 +308,6 @@ pub use crate::exporter::{
308308 OTEL_EXPORTER_OTLP_TIMEOUT_DEFAULT ,
309309} ;
310310
311- use opentelemetry_sdk:: ExportError ;
312-
313311/// Type to indicate the builder does not have a client set.
314312#[ derive( Debug , Default , Clone ) ]
315313pub struct NoExporterBuilderSet ;
@@ -337,104 +335,6 @@ pub use crate::exporter::tonic::{TonicConfig, TonicExporterBuilder};
337335#[ cfg( feature = "serialize" ) ]
338336use serde:: { Deserialize , Serialize } ;
339337
340- /// Wrap type for errors from this crate.
341- #[ derive( thiserror:: Error , Debug ) ]
342- pub enum Error {
343- /// Wrap error from [`tonic::transport::Error`]
344- #[ cfg( feature = "grpc-tonic" ) ]
345- #[ error( "transport error {0}" ) ]
346- Transport ( #[ from] tonic:: transport:: Error ) ,
347-
348- /// Wrap the [`tonic::codegen::http::uri::InvalidUri`] error
349- #[ cfg( any( feature = "grpc-tonic" , feature = "http-proto" , feature = "http-json" ) ) ]
350- #[ error( "invalid URI {0}" ) ]
351- InvalidUri ( #[ from] http:: uri:: InvalidUri ) ,
352-
353- /// Wrap type for [`tonic::Status`]
354- #[ cfg( feature = "grpc-tonic" ) ]
355- #[ error( "the grpc server returns error ({code}): {message}" ) ]
356- Status {
357- /// grpc status code
358- code : tonic:: Code ,
359- /// error message
360- message : String ,
361- } ,
362-
363- /// Http requests failed because no http client is provided.
364- #[ cfg( any( feature = "http-proto" , feature = "http-json" ) ) ]
365- #[ error(
366- "no http client, you must select one from features or provide your own implementation"
367- ) ]
368- NoHttpClient ,
369-
370- /// Http requests failed.
371- #[ cfg( any( feature = "http-proto" , feature = "http-json" ) ) ]
372- #[ error( "http request failed with {0}" ) ]
373- RequestFailed ( #[ from] opentelemetry_http:: HttpError ) ,
374-
375- /// The provided value is invalid in HTTP headers.
376- #[ cfg( any( feature = "grpc-tonic" , feature = "http-proto" , feature = "http-json" ) ) ]
377- #[ error( "http header value error {0}" ) ]
378- InvalidHeaderValue ( #[ from] http:: header:: InvalidHeaderValue ) ,
379-
380- /// The provided name is invalid in HTTP headers.
381- #[ cfg( any( feature = "grpc-tonic" , feature = "http-proto" , feature = "http-json" ) ) ]
382- #[ error( "http header name error {0}" ) ]
383- InvalidHeaderName ( #[ from] http:: header:: InvalidHeaderName ) ,
384-
385- /// Prost encode failed
386- #[ cfg( any(
387- feature = "http-proto" ,
388- all( feature = "http-json" , not( feature = "trace" ) )
389- ) ) ]
390- #[ error( "prost encoding error {0}" ) ]
391- EncodeError ( #[ from] prost:: EncodeError ) ,
392-
393- /// The lock in exporters has been poisoned.
394- #[ cfg( feature = "metrics" ) ]
395- #[ error( "the lock of the {0} has been poisoned" ) ]
396- PoisonedLock ( & ' static str ) ,
397-
398- /// Unsupported compression algorithm.
399- #[ error( "unsupported compression algorithm '{0}'" ) ]
400- UnsupportedCompressionAlgorithm ( String ) ,
401-
402- /// Feature required to use the specified compression algorithm.
403- #[ cfg( any( not( feature = "gzip-tonic" ) , not( feature = "zstd-tonic" ) ) ) ]
404- #[ error( "feature '{0}' is required to use the compression algorithm '{1}'" ) ]
405- FeatureRequiredForCompressionAlgorithm ( & ' static str , Compression ) ,
406- }
407-
408- #[ cfg( feature = "grpc-tonic" ) ]
409- impl From < tonic:: Status > for Error {
410- fn from ( status : tonic:: Status ) -> Error {
411- Error :: Status {
412- code : status. code ( ) ,
413- message : {
414- if !status. message ( ) . is_empty ( ) {
415- let mut result = ", detailed error message: " . to_string ( ) + status. message ( ) ;
416- if status. code ( ) == tonic:: Code :: Unknown {
417- let source = ( & status as & dyn std:: error:: Error )
418- . source ( )
419- . map ( |e| format ! ( "{:?}" , e) ) ;
420- result. push ( ' ' ) ;
421- result. push_str ( source. unwrap_or_default ( ) . as_ref ( ) ) ;
422- }
423- result
424- } else {
425- String :: new ( )
426- }
427- } ,
428- }
429- }
430- }
431-
432- impl ExportError for Error {
433- fn exporter_name ( & self ) -> & ' static str {
434- "otlp"
435- }
436- }
437-
438338/// The communication protocol to use when exporting data.
439339#[ cfg_attr( feature = "serialize" , derive( Deserialize , Serialize ) ) ]
440340#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
0 commit comments