Reference documentation and code samples for the Cloud Monitoring V3 API class Google::Cloud::Monitoring::V3::QueryService::Client.
Client for the QueryService service.
The QueryService API is used to manage time series data in Stackdriver Monitoring. Time series data is a collection of data points that describes the time-varying values of a metric.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the QueryService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all QueryService clients ::Google::Cloud::Monitoring::V3::QueryService::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the QueryService Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#initialize
def initialize() { |config| ... } -> Client
Create a new QueryService client object.
- (config) — Configure the QueryService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Monitoring::V3::QueryService::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Monitoring::V3::QueryService::Client.new do |config| config.timeout = 10.0 end
#query_time_series
def query_time_series(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::TimeSeriesData>
def query_time_series(name: nil, query: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::TimeSeriesData>
Queries time series using Monitoring Query Language. This method does not require a Workspace.
def query_time_series(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::TimeSeriesData>
query_time_series
via a request object, either of type
Google::Cloud::Monitoring::V3::QueryTimeSeriesRequest or an equivalent Hash.
- request (::Google::Cloud::Monitoring::V3::QueryTimeSeriesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def query_time_series(name: nil, query: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::TimeSeriesData>
query_time_series
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) —
Required. The project on which to execute the request. The format is:
projects/[PROJECT_ID_OR_NUMBER]
- query (::String) — Required. The query in the Monitoring Query Language format. The default time zone is in UTC.
- page_size (::Integer) — A positive number that is the maximum number of time_series_data to return.
-
page_token (::String) — If this field is not empty then it must contain the
nextPageToken
value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::TimeSeriesData>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::TimeSeriesData>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/monitoring/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Monitoring::V3::QueryService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Monitoring::V3::QueryTimeSeriesRequest.new # Call the query_time_series method. result = client.query_time_series request # The returned object is of type Gapic::PagedEnumerable. You can # iterate over all elements by calling #each, and the enumerable # will lazily make API calls to fetch subsequent pages. Other # methods are also available for managing paging directly. result.each do |response| # Each element is of type ::Google::Cloud::Monitoring::V3::TimeSeriesData. p response end