Skip to main content

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