@@ -6,8 +6,7 @@ use http::Uri;
6
6
use model:: endpoint:: Endpoint ;
7
7
use opentelemetry_http:: HttpClient ;
8
8
use opentelemetry_sdk:: error:: OTelSdkResult ;
9
- use opentelemetry_sdk:: trace:: TraceError ;
10
- use opentelemetry_sdk:: { trace, ExportError } ;
9
+ use opentelemetry_sdk:: trace;
11
10
use std:: net:: { AddrParseError , SocketAddr } ;
12
11
use std:: sync:: Arc ;
13
12
@@ -75,7 +74,7 @@ impl ZipkinExporterBuilder {
75
74
/// Creates a new [ZipkinExporter] from this configuration.
76
75
///
77
76
/// 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 > {
79
78
let endpoint = Endpoint :: new ( self . service_addr ) ;
80
79
81
80
if let Some ( client) = self . client {
@@ -84,18 +83,19 @@ impl ZipkinExporterBuilder {
84
83
client,
85
84
self . collector_endpoint
86
85
. parse ( )
87
- . map_err :: < Error , _ > ( Into :: into ) ?,
86
+ . map_err ( ExporterBuildError :: InvalidUri ) ?,
88
87
) ;
89
88
Ok ( exporter)
90
89
} else {
91
- Err ( Error :: NoHttpClient . into ( ) )
90
+ Err ( ExporterBuildError :: NoHttpClient )
92
91
}
93
92
}
94
93
95
94
/// Assign client implementation
96
95
///
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`.
99
99
pub fn with_http_client < T : HttpClient + ' static > ( mut self , client : T ) -> Self {
100
100
self . client = Some ( Arc :: new ( client) ) ;
101
101
self
@@ -140,32 +140,18 @@ impl trace::SpanExporter for ZipkinExporter {
140
140
/// Wrap type for errors from opentelemetry zipkin
141
141
#[ derive( thiserror:: Error , Debug ) ]
142
142
#[ non_exhaustive]
143
- pub enum Error {
143
+ pub enum ExporterBuildError {
144
144
/// No http client implementation found. User should provide one or enable features.
145
145
#[ error( "http client must be set, users can enable reqwest feature to use http client implementation within create" ) ]
146
146
NoHttpClient ,
147
147
148
- /// Http requests failed
149
- #[ error( "http request failed with {0}" ) ]
150
- RequestFailed ( #[ from] http:: Error ) ,
151
-
152
148
/// The uri provided is invalid
153
149
#[ error( "invalid uri" ) ]
154
150
InvalidUri ( #[ from] http:: uri:: InvalidUri ) ,
155
151
156
152
/// The IP/socket address provided is invalid
157
153
#[ error( "invalid address" ) ]
158
154
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
- }
169
155
}
170
156
171
157
#[ cfg( test) ]
0 commit comments