#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateProfileRequest {
#[prost(string, tag = "4")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "1")]
pub deployment: ::core::option::Option<Deployment>,
#[prost(enumeration = "ProfileType", repeated, tag = "2")]
pub profile_type: ::prost::alloc::vec::Vec<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateOfflineProfileRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub profile: ::core::option::Option<Profile>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateProfileRequest {
#[prost(message, optional, tag = "1")]
pub profile: ::core::option::Option<Profile>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Profile {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(enumeration = "ProfileType", tag = "2")]
pub profile_type: i32,
#[prost(message, optional, tag = "3")]
pub deployment: ::core::option::Option<Deployment>,
#[prost(message, optional, tag = "4")]
pub duration: ::core::option::Option<::prost_types::Duration>,
#[prost(bytes = "vec", tag = "5")]
pub profile_bytes: ::prost::alloc::vec::Vec<u8>,
#[prost(map = "string, string", tag = "6")]
pub labels:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Deployment {
#[prost(string, tag = "1")]
pub project_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub target: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "3")]
pub labels:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ProfileType {
Unspecified = 0,
Cpu = 1,
Wall = 2,
Heap = 3,
Threads = 4,
Contention = 5,
PeakHeap = 6,
HeapAlloc = 7,
}
#[doc = r" Generated client implementations."]
pub mod profiler_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " Manage the collection of continuous profiling data provided by profiling"]
#[doc = " agents running in the cloud or by an offline provider of profiling data."]
#[doc = ""]
#[doc = " General guidelines:"]
#[doc = " * Profiles for a single deployment must be created in ascending time order."]
#[doc = " * Profiles can be created in either online or offline mode, see below."]
#[derive(Debug, Clone)]
pub struct ProfilerServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> ProfilerServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ProfilerServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
ProfilerServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " CreateProfile creates a new profile resource in the online mode."]
#[doc = ""]
#[doc = " The server ensures that the new profiles are created at a constant rate per"]
#[doc = " deployment, so the creation request may hang for some time until the next"]
#[doc = " profile session is available."]
#[doc = ""]
#[doc = " The request may fail with ABORTED error if the creation is not available"]
#[doc = " within ~1m, the response will indicate the duration of the backoff the"]
#[doc = " client should take before attempting creating a profile again. The backoff"]
#[doc = " duration is returned in google.rpc.RetryInfo extension on the response"]
#[doc = " status. To a gRPC client, the extension will be return as a"]
#[doc = " binary-serialized proto in the trailing metadata item named"]
#[doc = " \"google.rpc.retryinfo-bin\"."]
pub async fn create_profile(
&mut self,
request: impl tonic::IntoRequest<super::CreateProfileRequest>,
) -> Result<tonic::Response<super::Profile>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.devtools.cloudprofiler.v2.ProfilerService/CreateProfile",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " CreateOfflineProfile creates a new profile resource in the offline mode."]
#[doc = " The client provides the profile to create along with the profile bytes, the"]
#[doc = " server records it."]
pub async fn create_offline_profile(
&mut self,
request: impl tonic::IntoRequest<super::CreateOfflineProfileRequest>,
) -> Result<tonic::Response<super::Profile>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.devtools.cloudprofiler.v2.ProfilerService/CreateOfflineProfile",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " UpdateProfile updates the profile bytes and labels on the profile resource"]
#[doc = " created in the online mode. Updating the bytes for profiles created in the"]
#[doc = " offline mode is currently not supported: the profile content must be"]
#[doc = " provided at the time of the profile creation."]
pub async fn update_profile(
&mut self,
request: impl tonic::IntoRequest<super::UpdateProfileRequest>,
) -> Result<tonic::Response<super::Profile>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.devtools.cloudprofiler.v2.ProfilerService/UpdateProfile",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}