class Google::Cloud::Monitoring::V3::MetricService::Client
Client
for the MetricService
service.
Manages metric descriptors, monitored resource descriptors, and time series data.
Attributes
@private
Public Class Methods
Configure the MetricService
Client
class.
See {::Google::Cloud::Monitoring::V3::MetricService::Client::Configuration} for a description of the configuration fields.
@example
# Modify the configuration for all MetricService clients ::Google::Cloud::Monitoring::V3::MetricService::Client.configure do |config| config.timeout = 10.0 end
@yield [config] Configure the Client
client. @yieldparam config [Client::Configuration]
@return [Client::Configuration]
# File lib/google/cloud/monitoring/v3/metric_service/client.rb, line 57 def self.configure @configure ||= begin namespace = ["Google", "Cloud", "Monitoring", "V3"] parent_config = while namespace.any? parent_name = namespace.join "::" parent_const = const_get parent_name break parent_const.configure if parent_const.respond_to? :configure namespace.pop end default_config = Client::Configuration.new parent_config default_config.rpcs.list_monitored_resource_descriptors.timeout = 30.0 default_config.rpcs.list_monitored_resource_descriptors.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.get_monitored_resource_descriptor.timeout = 30.0 default_config.rpcs.get_monitored_resource_descriptor.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.list_metric_descriptors.timeout = 30.0 default_config.rpcs.list_metric_descriptors.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.get_metric_descriptor.timeout = 30.0 default_config.rpcs.get_metric_descriptor.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.create_metric_descriptor.timeout = 12.0 default_config.rpcs.delete_metric_descriptor.timeout = 30.0 default_config.rpcs.delete_metric_descriptor.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.list_time_series.timeout = 90.0 default_config.rpcs.list_time_series.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.create_time_series.timeout = 12.0 default_config end yield @configure if block_given? @configure end
Create a new MetricService
client object.
@example
# Create a client using the default configuration client = ::Google::Cloud::Monitoring::V3::MetricService::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Monitoring::V3::MetricService::Client.new do |config| config.timeout = 10.0 end
@yield [config] Configure the MetricService
client. @yieldparam config [Client::Configuration]
# File lib/google/cloud/monitoring/v3/metric_service/client.rb, line 144 def initialize # These require statements are intentionally placed here to initialize # the gRPC module only when it's required. # See https://github.com/googleapis/toolkit/issues/446 require "gapic/grpc" require "google/monitoring/v3/metric_service_services_pb" # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint && !@config.endpoint.split(".").first.include?("-") credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @metric_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Monitoring::V3::MetricService::Stub, credentials: credentials, endpoint: @config.endpoint, channel_args: @config.channel_args, interceptors: @config.interceptors ) end
Public Instance Methods
Configure the MetricService
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 {::Google::Cloud::Monitoring::V3::MetricService::Client::Configuration} for a description of the configuration fields.
@yield [config] Configure the Client
client. @yieldparam config [Client::Configuration]
@return [Client::Configuration]
# File lib/google/cloud/monitoring/v3/metric_service/client.rb, line 123 def configure yield @config if block_given? @config end
Creates a new metric descriptor. User-created metric descriptors define [custom metrics](cloud.google.com/monitoring/custom-metrics).
@overload create_metric_descriptor
(request, options = nil)
Pass arguments to `create_metric_descriptor` via a request object, either of type {::Google::Cloud::Monitoring::V3::CreateMetricDescriptorRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::CreateMetricDescriptorRequest, ::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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload create_metric_descriptor
(name: nil, metric_descriptor: nil)
Pass arguments to `create_metric_descriptor` 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). @param name [::String] Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on which to execute the request. The format is: 4 projects/[PROJECT_ID_OR_NUMBER] @param metric_descriptor [::Google::Api::MetricDescriptor, ::Hash] Required. The new [custom metric](https://cloud.google.com/monitoring/custom-metrics) descriptor.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Api::MetricDescriptor] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Api::MetricDescriptor]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/metric_service/client.rb, line 537 def create_metric_descriptor request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::CreateMetricDescriptorRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.create_metric_descriptor.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_metric_descriptor.timeout, metadata: metadata, retry_policy: @config.rpcs.create_metric_descriptor.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @metric_service_stub.call_rpc :create_metric_descriptor, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Creates or adds data to one or more time series. The response is empty if all time series in the request were written. If any time series could not be written, a corresponding failure message is included in the error response.
@overload create_time_series
(request, options = nil)
Pass arguments to `create_time_series` via a request object, either of type {::Google::Cloud::Monitoring::V3::CreateTimeSeriesRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::CreateTimeSeriesRequest, ::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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload create_time_series
(name: nil, time_series: nil)
Pass arguments to `create_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). @param 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] @param time_series [::Array<::Google::Cloud::Monitoring::V3::TimeSeries, ::Hash>] Required. The new data to be added to a list of time series. Adds at most one data point to each of several time series. The new data point must be more recent than any other point in its time series. Each `TimeSeries` value must fully specify a unique time series by supplying all label values for the metric and the monitored resource. The maximum number of `TimeSeries` objects per `Create` request is 200.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Protobuf::Empty]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/metric_service/client.rb, line 804 def create_time_series request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::CreateTimeSeriesRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.create_time_series.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_time_series.timeout, metadata: metadata, retry_policy: @config.rpcs.create_time_series.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @metric_service_stub.call_rpc :create_time_series, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Deletes a metric descriptor. Only user-created [custom metrics](cloud.google.com/monitoring/custom-metrics) can be deleted.
@overload delete_metric_descriptor
(request, options = nil)
Pass arguments to `delete_metric_descriptor` via a request object, either of type {::Google::Cloud::Monitoring::V3::DeleteMetricDescriptorRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::DeleteMetricDescriptorRequest, ::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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload delete_metric_descriptor
(name: nil)
Pass arguments to `delete_metric_descriptor` 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). @param name [::String] Required. The metric descriptor on which to execute the request. The format is: projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] An example of `[METRIC_ID]` is: `"custom.googleapis.com/my_test_metric"`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Protobuf::Empty]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/metric_service/client.rb, line 612 def delete_metric_descriptor request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::DeleteMetricDescriptorRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.delete_metric_descriptor.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_metric_descriptor.timeout, metadata: metadata, retry_policy: @config.rpcs.delete_metric_descriptor.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @metric_service_stub.call_rpc :delete_metric_descriptor, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Gets a single metric descriptor. This method does not require a Workspace.
@overload get_metric_descriptor
(request, options = nil)
Pass arguments to `get_metric_descriptor` via a request object, either of type {::Google::Cloud::Monitoring::V3::GetMetricDescriptorRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::GetMetricDescriptorRequest, ::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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload get_metric_descriptor
(name: nil)
Pass arguments to `get_metric_descriptor` 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). @param name [::String] Required. The metric descriptor on which to execute the request. The format is: projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] An example value of `[METRIC_ID]` is `"compute.googleapis.com/instance/disk/read_bytes_count"`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Api::MetricDescriptor] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Api::MetricDescriptor]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/metric_service/client.rb, line 461 def get_metric_descriptor request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::GetMetricDescriptorRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.get_metric_descriptor.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_metric_descriptor.timeout, metadata: metadata, retry_policy: @config.rpcs.get_metric_descriptor.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @metric_service_stub.call_rpc :get_metric_descriptor, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Gets a single monitored resource descriptor. This method does not require a Workspace.
@overload get_monitored_resource_descriptor
(request, options = nil)
Pass arguments to `get_monitored_resource_descriptor` via a request object, either of type {::Google::Cloud::Monitoring::V3::GetMonitoredResourceDescriptorRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::GetMonitoredResourceDescriptorRequest, ::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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload get_monitored_resource_descriptor
(name: nil)
Pass arguments to `get_monitored_resource_descriptor` 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). @param name [::String] Required. The monitored resource descriptor to get. The format is: projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE] The `[RESOURCE_TYPE]` is a predefined type, such as `cloudsql_database`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Api::MonitoredResourceDescriptor] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Api::MonitoredResourceDescriptor]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/metric_service/client.rb, line 301 def get_monitored_resource_descriptor request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::GetMonitoredResourceDescriptorRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.get_monitored_resource_descriptor.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_monitored_resource_descriptor.timeout, metadata: metadata, retry_policy: @config.rpcs.get_monitored_resource_descriptor.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @metric_service_stub.call_rpc :get_monitored_resource_descriptor, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Lists metric descriptors that match a filter. This method does not require a Workspace.
@overload list_metric_descriptors
(request, options = nil)
Pass arguments to `list_metric_descriptors` via a request object, either of type {::Google::Cloud::Monitoring::V3::ListMetricDescriptorsRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::ListMetricDescriptorsRequest, ::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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_metric_descriptors
(name: nil, filter: nil, page_size: nil, page_token: nil)
Pass arguments to `list_metric_descriptors` 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). @param 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] @param filter [::String] If this field is empty, all custom and system-defined metric descriptors are returned. Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) specifies which metric descriptors are to be returned. For example, the following filter matches all [custom metrics](https://cloud.google.com/monitoring/custom-metrics): metric.type = starts_with("custom.googleapis.com/") @param page_size [::Integer] A positive number that is the maximum number of results to return. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Api::MetricDescriptor>] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::PagedEnumerable<::Google::Api::MetricDescriptor>]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/metric_service/client.rb, line 387 def list_metric_descriptors request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::ListMetricDescriptorsRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_metric_descriptors.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_metric_descriptors.timeout, metadata: metadata, retry_policy: @config.rpcs.list_metric_descriptors.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @metric_service_stub.call_rpc :list_metric_descriptors, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @metric_service_stub, :list_metric_descriptors, request, response, operation, options yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Lists monitored resource descriptors that match a filter. This method does not require a Workspace.
@overload list_monitored_resource_descriptors
(request, options = nil)
Pass arguments to `list_monitored_resource_descriptors` via a request object, either of type {::Google::Cloud::Monitoring::V3::ListMonitoredResourceDescriptorsRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::ListMonitoredResourceDescriptorsRequest, ::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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_monitored_resource_descriptors
(name: nil, filter: nil, page_size: nil, page_token: nil)
Pass arguments to `list_monitored_resource_descriptors` 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). @param 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] @param filter [::String] An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) describing the descriptors to be returned. The filter can reference the descriptor's type and labels. For example, the following filter returns only Google Compute Engine descriptors that have an `id` label: resource.type = starts_with("gce_") AND resource.label:id @param page_size [::Integer] A positive number that is the maximum number of results to return. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Api::MonitoredResourceDescriptor>] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::PagedEnumerable<::Google::Api::MonitoredResourceDescriptor>]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/metric_service/client.rb, line 227 def list_monitored_resource_descriptors request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::ListMonitoredResourceDescriptorsRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_monitored_resource_descriptors.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_monitored_resource_descriptors.timeout, metadata: metadata, retry_policy: @config.rpcs.list_monitored_resource_descriptors.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @metric_service_stub.call_rpc :list_monitored_resource_descriptors, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @metric_service_stub, :list_monitored_resource_descriptors, request, response, operation, options yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Lists time series that match a filter. This method does not require a Workspace.
@overload list_time_series
(request, options = nil)
Pass arguments to `list_time_series` via a request object, either of type {::Google::Cloud::Monitoring::V3::ListTimeSeriesRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::ListTimeSeriesRequest, ::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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_time_series
(name: nil, filter: nil, interval: nil, aggregation: nil, secondary_aggregation: nil, order_by: nil, view: nil, page_size: nil, page_token: nil)
Pass arguments to `list_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). @param name [::String] Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name), organization or folder on which to execute the request. The format is: projects/[PROJECT_ID_OR_NUMBER] organizations/[ORGANIZATION_ID] folders/[FOLDER_ID] @param filter [::String] Required. A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies which time series should be returned. The filter must specify a single metric type, and can additionally specify metric labels and other information. For example: metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND metric.labels.instance_name = "my-instance-name" @param interval [::Google::Cloud::Monitoring::V3::TimeInterval, ::Hash] Required. The time interval for which results should be returned. Only time series that contain data points in the specified interval are included in the response. @param aggregation [::Google::Cloud::Monitoring::V3::Aggregation, ::Hash] Specifies the alignment of data points in individual time series as well as how to combine the retrieved time series across specified labels. By default (if no `aggregation` is explicitly specified), the raw time series data is returned. @param secondary_aggregation [::Google::Cloud::Monitoring::V3::Aggregation, ::Hash] Apply a second aggregation after `aggregation` is applied. May only be specified if `aggregation` is specified. @param order_by [::String] Unsupported: must be left blank. The points in each time series are currently returned in reverse time order (most recent to oldest). @param view [::Google::Cloud::Monitoring::V3::ListTimeSeriesRequest::TimeSeriesView] Required. Specifies which information is returned about the time series. @param page_size [::Integer] A positive number that is the maximum number of results to return. If `page_size` is empty or more than 100,000 results, the effective `page_size` is 100,000 results. If `view` is set to `FULL`, this is the maximum number of `Points` returned. If `view` is set to `HEADERS`, this is the maximum number of `TimeSeries` returned. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::TimeSeries>] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::TimeSeries>]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/metric_service/client.rb, line 721 def list_time_series request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::ListTimeSeriesRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_time_series.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_time_series.timeout, metadata: metadata, retry_policy: @config.rpcs.list_time_series.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @metric_service_stub.call_rpc :list_time_series, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @metric_service_stub, :list_time_series, request, response, operation, options yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end