@@ -93,6 +93,9 @@ impl ZipkinExporterBuilder {
9393 }
9494
9595 /// Assign client implementation
96+ ///
97+ /// Note: Programmatically setting the timeout will override any value
98+ /// set via the environment variable `OTEL_EXPORTER_ZIPKIN_TIMEOUT`.
9699 pub fn with_http_client < T : HttpClient + ' static > ( mut self , client : T ) -> Self {
97100 self . client = Some ( Arc :: new ( client) ) ;
98101 self
@@ -105,6 +108,9 @@ impl ZipkinExporterBuilder {
105108 }
106109
107110 /// Assign the Zipkin collector endpoint
111+ ///
112+ /// Note: Programmatically setting this will override any value
113+ /// set via the environment variable `OTEL_EXPORTER_ZIPKIN_ENDPOINT`.
108114 pub fn with_collector_endpoint < T : Into < String > > ( mut self , endpoint : T ) -> Self {
109115 self . collector_endpoint = endpoint. into ( ) ;
110116 self
@@ -161,3 +167,29 @@ impl ExportError for Error {
161167 "zipkin"
162168 }
163169}
170+
171+ #[ cfg( test) ]
172+ mod tests {
173+ use super :: * ;
174+ use crate :: exporter:: env:: ENV_ENDPOINT ;
175+
176+ #[ test]
177+ fn test_priority_of_code_based_config_over_envs_for_endpoint ( ) {
178+ temp_env:: with_vars ( [ ( ENV_ENDPOINT , Some ( "http://127.0.0.1:1234" ) ) ] , || {
179+ let builder =
180+ ZipkinExporterBuilder :: default ( ) . with_collector_endpoint ( "http://127.0.0.1:2345" ) ;
181+ assert_eq ! ( builder. collector_endpoint, "http://127.0.0.1:2345" ) ;
182+ } ) ;
183+ }
184+
185+ #[ test]
186+ fn test_use_default_when_others_missing_for_endpoint ( ) {
187+ temp_env:: with_vars ( [ ( ENV_ENDPOINT , None :: < & str > ) ] , || {
188+ let builder = ZipkinExporterBuilder :: default ( ) ;
189+ assert_eq ! (
190+ builder. collector_endpoint,
191+ "http://127.0.0.1:9411/api/v2/spans"
192+ ) ;
193+ } ) ;
194+ }
195+ }
0 commit comments