1#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
9pub struct InstrumentRequest {}
10#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
13pub struct TaskDetailsRequest {
14 #[prost(message, optional, tag = "1")]
16 pub id: ::core::option::Option<super::common::Id>,
17}
18#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
20pub struct PauseRequest {}
21#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
23pub struct ResumeRequest {}
24#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct Update {
34 #[prost(message, optional, tag = "1")]
39 pub now: ::core::option::Option<::prost_types::Timestamp>,
40 #[prost(message, optional, tag = "2")]
42 pub task_update: ::core::option::Option<super::tasks::TaskUpdate>,
43 #[prost(message, optional, tag = "3")]
45 pub resource_update: ::core::option::Option<super::resources::ResourceUpdate>,
46 #[prost(message, optional, tag = "4")]
48 pub async_op_update: ::core::option::Option<super::async_ops::AsyncOpUpdate>,
49 #[prost(message, optional, tag = "5")]
51 pub new_metadata: ::core::option::Option<super::common::RegisterMetadata>,
52}
53#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
55pub struct StateRequest {}
56#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
58pub struct State {
59 #[prost(enumeration = "Temporality", tag = "1")]
60 pub temporality: i32,
61}
62#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
64pub struct PauseResponse {}
65#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
67pub struct ResumeResponse {}
68#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
70#[repr(i32)]
71pub enum Temporality {
72 Live = 0,
74 Paused = 1,
76}
77impl Temporality {
78 pub fn as_str_name(&self) -> &'static str {
83 match self {
84 Self::Live => "LIVE",
85 Self::Paused => "PAUSED",
86 }
87 }
88 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
90 match value {
91 "LIVE" => Some(Self::Live),
92 "PAUSED" => Some(Self::Paused),
93 _ => None,
94 }
95 }
96}
97pub mod instrument_client {
99 #![allow(
100 unused_variables,
101 dead_code,
102 missing_docs,
103 clippy::wildcard_imports,
104 clippy::let_unit_value,
105 )]
106 use tonic::codegen::*;
107 use tonic::codegen::http::Uri;
108 #[derive(Debug, Clone)]
110 pub struct InstrumentClient<T> {
111 inner: tonic::client::Grpc<T>,
112 }
113 impl InstrumentClient<tonic::transport::Channel> {
114 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
116 where
117 D: TryInto<tonic::transport::Endpoint>,
118 D::Error: Into<StdError>,
119 {
120 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
121 Ok(Self::new(conn))
122 }
123 }
124 impl<T> InstrumentClient<T>
125 where
126 T: tonic::client::GrpcService<tonic::body::Body>,
127 T::Error: Into<StdError>,
128 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
129 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
130 {
131 pub fn new(inner: T) -> Self {
132 let inner = tonic::client::Grpc::new(inner);
133 Self { inner }
134 }
135 pub fn with_origin(inner: T, origin: Uri) -> Self {
136 let inner = tonic::client::Grpc::with_origin(inner, origin);
137 Self { inner }
138 }
139 pub fn with_interceptor<F>(
140 inner: T,
141 interceptor: F,
142 ) -> InstrumentClient<InterceptedService<T, F>>
143 where
144 F: tonic::service::Interceptor,
145 T::ResponseBody: Default,
146 T: tonic::codegen::Service<
147 http::Request<tonic::body::Body>,
148 Response = http::Response<
149 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
150 >,
151 >,
152 <T as tonic::codegen::Service<
153 http::Request<tonic::body::Body>,
154 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
155 {
156 InstrumentClient::new(InterceptedService::new(inner, interceptor))
157 }
158 #[must_use]
163 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
164 self.inner = self.inner.send_compressed(encoding);
165 self
166 }
167 #[must_use]
169 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
170 self.inner = self.inner.accept_compressed(encoding);
171 self
172 }
173 #[must_use]
177 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
178 self.inner = self.inner.max_decoding_message_size(limit);
179 self
180 }
181 #[must_use]
185 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
186 self.inner = self.inner.max_encoding_message_size(limit);
187 self
188 }
189 pub async fn watch_updates(
191 &mut self,
192 request: impl tonic::IntoRequest<super::InstrumentRequest>,
193 ) -> std::result::Result<
194 tonic::Response<tonic::codec::Streaming<super::Update>>,
195 tonic::Status,
196 > {
197 self.inner
198 .ready()
199 .await
200 .map_err(|e| {
201 tonic::Status::unknown(
202 format!("Service was not ready: {}", e.into()),
203 )
204 })?;
205 let codec = tonic_prost::ProstCodec::default();
206 let path = http::uri::PathAndQuery::from_static(
207 "/rs.tokio.console.instrument.Instrument/WatchUpdates",
208 );
209 let mut req = request.into_request();
210 req.extensions_mut()
211 .insert(
212 GrpcMethod::new(
213 "rs.tokio.console.instrument.Instrument",
214 "WatchUpdates",
215 ),
216 );
217 self.inner.server_streaming(req, path, codec).await
218 }
219 pub async fn watch_task_details(
221 &mut self,
222 request: impl tonic::IntoRequest<super::TaskDetailsRequest>,
223 ) -> std::result::Result<
224 tonic::Response<tonic::codec::Streaming<super::super::tasks::TaskDetails>>,
225 tonic::Status,
226 > {
227 self.inner
228 .ready()
229 .await
230 .map_err(|e| {
231 tonic::Status::unknown(
232 format!("Service was not ready: {}", e.into()),
233 )
234 })?;
235 let codec = tonic_prost::ProstCodec::default();
236 let path = http::uri::PathAndQuery::from_static(
237 "/rs.tokio.console.instrument.Instrument/WatchTaskDetails",
238 );
239 let mut req = request.into_request();
240 req.extensions_mut()
241 .insert(
242 GrpcMethod::new(
243 "rs.tokio.console.instrument.Instrument",
244 "WatchTaskDetails",
245 ),
246 );
247 self.inner.server_streaming(req, path, codec).await
248 }
249 pub async fn watch_state(
251 &mut self,
252 request: impl tonic::IntoRequest<super::StateRequest>,
253 ) -> std::result::Result<
254 tonic::Response<tonic::codec::Streaming<super::State>>,
255 tonic::Status,
256 > {
257 self.inner
258 .ready()
259 .await
260 .map_err(|e| {
261 tonic::Status::unknown(
262 format!("Service was not ready: {}", e.into()),
263 )
264 })?;
265 let codec = tonic_prost::ProstCodec::default();
266 let path = http::uri::PathAndQuery::from_static(
267 "/rs.tokio.console.instrument.Instrument/WatchState",
268 );
269 let mut req = request.into_request();
270 req.extensions_mut()
271 .insert(
272 GrpcMethod::new(
273 "rs.tokio.console.instrument.Instrument",
274 "WatchState",
275 ),
276 );
277 self.inner.server_streaming(req, path, codec).await
278 }
279 pub async fn pause(
281 &mut self,
282 request: impl tonic::IntoRequest<super::PauseRequest>,
283 ) -> std::result::Result<tonic::Response<super::PauseResponse>, tonic::Status> {
284 self.inner
285 .ready()
286 .await
287 .map_err(|e| {
288 tonic::Status::unknown(
289 format!("Service was not ready: {}", e.into()),
290 )
291 })?;
292 let codec = tonic_prost::ProstCodec::default();
293 let path = http::uri::PathAndQuery::from_static(
294 "/rs.tokio.console.instrument.Instrument/Pause",
295 );
296 let mut req = request.into_request();
297 req.extensions_mut()
298 .insert(
299 GrpcMethod::new("rs.tokio.console.instrument.Instrument", "Pause"),
300 );
301 self.inner.unary(req, path, codec).await
302 }
303 pub async fn resume(
305 &mut self,
306 request: impl tonic::IntoRequest<super::ResumeRequest>,
307 ) -> std::result::Result<tonic::Response<super::ResumeResponse>, tonic::Status> {
308 self.inner
309 .ready()
310 .await
311 .map_err(|e| {
312 tonic::Status::unknown(
313 format!("Service was not ready: {}", e.into()),
314 )
315 })?;
316 let codec = tonic_prost::ProstCodec::default();
317 let path = http::uri::PathAndQuery::from_static(
318 "/rs.tokio.console.instrument.Instrument/Resume",
319 );
320 let mut req = request.into_request();
321 req.extensions_mut()
322 .insert(
323 GrpcMethod::new("rs.tokio.console.instrument.Instrument", "Resume"),
324 );
325 self.inner.unary(req, path, codec).await
326 }
327 }
328}
329pub mod instrument_server {
331 #![allow(
332 unused_variables,
333 dead_code,
334 missing_docs,
335 clippy::wildcard_imports,
336 clippy::let_unit_value,
337 )]
338 use tonic::codegen::*;
339 #[async_trait]
341 pub trait Instrument: std::marker::Send + std::marker::Sync + 'static {
342 type WatchUpdatesStream: tonic::codegen::tokio_stream::Stream<
344 Item = std::result::Result<super::Update, tonic::Status>,
345 >
346 + std::marker::Send
347 + 'static;
348 async fn watch_updates(
350 &self,
351 request: tonic::Request<super::InstrumentRequest>,
352 ) -> std::result::Result<
353 tonic::Response<Self::WatchUpdatesStream>,
354 tonic::Status,
355 >;
356 type WatchTaskDetailsStream: tonic::codegen::tokio_stream::Stream<
358 Item = std::result::Result<
359 super::super::tasks::TaskDetails,
360 tonic::Status,
361 >,
362 >
363 + std::marker::Send
364 + 'static;
365 async fn watch_task_details(
367 &self,
368 request: tonic::Request<super::TaskDetailsRequest>,
369 ) -> std::result::Result<
370 tonic::Response<Self::WatchTaskDetailsStream>,
371 tonic::Status,
372 >;
373 type WatchStateStream: tonic::codegen::tokio_stream::Stream<
375 Item = std::result::Result<super::State, tonic::Status>,
376 >
377 + std::marker::Send
378 + 'static;
379 async fn watch_state(
381 &self,
382 request: tonic::Request<super::StateRequest>,
383 ) -> std::result::Result<tonic::Response<Self::WatchStateStream>, tonic::Status>;
384 async fn pause(
386 &self,
387 request: tonic::Request<super::PauseRequest>,
388 ) -> std::result::Result<tonic::Response<super::PauseResponse>, tonic::Status>;
389 async fn resume(
391 &self,
392 request: tonic::Request<super::ResumeRequest>,
393 ) -> std::result::Result<tonic::Response<super::ResumeResponse>, tonic::Status>;
394 }
395 #[derive(Debug)]
397 pub struct InstrumentServer<T> {
398 inner: Arc<T>,
399 accept_compression_encodings: EnabledCompressionEncodings,
400 send_compression_encodings: EnabledCompressionEncodings,
401 max_decoding_message_size: Option<usize>,
402 max_encoding_message_size: Option<usize>,
403 }
404 impl<T> InstrumentServer<T> {
405 pub fn new(inner: T) -> Self {
406 Self::from_arc(Arc::new(inner))
407 }
408 pub fn from_arc(inner: Arc<T>) -> Self {
409 Self {
410 inner,
411 accept_compression_encodings: Default::default(),
412 send_compression_encodings: Default::default(),
413 max_decoding_message_size: None,
414 max_encoding_message_size: None,
415 }
416 }
417 pub fn with_interceptor<F>(
418 inner: T,
419 interceptor: F,
420 ) -> InterceptedService<Self, F>
421 where
422 F: tonic::service::Interceptor,
423 {
424 InterceptedService::new(Self::new(inner), interceptor)
425 }
426 #[must_use]
428 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
429 self.accept_compression_encodings.enable(encoding);
430 self
431 }
432 #[must_use]
434 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
435 self.send_compression_encodings.enable(encoding);
436 self
437 }
438 #[must_use]
442 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
443 self.max_decoding_message_size = Some(limit);
444 self
445 }
446 #[must_use]
450 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
451 self.max_encoding_message_size = Some(limit);
452 self
453 }
454 }
455 impl<T, B> tonic::codegen::Service<http::Request<B>> for InstrumentServer<T>
456 where
457 T: Instrument,
458 B: Body + std::marker::Send + 'static,
459 B::Error: Into<StdError> + std::marker::Send + 'static,
460 {
461 type Response = http::Response<tonic::body::Body>;
462 type Error = std::convert::Infallible;
463 type Future = BoxFuture<Self::Response, Self::Error>;
464 fn poll_ready(
465 &mut self,
466 _cx: &mut Context<'_>,
467 ) -> Poll<std::result::Result<(), Self::Error>> {
468 Poll::Ready(Ok(()))
469 }
470 fn call(&mut self, req: http::Request<B>) -> Self::Future {
471 match req.uri().path() {
472 "/rs.tokio.console.instrument.Instrument/WatchUpdates" => {
473 #[allow(non_camel_case_types)]
474 struct WatchUpdatesSvc<T: Instrument>(pub Arc<T>);
475 impl<
476 T: Instrument,
477 > tonic::server::ServerStreamingService<super::InstrumentRequest>
478 for WatchUpdatesSvc<T> {
479 type Response = super::Update;
480 type ResponseStream = T::WatchUpdatesStream;
481 type Future = BoxFuture<
482 tonic::Response<Self::ResponseStream>,
483 tonic::Status,
484 >;
485 fn call(
486 &mut self,
487 request: tonic::Request<super::InstrumentRequest>,
488 ) -> Self::Future {
489 let inner = Arc::clone(&self.0);
490 let fut = async move {
491 <T as Instrument>::watch_updates(&inner, request).await
492 };
493 Box::pin(fut)
494 }
495 }
496 let accept_compression_encodings = self.accept_compression_encodings;
497 let send_compression_encodings = self.send_compression_encodings;
498 let max_decoding_message_size = self.max_decoding_message_size;
499 let max_encoding_message_size = self.max_encoding_message_size;
500 let inner = self.inner.clone();
501 let fut = async move {
502 let method = WatchUpdatesSvc(inner);
503 let codec = tonic_prost::ProstCodec::default();
504 let mut grpc = tonic::server::Grpc::new(codec)
505 .apply_compression_config(
506 accept_compression_encodings,
507 send_compression_encodings,
508 )
509 .apply_max_message_size_config(
510 max_decoding_message_size,
511 max_encoding_message_size,
512 );
513 let res = grpc.server_streaming(method, req).await;
514 Ok(res)
515 };
516 Box::pin(fut)
517 }
518 "/rs.tokio.console.instrument.Instrument/WatchTaskDetails" => {
519 #[allow(non_camel_case_types)]
520 struct WatchTaskDetailsSvc<T: Instrument>(pub Arc<T>);
521 impl<
522 T: Instrument,
523 > tonic::server::ServerStreamingService<super::TaskDetailsRequest>
524 for WatchTaskDetailsSvc<T> {
525 type Response = super::super::tasks::TaskDetails;
526 type ResponseStream = T::WatchTaskDetailsStream;
527 type Future = BoxFuture<
528 tonic::Response<Self::ResponseStream>,
529 tonic::Status,
530 >;
531 fn call(
532 &mut self,
533 request: tonic::Request<super::TaskDetailsRequest>,
534 ) -> Self::Future {
535 let inner = Arc::clone(&self.0);
536 let fut = async move {
537 <T as Instrument>::watch_task_details(&inner, request).await
538 };
539 Box::pin(fut)
540 }
541 }
542 let accept_compression_encodings = self.accept_compression_encodings;
543 let send_compression_encodings = self.send_compression_encodings;
544 let max_decoding_message_size = self.max_decoding_message_size;
545 let max_encoding_message_size = self.max_encoding_message_size;
546 let inner = self.inner.clone();
547 let fut = async move {
548 let method = WatchTaskDetailsSvc(inner);
549 let codec = tonic_prost::ProstCodec::default();
550 let mut grpc = tonic::server::Grpc::new(codec)
551 .apply_compression_config(
552 accept_compression_encodings,
553 send_compression_encodings,
554 )
555 .apply_max_message_size_config(
556 max_decoding_message_size,
557 max_encoding_message_size,
558 );
559 let res = grpc.server_streaming(method, req).await;
560 Ok(res)
561 };
562 Box::pin(fut)
563 }
564 "/rs.tokio.console.instrument.Instrument/WatchState" => {
565 #[allow(non_camel_case_types)]
566 struct WatchStateSvc<T: Instrument>(pub Arc<T>);
567 impl<
568 T: Instrument,
569 > tonic::server::ServerStreamingService<super::StateRequest>
570 for WatchStateSvc<T> {
571 type Response = super::State;
572 type ResponseStream = T::WatchStateStream;
573 type Future = BoxFuture<
574 tonic::Response<Self::ResponseStream>,
575 tonic::Status,
576 >;
577 fn call(
578 &mut self,
579 request: tonic::Request<super::StateRequest>,
580 ) -> Self::Future {
581 let inner = Arc::clone(&self.0);
582 let fut = async move {
583 <T as Instrument>::watch_state(&inner, request).await
584 };
585 Box::pin(fut)
586 }
587 }
588 let accept_compression_encodings = self.accept_compression_encodings;
589 let send_compression_encodings = self.send_compression_encodings;
590 let max_decoding_message_size = self.max_decoding_message_size;
591 let max_encoding_message_size = self.max_encoding_message_size;
592 let inner = self.inner.clone();
593 let fut = async move {
594 let method = WatchStateSvc(inner);
595 let codec = tonic_prost::ProstCodec::default();
596 let mut grpc = tonic::server::Grpc::new(codec)
597 .apply_compression_config(
598 accept_compression_encodings,
599 send_compression_encodings,
600 )
601 .apply_max_message_size_config(
602 max_decoding_message_size,
603 max_encoding_message_size,
604 );
605 let res = grpc.server_streaming(method, req).await;
606 Ok(res)
607 };
608 Box::pin(fut)
609 }
610 "/rs.tokio.console.instrument.Instrument/Pause" => {
611 #[allow(non_camel_case_types)]
612 struct PauseSvc<T: Instrument>(pub Arc<T>);
613 impl<T: Instrument> tonic::server::UnaryService<super::PauseRequest>
614 for PauseSvc<T> {
615 type Response = super::PauseResponse;
616 type Future = BoxFuture<
617 tonic::Response<Self::Response>,
618 tonic::Status,
619 >;
620 fn call(
621 &mut self,
622 request: tonic::Request<super::PauseRequest>,
623 ) -> Self::Future {
624 let inner = Arc::clone(&self.0);
625 let fut = async move {
626 <T as Instrument>::pause(&inner, request).await
627 };
628 Box::pin(fut)
629 }
630 }
631 let accept_compression_encodings = self.accept_compression_encodings;
632 let send_compression_encodings = self.send_compression_encodings;
633 let max_decoding_message_size = self.max_decoding_message_size;
634 let max_encoding_message_size = self.max_encoding_message_size;
635 let inner = self.inner.clone();
636 let fut = async move {
637 let method = PauseSvc(inner);
638 let codec = tonic_prost::ProstCodec::default();
639 let mut grpc = tonic::server::Grpc::new(codec)
640 .apply_compression_config(
641 accept_compression_encodings,
642 send_compression_encodings,
643 )
644 .apply_max_message_size_config(
645 max_decoding_message_size,
646 max_encoding_message_size,
647 );
648 let res = grpc.unary(method, req).await;
649 Ok(res)
650 };
651 Box::pin(fut)
652 }
653 "/rs.tokio.console.instrument.Instrument/Resume" => {
654 #[allow(non_camel_case_types)]
655 struct ResumeSvc<T: Instrument>(pub Arc<T>);
656 impl<T: Instrument> tonic::server::UnaryService<super::ResumeRequest>
657 for ResumeSvc<T> {
658 type Response = super::ResumeResponse;
659 type Future = BoxFuture<
660 tonic::Response<Self::Response>,
661 tonic::Status,
662 >;
663 fn call(
664 &mut self,
665 request: tonic::Request<super::ResumeRequest>,
666 ) -> Self::Future {
667 let inner = Arc::clone(&self.0);
668 let fut = async move {
669 <T as Instrument>::resume(&inner, request).await
670 };
671 Box::pin(fut)
672 }
673 }
674 let accept_compression_encodings = self.accept_compression_encodings;
675 let send_compression_encodings = self.send_compression_encodings;
676 let max_decoding_message_size = self.max_decoding_message_size;
677 let max_encoding_message_size = self.max_encoding_message_size;
678 let inner = self.inner.clone();
679 let fut = async move {
680 let method = ResumeSvc(inner);
681 let codec = tonic_prost::ProstCodec::default();
682 let mut grpc = tonic::server::Grpc::new(codec)
683 .apply_compression_config(
684 accept_compression_encodings,
685 send_compression_encodings,
686 )
687 .apply_max_message_size_config(
688 max_decoding_message_size,
689 max_encoding_message_size,
690 );
691 let res = grpc.unary(method, req).await;
692 Ok(res)
693 };
694 Box::pin(fut)
695 }
696 _ => {
697 Box::pin(async move {
698 let mut response = http::Response::new(
699 tonic::body::Body::default(),
700 );
701 let headers = response.headers_mut();
702 headers
703 .insert(
704 tonic::Status::GRPC_STATUS,
705 (tonic::Code::Unimplemented as i32).into(),
706 );
707 headers
708 .insert(
709 http::header::CONTENT_TYPE,
710 tonic::metadata::GRPC_CONTENT_TYPE,
711 );
712 Ok(response)
713 })
714 }
715 }
716 }
717 }
718 impl<T> Clone for InstrumentServer<T> {
719 fn clone(&self) -> Self {
720 let inner = self.inner.clone();
721 Self {
722 inner,
723 accept_compression_encodings: self.accept_compression_encodings,
724 send_compression_encodings: self.send_compression_encodings,
725 max_decoding_message_size: self.max_decoding_message_size,
726 max_encoding_message_size: self.max_encoding_message_size,
727 }
728 }
729 }
730 pub const SERVICE_NAME: &str = "rs.tokio.console.instrument.Instrument";
732 impl<T> tonic::server::NamedService for InstrumentServer<T> {
733 const NAME: &'static str = SERVICE_NAME;
734 }
735}