@@ -28,31 +28,30 @@ pub trait CoreTelemetry {
2828 fn fetch_buffered_logs ( & self ) -> Vec < CoreLog > ;
2929}
3030
31- /// Telemetry configuration options. Construct with [TelemetryOptionsBuilder ]
32- #[ derive( Clone , derive_builder :: Builder ) ]
31+ /// Telemetry configuration options. Construct with [TelemetryOptions::builder ]
32+ #[ derive( Clone , bon :: Builder ) ]
3333#[ non_exhaustive]
3434pub struct TelemetryOptions {
3535 /// Optional logger - set as None to disable.
36- #[ builder( setter ( into, strip_option ) , default ) ]
36+ #[ builder( into) ]
3737 pub logging : Option < Logger > ,
3838 /// Optional metrics exporter - set as None to disable.
39- #[ builder( setter ( into, strip_option ) , default ) ]
39+ #[ builder( into) ]
4040 pub metrics : Option < Arc < dyn CoreMeter > > ,
4141 /// If set true (the default) explicitly attach a `service_name` label to all metrics. Turn this
4242 /// off if your collection system supports the `target_info` metric from the OpenMetrics spec.
4343 /// For more, see
4444 /// [here](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#supporting-target-metadata-in-both-push-based-and-pull-based-systems)
45- #[ builder( default = " true" ) ]
45+ #[ builder( default = true ) ]
4646 pub attach_service_name : bool ,
4747 /// A prefix to be applied to all core-created metrics. Defaults to "temporal_".
48- #[ builder( default = " METRIC_PREFIX.to_string()" ) ]
48+ #[ builder( default = METRIC_PREFIX . to_string( ) ) ]
4949 pub metric_prefix : String ,
5050 /// If provided, logging config will be ignored and this explicit subscriber will be used for
5151 /// all logging and traces.
52- #[ builder( setter( strip_option) , default ) ]
5352 pub subscriber_override : Option < Arc < dyn Subscriber + Send + Sync > > ,
5453 /// See [TaskQueueLabelStrategy].
55- #[ builder( default = " TaskQueueLabelStrategy::UseNormal" ) ]
54+ #[ builder( default = TaskQueueLabelStrategy :: UseNormal ) ]
5655 pub task_queue_label_strategy : TaskQueueLabelStrategy ,
5756}
5857impl Debug for TelemetryOptions {
@@ -96,19 +95,19 @@ pub enum TaskQueueLabelStrategy {
9695}
9796
9897/// Options for exporting to an OpenTelemetry Collector
99- #[ derive( Debug , Clone , derive_builder :: Builder ) ]
98+ #[ derive( Debug , Clone , bon :: Builder ) ]
10099pub struct OtelCollectorOptions {
101100 /// The url of the OTel collector to export telemetry and metrics to. Lang SDK should also
102101 /// export to this same collector.
103102 pub url : Url ,
104103 /// Optional set of HTTP headers to send to the Collector, e.g for authentication.
105- #[ builder( default = " HashMap::new()" ) ]
104+ #[ builder( default = HashMap :: new( ) ) ]
106105 pub headers : HashMap < String , String > ,
107106 /// Optionally specify how frequently metrics should be exported. Defaults to 1 second.
108- #[ builder( default = " Duration::from_secs(1)" ) ]
107+ #[ builder( default = Duration :: from_secs( 1 ) ) ]
109108 pub metric_periodicity : Duration ,
110109 /// Specifies the aggregation temporality for metric export. Defaults to cumulative.
111- #[ builder( default = " MetricTemporality::Cumulative" ) ]
110+ #[ builder( default = MetricTemporality :: Cumulative ) ]
112111 pub metric_temporality : MetricTemporality ,
113112 /// A map of tags to be applied to all metrics
114113 #[ builder( default ) ]
@@ -120,12 +119,12 @@ pub struct OtelCollectorOptions {
120119 #[ builder( default ) ]
121120 pub histogram_bucket_overrides : HistogramBucketOverrides ,
122121 /// Protocol to use for communication with the collector
123- #[ builder( default = " OtlpProtocol::Grpc" ) ]
122+ #[ builder( default = OtlpProtocol :: Grpc ) ]
124123 pub protocol : OtlpProtocol ,
125124}
126125
127126/// Options for exporting metrics to Prometheus
128- #[ derive( Debug , Clone , derive_builder :: Builder ) ]
127+ #[ derive( Debug , Clone , bon :: Builder ) ]
129128pub struct PrometheusExporterOptions {
130129 pub socket_addr : SocketAddr ,
131130 // A map of tags to be applied to all metrics
@@ -205,7 +204,7 @@ pub enum OtlpProtocol {
205204
206205impl Default for TelemetryOptions {
207206 fn default ( ) -> Self {
208- TelemetryOptionsBuilder :: default ( ) . build ( ) . unwrap ( )
207+ TelemetryOptions :: builder ( ) . build ( )
209208 }
210209}
211210
0 commit comments