pub struct MetricClient { /* private fields */ }Expand description
Calls MetricService.
The metrics the platform collects for a project’s compute instances,
volumes and network interfaces: CPU time, network traffic, and volume
reads and writes. Every metric is a counter, a running total that grows
while the instance runs. A query never returns the raw total: for each
period of the window it asks for, it returns the counter’s average
per-second increase over the period (query_time_series_request::Statistic::Rate) or its total increase
(query_time_series_request::Statistic::Increase). The platform collects a value for each counter every 30
seconds while the instance runs, and keeps the values for 90 days. A
volume or a network interface is measured through the instance it is
attached to, so it has values only while attached to a running instance.
Implementations§
Source§impl MetricClient
impl MetricClient
Sourcepub fn new(client: &Client) -> Self
pub fn new(client: &Client) -> Self
Returns a client of MetricService that sends its calls through client.
Sourcepub fn service(&self) -> &Service
pub fn service(&self) -> &Service
The endpoint the client sends its calls to, which also serves the operations its methods answer with.
Sourcepub async fn query_time_series(
&self,
request: QueryTimeSeriesRequest,
) -> Result<QueryTimeSeriesResponse, Error>
pub async fn query_time_series( &self, request: QueryTimeSeriesRequest, ) -> Result<QueryTimeSeriesResponse, Error>
Returns a resource’s time series for the metrics asked, one per
metric, in the order asked. Needs observability.metric.get on the
resource.
A query is limited in what it costs. Its points, the window’s length
divided by period, plus one, for each of its metrics, are at most
11,000 in all, and an organization may run 60 queries a minute and 4 at
a time. A query over any of these limits is refused with
FAILED_PRECONDITION, the same message for all three: one within the
points limit succeeds when sent again a few seconds later.
Each query answered is billed as one request, however many series or points it returns; a refused one isn’t.