@@ -6,8 +6,7 @@ use http::Uri;
66use model:: endpoint:: Endpoint ;
77use opentelemetry_http:: HttpClient ;
88use opentelemetry_sdk:: error:: OTelSdkResult ;
9- use opentelemetry_sdk:: trace:: TraceError ;
10- use opentelemetry_sdk:: { trace, ExportError } ;
9+ use opentelemetry_sdk:: trace;
1110use std:: net:: { AddrParseError , SocketAddr } ;
1211use std:: sync:: Arc ;
1312
@@ -75,7 +74,7 @@ impl ZipkinExporterBuilder {
7574 /// Creates a new [ZipkinExporter] from this configuration.
7675 ///
7776 /// Returns error if the endpoint is not valid or if no http client is provided.
78- pub fn build ( self ) -> Result < ZipkinExporter , TraceError > {
77+ pub fn build ( self ) -> Result < ZipkinExporter , ExporterBuildError > {
7978 let endpoint = Endpoint :: new ( self . service_addr ) ;
8079
8180 if let Some ( client) = self . client {
@@ -84,18 +83,19 @@ impl ZipkinExporterBuilder {
8483 client,
8584 self . collector_endpoint
8685 . parse ( )
87- . map_err :: < Error , _ > ( Into :: into ) ?,
86+ . map_err ( ExporterBuildError :: InvalidUri ) ?,
8887 ) ;
8988 Ok ( exporter)
9089 } else {
91- Err ( Error :: NoHttpClient . into ( ) )
90+ Err ( ExporterBuildError :: NoHttpClient )
9291 }
9392 }
9493
9594 /// Assign client implementation
9695 ///
97- /// Note: Programmatically setting the timeout will override any value
98- /// set via the environment variable `OTEL_EXPORTER_ZIPKIN_TIMEOUT`.
96+ /// When using this method, the export timeout will depend on the provided
97+ /// client implementation and may not respect the timeout set via the
98+ /// environment variable `OTEL_EXPORTER_ZIPKIN_TIMEOUT`.
9999 pub fn with_http_client < T : HttpClient + ' static > ( mut self , client : T ) -> Self {
100100 self . client = Some ( Arc :: new ( client) ) ;
101101 self
@@ -140,32 +140,18 @@ impl trace::SpanExporter for ZipkinExporter {
140140/// Wrap type for errors from opentelemetry zipkin
141141#[ derive( thiserror:: Error , Debug ) ]
142142#[ non_exhaustive]
143- pub enum Error {
143+ pub enum ExporterBuildError {
144144 /// No http client implementation found. User should provide one or enable features.
145145 #[ error( "http client must be set, users can enable reqwest feature to use http client implementation within create" ) ]
146146 NoHttpClient ,
147147
148- /// Http requests failed
149- #[ error( "http request failed with {0}" ) ]
150- RequestFailed ( #[ from] http:: Error ) ,
151-
152148 /// The uri provided is invalid
153149 #[ error( "invalid uri" ) ]
154150 InvalidUri ( #[ from] http:: uri:: InvalidUri ) ,
155151
156152 /// The IP/socket address provided is invalid
157153 #[ error( "invalid address" ) ]
158154 InvalidAddress ( #[ from] AddrParseError ) ,
159-
160- /// Other errors
161- #[ error( "export error: {0}" ) ]
162- Other ( String ) ,
163- }
164-
165- impl ExportError for Error {
166- fn exporter_name ( & self ) -> & ' static str {
167- "zipkin"
168- }
169155}
170156
171157#[ cfg( test) ]
0 commit comments