File tree Expand file tree Collapse file tree 2 files changed +8
-15
lines changed
rust/otap-dataflow/crates Expand file tree Collapse file tree 2 files changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -662,17 +662,6 @@ impl Default for TelemetryConfig {
662662 }
663663}
664664
665- impl TelemetryConfig {
666- /// Returns `true` if there are any metric readers configured.
667- ///
668- /// This can be used to conditionally initialize OpenTelemetry SDK components
669- /// only when telemetry export is actually configured.
670- #[ must_use]
671- pub fn has_metric_readers ( & self ) -> bool {
672- !self . metrics . readers . is_empty ( )
673- }
674- }
675-
676665fn default_reporting_channel_size ( ) -> usize {
677666 100
678667}
@@ -689,6 +678,13 @@ pub struct MetricsConfig {
689678 pub readers : Vec < MetricsReaderConfig > ,
690679}
691680
681+ impl MetricsConfig {
682+ /// Returns `true` if there are any metric readers configured.
683+ pub fn has_readers ( & self ) -> bool {
684+ !self . readers . is_empty ( )
685+ }
686+ }
687+
692688/// Opentelemetry Metrics Reader configuration.
693689#[ derive( Debug , Clone , Serialize , JsonSchema ) ]
694690#[ serde( rename_all = "lowercase" ) ]
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ impl<PData: 'static + Clone + Send + Sync + std::fmt::Debug> Controller<PData> {
9292 } ) ?;
9393
9494 // Start the metrics dispatcher only if there are metric readers configured.
95- let metrics_dispatcher_handle = if telemetry_config. has_metric_readers ( ) {
95+ let metrics_dispatcher_handle = if telemetry_config. metrics . has_readers ( ) {
9696 Some ( spawn_thread_local_task (
9797 "metrics-dispatcher" ,
9898 move |cancellation_token| metrics_dispatcher. run_dispatch_loop ( cancellation_token) ,
@@ -245,12 +245,9 @@ impl<PData: 'static + Clone + Send + Sync + std::fmt::Debug> Controller<PData> {
245245 // All pipelines have finished; shut down the admin HTTP server and metric aggregator gracefully.
246246 admin_server_handle. shutdown_and_join ( ) ?;
247247 metrics_agg_handle. shutdown_and_join ( ) ?;
248-
249- // Only shutdown the metrics dispatcher if it was created.
250248 if let Some ( handle) = metrics_dispatcher_handle {
251249 handle. shutdown_and_join ( ) ?;
252250 }
253-
254251 obs_state_join_handle. shutdown_and_join ( ) ?;
255252 opentelemetry_client. shutdown ( ) ?;
256253
You can’t perform that action at this time.
0 commit comments