1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use crate::ExportConfig;
use tonic::metadata::MetadataMap;
#[cfg(feature = "tls")]
use tonic::transport::ClientTlsConfig;
#[derive(Debug, Default)]
pub struct TonicConfig {
pub metadata: Option<MetadataMap>,
#[cfg(feature = "tls")]
pub tls_config: Option<ClientTlsConfig>,
}
#[derive(Default, Debug)]
pub struct TonicExporterBuilder {
pub(crate) exporter_config: ExportConfig,
pub(crate) tonic_config: TonicConfig,
pub(crate) channel: Option<tonic::transport::Channel>,
}
impl TonicExporterBuilder {
#[cfg(feature = "tls")]
pub fn with_tls_config(mut self, tls_config: ClientTlsConfig) -> Self {
self.tonic_config.tls_config = Some(tls_config);
self
}
pub fn with_metadata(mut self, metadata: MetadataMap) -> Self {
self.tonic_config.metadata = Some(metadata);
self
}
pub fn with_channel(mut self, channel: tonic::transport::Channel) -> Self {
self.channel = Some(channel);
self
}
}