googleapis_tonic_google_devtools_cloudprofiler_v2/vec_u8_hash_map/google.devtools.cloudprofiler.v2.rs
1// This file is @generated by prost-build.
2/// CreateProfileRequest describes a profile resource online creation request.
3/// The deployment field must be populated. The profile_type specifies the list
4/// of profile types supported by the agent. The creation call will hang until a
5/// profile of one of these types needs to be collected.
6#[derive(Clone, PartialEq, ::prost::Message)]
7pub struct CreateProfileRequest {
8 /// Parent project to create the profile in.
9 #[prost(string, tag = "4")]
10 pub parent: ::prost::alloc::string::String,
11 /// Deployment details.
12 #[prost(message, optional, tag = "1")]
13 pub deployment: ::core::option::Option<Deployment>,
14 /// One or more profile types that the agent is capable of providing.
15 #[prost(enumeration = "ProfileType", repeated, tag = "2")]
16 pub profile_type: ::prost::alloc::vec::Vec<i32>,
17}
18/// CreateOfflineProfileRequest describes a profile resource offline creation
19/// request.
20#[derive(Clone, PartialEq, ::prost::Message)]
21pub struct CreateOfflineProfileRequest {
22 /// Parent project to create the profile in.
23 #[prost(string, tag = "1")]
24 pub parent: ::prost::alloc::string::String,
25 /// Contents of the profile to create.
26 #[prost(message, optional, tag = "2")]
27 pub profile: ::core::option::Option<Profile>,
28}
29/// UpdateProfileRequest contains the profile to update.
30#[derive(Clone, PartialEq, ::prost::Message)]
31pub struct UpdateProfileRequest {
32 /// Profile to update.
33 #[prost(message, optional, tag = "1")]
34 pub profile: ::core::option::Option<Profile>,
35 /// Field mask used to specify the fields to be overwritten. Currently only
36 /// profile_bytes and labels fields are supported by UpdateProfile, so only
37 /// those fields can be specified in the mask. When no mask is provided, all
38 /// fields are overwritten.
39 #[prost(message, optional, tag = "2")]
40 pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
41}
42/// Profile resource.
43#[derive(Clone, PartialEq, ::prost::Message)]
44pub struct Profile {
45 /// Output only. Opaque, server-assigned, unique ID for this profile.
46 #[prost(string, tag = "1")]
47 pub name: ::prost::alloc::string::String,
48 /// Type of profile.
49 /// For offline mode, this must be specified when creating the profile. For
50 /// online mode it is assigned and returned by the server.
51 #[prost(enumeration = "ProfileType", tag = "2")]
52 pub profile_type: i32,
53 /// Deployment this profile corresponds to.
54 #[prost(message, optional, tag = "3")]
55 pub deployment: ::core::option::Option<Deployment>,
56 /// Duration of the profiling session.
57 /// Input (for the offline mode) or output (for the online mode).
58 /// The field represents requested profiling duration. It may slightly differ
59 /// from the effective profiling duration, which is recorded in the profile
60 /// data, in case the profiling can't be stopped immediately (e.g. in case
61 /// stopping the profiling is handled asynchronously).
62 #[prost(message, optional, tag = "4")]
63 pub duration: ::core::option::Option<::prost_types::Duration>,
64 /// Input only. Profile bytes, as a gzip compressed serialized proto, the
65 /// format is <https://github.com/google/pprof/blob/master/proto/profile.proto.>
66 #[prost(bytes = "vec", tag = "5")]
67 pub profile_bytes: ::prost::alloc::vec::Vec<u8>,
68 /// Input only. Labels associated to this specific profile. These labels will
69 /// get merged with the deployment labels for the final data set. See
70 /// documentation on deployment labels for validation rules and limits.
71 #[prost(map = "string, string", tag = "6")]
72 pub labels: ::std::collections::HashMap<
73 ::prost::alloc::string::String,
74 ::prost::alloc::string::String,
75 >,
76 /// Output only. Start time for the profile.
77 /// This output is only present in response from the ListProfiles method.
78 #[prost(message, optional, tag = "7")]
79 pub start_time: ::core::option::Option<::prost_types::Timestamp>,
80}
81/// Deployment contains the deployment identification information.
82#[derive(Clone, PartialEq, ::prost::Message)]
83pub struct Deployment {
84 /// Project ID is the ID of a cloud project.
85 /// Validation regex: `^[a-z][-a-z0-9:.]{4,61}\[a-z0-9\]$`.
86 #[prost(string, tag = "1")]
87 pub project_id: ::prost::alloc::string::String,
88 /// Target is the service name used to group related deployments:
89 ///
90 /// * Service name for App Engine Flex / Standard.
91 /// * Cluster and container name for GKE.
92 /// * User-specified string for direct Compute Engine profiling (e.g. Java).
93 /// * Job name for Dataflow.
94 /// Validation regex: `^[a-z0-9](\[-a-z0-9_.\]{0,253}\[a-z0-9\])?$`.
95 #[prost(string, tag = "2")]
96 pub target: ::prost::alloc::string::String,
97 /// Labels identify the deployment within the user universe and same target.
98 /// Validation regex for label names: `^[a-z0-9](\[a-z0-9-\]{0,61}\[a-z0-9\])?$`.
99 /// Value for an individual label must be \<= 512 bytes, the total
100 /// size of all label names and values must be \<= 1024 bytes.
101 ///
102 /// Label named "language" can be used to record the programming language of
103 /// the profiled deployment. The standard choices for the value include "java",
104 /// "go", "python", "ruby", "nodejs", "php", "dotnet".
105 ///
106 /// For deployments running on Google Cloud Platform, "zone" or "region" label
107 /// should be present describing the deployment location. An example of a zone
108 /// is "us-central1-a", an example of a region is "us-central1" or
109 /// "us-central".
110 #[prost(map = "string, string", tag = "3")]
111 pub labels: ::std::collections::HashMap<
112 ::prost::alloc::string::String,
113 ::prost::alloc::string::String,
114 >,
115}
116/// ListProfilesRequest contains request parameters for listing profiles for
117/// deployments in projects which the user has permissions to view.
118#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
119pub struct ListProfilesRequest {
120 /// Required. The parent, which owns this collection of profiles.
121 /// Format: projects/{user_project_id}
122 #[prost(string, tag = "1")]
123 pub parent: ::prost::alloc::string::String,
124 /// The maximum number of items to return.
125 /// Default page_size is 1000.
126 /// Max limit is 1000.
127 #[prost(int32, tag = "2")]
128 pub page_size: i32,
129 /// The token to continue pagination and get profiles from a particular page.
130 /// When paginating, all other parameters provided to `ListProfiles` must match
131 /// the call that provided the page token.
132 #[prost(string, tag = "3")]
133 pub page_token: ::prost::alloc::string::String,
134}
135/// ListProfileResponse contains the list of collected profiles for deployments
136/// in projects which the user has permissions to view.
137#[derive(Clone, PartialEq, ::prost::Message)]
138pub struct ListProfilesResponse {
139 /// List of profiles fetched.
140 #[prost(message, repeated, tag = "1")]
141 pub profiles: ::prost::alloc::vec::Vec<Profile>,
142 /// Token to receive the next page of results.
143 /// This field maybe empty if there are no more profiles to fetch.
144 #[prost(string, tag = "2")]
145 pub next_page_token: ::prost::alloc::string::String,
146 /// Number of profiles that were skipped in the current page since they were
147 /// not able to be fetched successfully. This should typically be zero. A
148 /// non-zero value may indicate a transient failure, in which case if the
149 /// number is too high for your use case, the call may be retried.
150 #[prost(int32, tag = "3")]
151 pub skipped_profiles: i32,
152}
153/// ProfileType is type of profiling data.
154/// NOTE: the enumeration member names are used (in lowercase) as unique string
155/// identifiers of profile types, so they must not be renamed.
156#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
157#[repr(i32)]
158pub enum ProfileType {
159 /// Unspecified profile type.
160 Unspecified = 0,
161 /// Thread CPU time sampling.
162 Cpu = 1,
163 /// Wallclock time sampling. More expensive as stops all threads.
164 Wall = 2,
165 /// In-use heap profile. Represents a snapshot of the allocations that are
166 /// live at the time of the profiling.
167 Heap = 3,
168 /// Single-shot collection of all thread stacks.
169 Threads = 4,
170 /// Synchronization contention profile.
171 Contention = 5,
172 /// Peak heap profile.
173 PeakHeap = 6,
174 /// Heap allocation profile. It represents the aggregation of all allocations
175 /// made over the duration of the profile. All allocations are included,
176 /// including those that might have been freed by the end of the profiling
177 /// interval. The profile is in particular useful for garbage collecting
178 /// languages to understand which parts of the code create most of the garbage
179 /// collection pressure to see if those can be optimized.
180 HeapAlloc = 7,
181}
182impl ProfileType {
183 /// String value of the enum field names used in the ProtoBuf definition.
184 ///
185 /// The values are not transformed in any way and thus are considered stable
186 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
187 pub fn as_str_name(&self) -> &'static str {
188 match self {
189 Self::Unspecified => "PROFILE_TYPE_UNSPECIFIED",
190 Self::Cpu => "CPU",
191 Self::Wall => "WALL",
192 Self::Heap => "HEAP",
193 Self::Threads => "THREADS",
194 Self::Contention => "CONTENTION",
195 Self::PeakHeap => "PEAK_HEAP",
196 Self::HeapAlloc => "HEAP_ALLOC",
197 }
198 }
199 /// Creates an enum from field names used in the ProtoBuf definition.
200 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
201 match value {
202 "PROFILE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
203 "CPU" => Some(Self::Cpu),
204 "WALL" => Some(Self::Wall),
205 "HEAP" => Some(Self::Heap),
206 "THREADS" => Some(Self::Threads),
207 "CONTENTION" => Some(Self::Contention),
208 "PEAK_HEAP" => Some(Self::PeakHeap),
209 "HEAP_ALLOC" => Some(Self::HeapAlloc),
210 _ => None,
211 }
212 }
213}
214/// Generated client implementations.
215pub mod profiler_service_client {
216 #![allow(
217 unused_variables,
218 dead_code,
219 missing_docs,
220 clippy::wildcard_imports,
221 clippy::let_unit_value,
222 )]
223 use tonic::codegen::*;
224 use tonic::codegen::http::Uri;
225 /// Manage the collection of continuous profiling data provided by profiling
226 /// agents running in the cloud or by an offline provider of profiling data.
227 ///
228 /// **The APIs listed in this service are intended for use within our profiler
229 /// agents only.**
230 #[derive(Debug, Clone)]
231 pub struct ProfilerServiceClient<T> {
232 inner: tonic::client::Grpc<T>,
233 }
234 impl<T> ProfilerServiceClient<T>
235 where
236 T: tonic::client::GrpcService<tonic::body::Body>,
237 T::Error: Into<StdError>,
238 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
239 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
240 {
241 pub fn new(inner: T) -> Self {
242 let inner = tonic::client::Grpc::new(inner);
243 Self { inner }
244 }
245 pub fn with_origin(inner: T, origin: Uri) -> Self {
246 let inner = tonic::client::Grpc::with_origin(inner, origin);
247 Self { inner }
248 }
249 pub fn with_interceptor<F>(
250 inner: T,
251 interceptor: F,
252 ) -> ProfilerServiceClient<InterceptedService<T, F>>
253 where
254 F: tonic::service::Interceptor,
255 T::ResponseBody: Default,
256 T: tonic::codegen::Service<
257 http::Request<tonic::body::Body>,
258 Response = http::Response<
259 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
260 >,
261 >,
262 <T as tonic::codegen::Service<
263 http::Request<tonic::body::Body>,
264 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
265 {
266 ProfilerServiceClient::new(InterceptedService::new(inner, interceptor))
267 }
268 /// Compress requests with the given encoding.
269 ///
270 /// This requires the server to support it otherwise it might respond with an
271 /// error.
272 #[must_use]
273 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
274 self.inner = self.inner.send_compressed(encoding);
275 self
276 }
277 /// Enable decompressing responses.
278 #[must_use]
279 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
280 self.inner = self.inner.accept_compressed(encoding);
281 self
282 }
283 /// Limits the maximum size of a decoded message.
284 ///
285 /// Default: `4MB`
286 #[must_use]
287 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
288 self.inner = self.inner.max_decoding_message_size(limit);
289 self
290 }
291 /// Limits the maximum size of an encoded message.
292 ///
293 /// Default: `usize::MAX`
294 #[must_use]
295 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
296 self.inner = self.inner.max_encoding_message_size(limit);
297 self
298 }
299 /// CreateProfile creates a new profile resource in the online mode.
300 ///
301 /// *Direct use of this API is discouraged, please use a [supported
302 /// profiler
303 /// agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
304 /// instead for profile collection.*
305 ///
306 /// The server ensures that the new profiles are created at a constant rate per
307 /// deployment, so the creation request may hang for some time until the next
308 /// profile session is available.
309 ///
310 /// The request may fail with ABORTED error if the creation is not available
311 /// within ~1m, the response will indicate the duration of the backoff the
312 /// client should take before attempting creating a profile again. The backoff
313 /// duration is returned in google.rpc.RetryInfo extension on the response
314 /// status. To a gRPC client, the extension will be return as a
315 /// binary-serialized proto in the trailing metadata item named
316 /// "google.rpc.retryinfo-bin".
317 pub async fn create_profile(
318 &mut self,
319 request: impl tonic::IntoRequest<super::CreateProfileRequest>,
320 ) -> std::result::Result<tonic::Response<super::Profile>, tonic::Status> {
321 self.inner
322 .ready()
323 .await
324 .map_err(|e| {
325 tonic::Status::unknown(
326 format!("Service was not ready: {}", e.into()),
327 )
328 })?;
329 let codec = tonic_prost::ProstCodec::default();
330 let path = http::uri::PathAndQuery::from_static(
331 "/google.devtools.cloudprofiler.v2.ProfilerService/CreateProfile",
332 );
333 let mut req = request.into_request();
334 req.extensions_mut()
335 .insert(
336 GrpcMethod::new(
337 "google.devtools.cloudprofiler.v2.ProfilerService",
338 "CreateProfile",
339 ),
340 );
341 self.inner.unary(req, path, codec).await
342 }
343 /// CreateOfflineProfile creates a new profile resource in the offline
344 /// mode. The client provides the profile to create along with the profile
345 /// bytes, the server records it.
346 ///
347 /// *Direct use of this API is discouraged, please use a [supported
348 /// profiler
349 /// agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
350 /// instead for profile collection.*
351 pub async fn create_offline_profile(
352 &mut self,
353 request: impl tonic::IntoRequest<super::CreateOfflineProfileRequest>,
354 ) -> std::result::Result<tonic::Response<super::Profile>, tonic::Status> {
355 self.inner
356 .ready()
357 .await
358 .map_err(|e| {
359 tonic::Status::unknown(
360 format!("Service was not ready: {}", e.into()),
361 )
362 })?;
363 let codec = tonic_prost::ProstCodec::default();
364 let path = http::uri::PathAndQuery::from_static(
365 "/google.devtools.cloudprofiler.v2.ProfilerService/CreateOfflineProfile",
366 );
367 let mut req = request.into_request();
368 req.extensions_mut()
369 .insert(
370 GrpcMethod::new(
371 "google.devtools.cloudprofiler.v2.ProfilerService",
372 "CreateOfflineProfile",
373 ),
374 );
375 self.inner.unary(req, path, codec).await
376 }
377 /// UpdateProfile updates the profile bytes and labels on the profile resource
378 /// created in the online mode. Updating the bytes for profiles created in the
379 /// offline mode is currently not supported: the profile content must be
380 /// provided at the time of the profile creation.
381 ///
382 /// *Direct use of this API is discouraged, please use a [supported
383 /// profiler
384 /// agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
385 /// instead for profile collection.*
386 pub async fn update_profile(
387 &mut self,
388 request: impl tonic::IntoRequest<super::UpdateProfileRequest>,
389 ) -> std::result::Result<tonic::Response<super::Profile>, tonic::Status> {
390 self.inner
391 .ready()
392 .await
393 .map_err(|e| {
394 tonic::Status::unknown(
395 format!("Service was not ready: {}", e.into()),
396 )
397 })?;
398 let codec = tonic_prost::ProstCodec::default();
399 let path = http::uri::PathAndQuery::from_static(
400 "/google.devtools.cloudprofiler.v2.ProfilerService/UpdateProfile",
401 );
402 let mut req = request.into_request();
403 req.extensions_mut()
404 .insert(
405 GrpcMethod::new(
406 "google.devtools.cloudprofiler.v2.ProfilerService",
407 "UpdateProfile",
408 ),
409 );
410 self.inner.unary(req, path, codec).await
411 }
412 }
413}
414/// Generated client implementations.
415pub mod export_service_client {
416 #![allow(
417 unused_variables,
418 dead_code,
419 missing_docs,
420 clippy::wildcard_imports,
421 clippy::let_unit_value,
422 )]
423 use tonic::codegen::*;
424 use tonic::codegen::http::Uri;
425 /// Service allows existing Cloud Profiler customers to export their profile data
426 /// out of Google Cloud.
427 #[derive(Debug, Clone)]
428 pub struct ExportServiceClient<T> {
429 inner: tonic::client::Grpc<T>,
430 }
431 impl<T> ExportServiceClient<T>
432 where
433 T: tonic::client::GrpcService<tonic::body::Body>,
434 T::Error: Into<StdError>,
435 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
436 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
437 {
438 pub fn new(inner: T) -> Self {
439 let inner = tonic::client::Grpc::new(inner);
440 Self { inner }
441 }
442 pub fn with_origin(inner: T, origin: Uri) -> Self {
443 let inner = tonic::client::Grpc::with_origin(inner, origin);
444 Self { inner }
445 }
446 pub fn with_interceptor<F>(
447 inner: T,
448 interceptor: F,
449 ) -> ExportServiceClient<InterceptedService<T, F>>
450 where
451 F: tonic::service::Interceptor,
452 T::ResponseBody: Default,
453 T: tonic::codegen::Service<
454 http::Request<tonic::body::Body>,
455 Response = http::Response<
456 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
457 >,
458 >,
459 <T as tonic::codegen::Service<
460 http::Request<tonic::body::Body>,
461 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
462 {
463 ExportServiceClient::new(InterceptedService::new(inner, interceptor))
464 }
465 /// Compress requests with the given encoding.
466 ///
467 /// This requires the server to support it otherwise it might respond with an
468 /// error.
469 #[must_use]
470 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
471 self.inner = self.inner.send_compressed(encoding);
472 self
473 }
474 /// Enable decompressing responses.
475 #[must_use]
476 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
477 self.inner = self.inner.accept_compressed(encoding);
478 self
479 }
480 /// Limits the maximum size of a decoded message.
481 ///
482 /// Default: `4MB`
483 #[must_use]
484 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
485 self.inner = self.inner.max_decoding_message_size(limit);
486 self
487 }
488 /// Limits the maximum size of an encoded message.
489 ///
490 /// Default: `usize::MAX`
491 #[must_use]
492 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
493 self.inner = self.inner.max_encoding_message_size(limit);
494 self
495 }
496 /// Lists profiles which have been collected so far and for which the caller
497 /// has permission to view.
498 pub async fn list_profiles(
499 &mut self,
500 request: impl tonic::IntoRequest<super::ListProfilesRequest>,
501 ) -> std::result::Result<
502 tonic::Response<super::ListProfilesResponse>,
503 tonic::Status,
504 > {
505 self.inner
506 .ready()
507 .await
508 .map_err(|e| {
509 tonic::Status::unknown(
510 format!("Service was not ready: {}", e.into()),
511 )
512 })?;
513 let codec = tonic_prost::ProstCodec::default();
514 let path = http::uri::PathAndQuery::from_static(
515 "/google.devtools.cloudprofiler.v2.ExportService/ListProfiles",
516 );
517 let mut req = request.into_request();
518 req.extensions_mut()
519 .insert(
520 GrpcMethod::new(
521 "google.devtools.cloudprofiler.v2.ExportService",
522 "ListProfiles",
523 ),
524 );
525 self.inner.unary(req, path, codec).await
526 }
527 }
528}