# Cloud Monitoring V3 API - Class Google::Cloud::Monitoring::V3::QueryService::Client (v1.10.0)

1.10.0 (latest) 1.9.0 1.8.0 1.7.1 1.6.1 1.5.1 1.4.0 1.3.0 1.2.0 1.1.0 1.0.1 0.18.0 0.17.0 0.16.0 0.15.2 0.14.0 0.13.0 0.12.1 0.11.0 0.10.0 0.9.0 0.8.0 0.7.1 Reference documentation and code samples for the Cloud Monitoring V3 API class Google::Cloud::Monitoring::V3::QueryService::Client.

Client for the QueryService service.


<br />

The QueryService API is used to manage time series data in Cloud
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.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-QueryService-Client-Configuration "Google::Cloud::Monitoring::V3::QueryService::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-QueryService-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-QueryService-Client-Configuration))
**Example**

```ruby
# 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-QueryService-Client#Google__Cloud__Monitoring__V3__QueryService__Client_configure_class_ "Google::Cloud::Monitoring::V3::QueryService::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-QueryService-Client-Configuration "Google::Cloud::Monitoring::V3::QueryService::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-QueryService-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-QueryService-Client-Configuration))

### #initialize

    def initialize() { |config| ... } -> Client

Create a new QueryService client object.
**Yields**

- (config) --- Configure the QueryService client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-QueryService-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-QueryService-Client)) --- a new instance of Client
**Example**

```ruby
# 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
```

### #logger

    def logger() -> Logger

The logger used for request/response debug logging.
**Returns**

- (Logger)

### #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 by using Monitoring Query Language (MQL). We recommend
using PromQL instead of MQL. For more information about the status of MQL,
see the [MQL deprecation
notice](https://cloud.google.com/stackdriver/docs/deprecations/mql).
**Overloads**

    def query_time_series(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::TimeSeriesData>

Pass arguments to `query_time_series` via a request object, either of type [Google::Cloud::Monitoring::V3::QueryTimeSeriesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-QueryTimeSeriesRequest "Google::Cloud::Monitoring::V3::QueryTimeSeriesRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Monitoring::V3::QueryTimeSeriesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/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>

Pass arguments to `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). **Parameters**

- **name** (::String) ---

  Required. The
  [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
  to execute the request. The format is:

      projects/[PROJECT_ID_OR_NUMBER]

- **query** (::String) --- Required. The query in the [Monitoring Query
  Language](https://cloud.google.com/monitoring/mql/reference) 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.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** (::Gapic::PagedEnumerable\<[::Google::Cloud::Monitoring::V3::TimeSeriesData](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-TimeSeriesData)\>)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Gapic::PagedEnumerable\<[::Google::Cloud::Monitoring::V3::TimeSeriesData](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-TimeSeriesData)\>)
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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 elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Monitoring::V3::TimeSeriesData.
  p item
end
```

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)