Skip to main content

datafusion_distributed/observability/generated/
observability.rs

1// This file is @generated by prost-build.
2#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3pub struct PingRequest {}
4#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5pub struct PingResponse {
6    #[prost(uint32, tag = "1")]
7    pub value: u32,
8}
9#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
10pub struct GetTaskProgressRequest {}
11/// Progress information for a single task
12#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
13pub struct TaskProgress {
14    #[prost(message, optional, tag = "1")]
15    pub task_key: ::core::option::Option<crate::worker::generated::worker::TaskKey>,
16    #[prost(uint64, tag = "2")]
17    pub total_partitions: u64,
18    #[prost(uint64, tag = "3")]
19    pub completed_partitions: u64,
20    #[prost(enumeration = "TaskStatus", tag = "4")]
21    pub status: i32,
22    #[prost(uint64, tag = "5")]
23    pub output_rows: u64,
24}
25/// Worker-level system metrics
26#[derive(Clone, Copy, PartialEq, ::prost::Message)]
27pub struct WorkerMetrics {
28    #[prost(uint64, tag = "1")]
29    pub rss_bytes: u64,
30    #[prost(double, tag = "2")]
31    pub cpu_usage_percent: f64,
32}
33#[derive(Clone, PartialEq, ::prost::Message)]
34pub struct GetTaskProgressResponse {
35    #[prost(message, repeated, tag = "1")]
36    pub tasks: ::prost::alloc::vec::Vec<TaskProgress>,
37    #[prost(message, optional, tag = "2")]
38    pub worker_metrics: ::core::option::Option<WorkerMetrics>,
39}
40#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
41pub struct GetClusterWorkersRequest {}
42#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
43pub struct GetClusterWorkersResponse {
44    #[prost(string, repeated, tag = "1")]
45    pub worker_urls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
46}
47#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
48#[repr(i32)]
49pub enum TaskStatus {
50    Unspecified = 0,
51    Running = 1,
52}
53impl TaskStatus {
54    /// String value of the enum field names used in the ProtoBuf definition.
55    ///
56    /// The values are not transformed in any way and thus are considered stable
57    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
58    pub fn as_str_name(&self) -> &'static str {
59        match self {
60            Self::Unspecified => "TASK_STATUS_UNSPECIFIED",
61            Self::Running => "TASK_STATUS_RUNNING",
62        }
63    }
64    /// Creates an enum from field names used in the ProtoBuf definition.
65    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
66        match value {
67            "TASK_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
68            "TASK_STATUS_RUNNING" => Some(Self::Running),
69            _ => None,
70        }
71    }
72}
73/// Generated client implementations.
74pub mod observability_service_client {
75    #![allow(
76        unused_variables,
77        dead_code,
78        missing_docs,
79        clippy::wildcard_imports,
80        clippy::let_unit_value
81    )]
82    use tonic::codegen::http::Uri;
83    use tonic::codegen::*;
84    #[derive(Debug, Clone)]
85    pub struct ObservabilityServiceClient<T> {
86        inner: tonic::client::Grpc<T>,
87    }
88    impl ObservabilityServiceClient<tonic::transport::Channel> {
89        /// Attempt to create a new client by connecting to a given endpoint.
90        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
91        where
92            D: TryInto<tonic::transport::Endpoint>,
93            D::Error: Into<StdError>,
94        {
95            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
96            Ok(Self::new(conn))
97        }
98    }
99    impl<T> ObservabilityServiceClient<T>
100    where
101        T: tonic::client::GrpcService<tonic::body::Body>,
102        T::Error: Into<StdError>,
103        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
104        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
105    {
106        pub fn new(inner: T) -> Self {
107            let inner = tonic::client::Grpc::new(inner);
108            Self { inner }
109        }
110        pub fn with_origin(inner: T, origin: Uri) -> Self {
111            let inner = tonic::client::Grpc::with_origin(inner, origin);
112            Self { inner }
113        }
114        pub fn with_interceptor<F>(
115            inner: T,
116            interceptor: F,
117        ) -> ObservabilityServiceClient<InterceptedService<T, F>>
118        where
119            F: tonic::service::Interceptor,
120            T::ResponseBody: Default,
121            T: tonic::codegen::Service<
122                    http::Request<tonic::body::Body>,
123                    Response = http::Response<
124                        <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
125                    >,
126                >,
127            <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
128                Into<StdError> + std::marker::Send + std::marker::Sync,
129        {
130            ObservabilityServiceClient::new(InterceptedService::new(inner, interceptor))
131        }
132        /// Compress requests with the given encoding.
133        ///
134        /// This requires the server to support it otherwise it might respond with an
135        /// error.
136        #[must_use]
137        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
138            self.inner = self.inner.send_compressed(encoding);
139            self
140        }
141        /// Enable decompressing responses.
142        #[must_use]
143        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
144            self.inner = self.inner.accept_compressed(encoding);
145            self
146        }
147        /// Limits the maximum size of a decoded message.
148        ///
149        /// Default: `4MB`
150        #[must_use]
151        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
152            self.inner = self.inner.max_decoding_message_size(limit);
153            self
154        }
155        /// Limits the maximum size of an encoded message.
156        ///
157        /// Default: `usize::MAX`
158        #[must_use]
159        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
160            self.inner = self.inner.max_encoding_message_size(limit);
161            self
162        }
163        pub async fn ping(
164            &mut self,
165            request: impl tonic::IntoRequest<super::PingRequest>,
166        ) -> std::result::Result<tonic::Response<super::PingResponse>, tonic::Status> {
167            self.inner.ready().await.map_err(|e| {
168                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
169            })?;
170            let codec = tonic_prost::ProstCodec::default();
171            let path =
172                http::uri::PathAndQuery::from_static("/observability.ObservabilityService/Ping");
173            let mut req = request.into_request();
174            req.extensions_mut().insert(GrpcMethod::new(
175                "observability.ObservabilityService",
176                "Ping",
177            ));
178            self.inner.unary(req, path, codec).await
179        }
180        pub async fn get_task_progress(
181            &mut self,
182            request: impl tonic::IntoRequest<super::GetTaskProgressRequest>,
183        ) -> std::result::Result<tonic::Response<super::GetTaskProgressResponse>, tonic::Status>
184        {
185            self.inner.ready().await.map_err(|e| {
186                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
187            })?;
188            let codec = tonic_prost::ProstCodec::default();
189            let path = http::uri::PathAndQuery::from_static(
190                "/observability.ObservabilityService/GetTaskProgress",
191            );
192            let mut req = request.into_request();
193            req.extensions_mut().insert(GrpcMethod::new(
194                "observability.ObservabilityService",
195                "GetTaskProgress",
196            ));
197            self.inner.unary(req, path, codec).await
198        }
199        pub async fn get_cluster_workers(
200            &mut self,
201            request: impl tonic::IntoRequest<super::GetClusterWorkersRequest>,
202        ) -> std::result::Result<tonic::Response<super::GetClusterWorkersResponse>, tonic::Status>
203        {
204            self.inner.ready().await.map_err(|e| {
205                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
206            })?;
207            let codec = tonic_prost::ProstCodec::default();
208            let path = http::uri::PathAndQuery::from_static(
209                "/observability.ObservabilityService/GetClusterWorkers",
210            );
211            let mut req = request.into_request();
212            req.extensions_mut().insert(GrpcMethod::new(
213                "observability.ObservabilityService",
214                "GetClusterWorkers",
215            ));
216            self.inner.unary(req, path, codec).await
217        }
218    }
219}
220/// Generated server implementations.
221pub mod observability_service_server {
222    #![allow(
223        unused_variables,
224        dead_code,
225        missing_docs,
226        clippy::wildcard_imports,
227        clippy::let_unit_value
228    )]
229    use tonic::codegen::*;
230    /// Generated trait containing gRPC methods that should be implemented for use with ObservabilityServiceServer.
231    #[async_trait]
232    pub trait ObservabilityService: std::marker::Send + std::marker::Sync + 'static {
233        async fn ping(
234            &self,
235            request: tonic::Request<super::PingRequest>,
236        ) -> std::result::Result<tonic::Response<super::PingResponse>, tonic::Status>;
237        async fn get_task_progress(
238            &self,
239            request: tonic::Request<super::GetTaskProgressRequest>,
240        ) -> std::result::Result<tonic::Response<super::GetTaskProgressResponse>, tonic::Status>;
241        async fn get_cluster_workers(
242            &self,
243            request: tonic::Request<super::GetClusterWorkersRequest>,
244        ) -> std::result::Result<tonic::Response<super::GetClusterWorkersResponse>, tonic::Status>;
245    }
246    #[derive(Debug)]
247    pub struct ObservabilityServiceServer<T> {
248        inner: Arc<T>,
249        accept_compression_encodings: EnabledCompressionEncodings,
250        send_compression_encodings: EnabledCompressionEncodings,
251        max_decoding_message_size: Option<usize>,
252        max_encoding_message_size: Option<usize>,
253    }
254    impl<T> ObservabilityServiceServer<T> {
255        pub fn new(inner: T) -> Self {
256            Self::from_arc(Arc::new(inner))
257        }
258        pub fn from_arc(inner: Arc<T>) -> Self {
259            Self {
260                inner,
261                accept_compression_encodings: Default::default(),
262                send_compression_encodings: Default::default(),
263                max_decoding_message_size: None,
264                max_encoding_message_size: None,
265            }
266        }
267        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
268        where
269            F: tonic::service::Interceptor,
270        {
271            InterceptedService::new(Self::new(inner), interceptor)
272        }
273        /// Enable decompressing requests with the given encoding.
274        #[must_use]
275        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
276            self.accept_compression_encodings.enable(encoding);
277            self
278        }
279        /// Compress responses with the given encoding, if the client supports it.
280        #[must_use]
281        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
282            self.send_compression_encodings.enable(encoding);
283            self
284        }
285        /// Limits the maximum size of a decoded message.
286        ///
287        /// Default: `4MB`
288        #[must_use]
289        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
290            self.max_decoding_message_size = Some(limit);
291            self
292        }
293        /// Limits the maximum size of an encoded message.
294        ///
295        /// Default: `usize::MAX`
296        #[must_use]
297        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
298            self.max_encoding_message_size = Some(limit);
299            self
300        }
301    }
302    impl<T, B> tonic::codegen::Service<http::Request<B>> for ObservabilityServiceServer<T>
303    where
304        T: ObservabilityService,
305        B: Body + std::marker::Send + 'static,
306        B::Error: Into<StdError> + std::marker::Send + 'static,
307    {
308        type Response = http::Response<tonic::body::Body>;
309        type Error = std::convert::Infallible;
310        type Future = BoxFuture<Self::Response, Self::Error>;
311        fn poll_ready(
312            &mut self,
313            _cx: &mut Context<'_>,
314        ) -> Poll<std::result::Result<(), Self::Error>> {
315            Poll::Ready(Ok(()))
316        }
317        fn call(&mut self, req: http::Request<B>) -> Self::Future {
318            match req.uri().path() {
319                "/observability.ObservabilityService/Ping" => {
320                    #[allow(non_camel_case_types)]
321                    struct PingSvc<T: ObservabilityService>(pub Arc<T>);
322                    impl<T: ObservabilityService> tonic::server::UnaryService<super::PingRequest> for PingSvc<T> {
323                        type Response = super::PingResponse;
324                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
325                        fn call(
326                            &mut self,
327                            request: tonic::Request<super::PingRequest>,
328                        ) -> Self::Future {
329                            let inner = Arc::clone(&self.0);
330                            let fut = async move {
331                                <T as ObservabilityService>::ping(&inner, request).await
332                            };
333                            Box::pin(fut)
334                        }
335                    }
336                    let accept_compression_encodings = self.accept_compression_encodings;
337                    let send_compression_encodings = self.send_compression_encodings;
338                    let max_decoding_message_size = self.max_decoding_message_size;
339                    let max_encoding_message_size = self.max_encoding_message_size;
340                    let inner = self.inner.clone();
341                    let fut = async move {
342                        let method = PingSvc(inner);
343                        let codec = tonic_prost::ProstCodec::default();
344                        let mut grpc = tonic::server::Grpc::new(codec)
345                            .apply_compression_config(
346                                accept_compression_encodings,
347                                send_compression_encodings,
348                            )
349                            .apply_max_message_size_config(
350                                max_decoding_message_size,
351                                max_encoding_message_size,
352                            );
353                        let res = grpc.unary(method, req).await;
354                        Ok(res)
355                    };
356                    Box::pin(fut)
357                }
358                "/observability.ObservabilityService/GetTaskProgress" => {
359                    #[allow(non_camel_case_types)]
360                    struct GetTaskProgressSvc<T: ObservabilityService>(pub Arc<T>);
361                    impl<T: ObservabilityService>
362                        tonic::server::UnaryService<super::GetTaskProgressRequest>
363                        for GetTaskProgressSvc<T>
364                    {
365                        type Response = super::GetTaskProgressResponse;
366                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
367                        fn call(
368                            &mut self,
369                            request: tonic::Request<super::GetTaskProgressRequest>,
370                        ) -> Self::Future {
371                            let inner = Arc::clone(&self.0);
372                            let fut = async move {
373                                <T as ObservabilityService>::get_task_progress(&inner, request)
374                                    .await
375                            };
376                            Box::pin(fut)
377                        }
378                    }
379                    let accept_compression_encodings = self.accept_compression_encodings;
380                    let send_compression_encodings = self.send_compression_encodings;
381                    let max_decoding_message_size = self.max_decoding_message_size;
382                    let max_encoding_message_size = self.max_encoding_message_size;
383                    let inner = self.inner.clone();
384                    let fut = async move {
385                        let method = GetTaskProgressSvc(inner);
386                        let codec = tonic_prost::ProstCodec::default();
387                        let mut grpc = tonic::server::Grpc::new(codec)
388                            .apply_compression_config(
389                                accept_compression_encodings,
390                                send_compression_encodings,
391                            )
392                            .apply_max_message_size_config(
393                                max_decoding_message_size,
394                                max_encoding_message_size,
395                            );
396                        let res = grpc.unary(method, req).await;
397                        Ok(res)
398                    };
399                    Box::pin(fut)
400                }
401                "/observability.ObservabilityService/GetClusterWorkers" => {
402                    #[allow(non_camel_case_types)]
403                    struct GetClusterWorkersSvc<T: ObservabilityService>(pub Arc<T>);
404                    impl<T: ObservabilityService>
405                        tonic::server::UnaryService<super::GetClusterWorkersRequest>
406                        for GetClusterWorkersSvc<T>
407                    {
408                        type Response = super::GetClusterWorkersResponse;
409                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
410                        fn call(
411                            &mut self,
412                            request: tonic::Request<super::GetClusterWorkersRequest>,
413                        ) -> Self::Future {
414                            let inner = Arc::clone(&self.0);
415                            let fut = async move {
416                                <T as ObservabilityService>::get_cluster_workers(&inner, request)
417                                    .await
418                            };
419                            Box::pin(fut)
420                        }
421                    }
422                    let accept_compression_encodings = self.accept_compression_encodings;
423                    let send_compression_encodings = self.send_compression_encodings;
424                    let max_decoding_message_size = self.max_decoding_message_size;
425                    let max_encoding_message_size = self.max_encoding_message_size;
426                    let inner = self.inner.clone();
427                    let fut = async move {
428                        let method = GetClusterWorkersSvc(inner);
429                        let codec = tonic_prost::ProstCodec::default();
430                        let mut grpc = tonic::server::Grpc::new(codec)
431                            .apply_compression_config(
432                                accept_compression_encodings,
433                                send_compression_encodings,
434                            )
435                            .apply_max_message_size_config(
436                                max_decoding_message_size,
437                                max_encoding_message_size,
438                            );
439                        let res = grpc.unary(method, req).await;
440                        Ok(res)
441                    };
442                    Box::pin(fut)
443                }
444                _ => Box::pin(async move {
445                    let mut response = http::Response::new(tonic::body::Body::default());
446                    let headers = response.headers_mut();
447                    headers.insert(
448                        tonic::Status::GRPC_STATUS,
449                        (tonic::Code::Unimplemented as i32).into(),
450                    );
451                    headers.insert(
452                        http::header::CONTENT_TYPE,
453                        tonic::metadata::GRPC_CONTENT_TYPE,
454                    );
455                    Ok(response)
456                }),
457            }
458        }
459    }
460    impl<T> Clone for ObservabilityServiceServer<T> {
461        fn clone(&self) -> Self {
462            let inner = self.inner.clone();
463            Self {
464                inner,
465                accept_compression_encodings: self.accept_compression_encodings,
466                send_compression_encodings: self.send_compression_encodings,
467                max_decoding_message_size: self.max_decoding_message_size,
468                max_encoding_message_size: self.max_encoding_message_size,
469            }
470        }
471    }
472    /// Generated gRPC service name
473    pub const SERVICE_NAME: &str = "observability.ObservabilityService";
474    impl<T> tonic::server::NamedService for ObservabilityServiceServer<T> {
475        const NAME: &'static str = SERVICE_NAME;
476    }
477}