Skip to content

Commit

Permalink
Add ServiceMonitoringService
Browse files Browse the repository at this point in the history
* Add ServiceMonitoringServiceClient with the following RPC methods:
  * create_service
  * get_service
  * list_services
  * update_service
  * delete_service
  * create_service_level_objective
  * get_service_level_objective
  * list_service_level_objectives
  * update_service_level_objective
  * delete_service_level_objective
* Add new Google::Monitoring::V3 classes:
  * Service
  * Service::Custom
  * Service::AppEngine
  * Service::CloudEndpoints
  * Service::ClusterIstio
  * Service::Telemetry
  * ServiceLevelObjective
  * ServiceLevelIndicator
  * BasicSli
  * BasicSli::AvailabilityCriteria
  * BasicSli::LatencyCriteria
  * Range
  * RequestBasedSli
  * TimeSeriesRatio
  * DistributionCut
  * WindowsBasedSli
  * WindowsBasedSli::PerformanceThreshold
  * WindowsBasedSli::MetricRange

pr: #4407
  • Loading branch information
yoshi-automation authored and blowmage committed Nov 14, 2019
1 parent a6f5590 commit 1d9dbf2
Show file tree
Hide file tree
Showing 16 changed files with 2,667 additions and 36 deletions.
5 changes: 4 additions & 1 deletion google-cloud-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
[Stackdriver Monitoring API][Product Documentation]:
Manages your Stackdriver Monitoring data and configurations. Most projects
must be associated with a Stackdriver account, with a few exceptions as
noted on the individual method pages.
noted on the individual method pages. The table entries below are
presented in alphabetical order, not in order of common use. For
explanations of the concepts found in the table entries, read the
[Stackdriver Monitoring documentation](/monitoring/docs).
- [Client Library Documentation][]
- [Product Documentation][]

Expand Down
64 changes: 63 additions & 1 deletion google-cloud-monitoring/lib/google/cloud/monitoring.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ module Cloud
# [Stackdriver Monitoring API][Product Documentation]:
# Manages your Stackdriver Monitoring data and configurations. Most projects
# must be associated with a Stackdriver account, with a few exceptions as
# noted on the individual method pages.
# noted on the individual method pages. The table entries below are
# presented in alphabetical order, not in order of common use. For
# explanations of the concepts found in the table entries, read the
# [Stackdriver Monitoring documentation](/monitoring/docs).
# - [Product Documentation][]
#
# ## Quick Start
Expand Down Expand Up @@ -355,6 +358,65 @@ def self.new(*args, version: :v3, **kwargs)
end
end

module ServiceMonitoring
##
# The Stackdriver Monitoring Service-Oriented Monitoring API has endpoints for
# managing and querying aspects of a workspace's services. These include the
# `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy
# of categorized Health Metrics.
#
# @param version [Symbol, String]
# The major version of the service to be used. By default :v3
# is used.
# @overload new(version:, credentials:, scopes:, client_config:, timeout:)
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
# Provides the means for authenticating requests made by the client. This parameter can
# be many types.
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
# authenticating requests made by this client.
# A `String` will be treated as the path to the keyfile to be used for the construction of
# credentials for this client.
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
# credentials for this client.
# A `GRPC::Core::Channel` will be used to make calls through.
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
# should already be composed with a `GRPC::Core::CallCredentials` object.
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
# metadata for requests, generally, to give OAuth credentials.
# @param scopes [Array<String>]
# The OAuth scopes for this service. This parameter is ignored if
# an updater_proc is supplied.
# @param client_config [Hash]
# A Hash for call options for each method. See
# Google::Gax#construct_settings for the structure of
# this data. Falls back to the default config if not specified
# or the specified config is missing data points.
# @param timeout [Numeric]
# The default timeout, in seconds, for calls made through this client.
# @param metadata [Hash]
# Default metadata to be sent with each request. This can be overridden on a per call basis.
# @param service_address [String]
# Override for the service hostname, or `nil` to leave as the default.
# @param service_port [Integer]
# Override for the service port, or `nil` to leave as the default.
# @param exception_transformer [Proc]
# An optional proc that intercepts any exceptions raised during an API call to inject
# custom error handling.
def self.new(*args, version: :v3, **kwargs)
unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
raise "The version: #{version} is not available. The available versions " \
"are: [#{AVAILABLE_VERSIONS.join(", ")}]"
end

require "#{FILE_DIR}/#{version.to_s.downcase}"
version_module = Google::Cloud::Monitoring
.constants
.select {|sym| sym.to_s.downcase == version.to_s.downcase}
.first
Google::Cloud::Monitoring.const_get(version_module)::ServiceMonitoring.new(*args, **kwargs)
end
end

module UptimeCheck
##
# The UptimeCheckService API is used to manage (list, create, delete, edit)
Expand Down
73 changes: 72 additions & 1 deletion google-cloud-monitoring/lib/google/cloud/monitoring/v3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
require "google/cloud/monitoring/v3/group_service_client"
require "google/cloud/monitoring/v3/metric_service_client"
require "google/cloud/monitoring/v3/notification_channel_service_client"
require "google/cloud/monitoring/v3/service_monitoring_service_client"
require "google/cloud/monitoring/v3/uptime_check_service_client"
require "google/monitoring/v3/span_context_pb"
require "google/monitoring/v3/dropped_labels_pb"
Expand All @@ -32,7 +33,10 @@ module Monitoring
# [Stackdriver Monitoring API][Product Documentation]:
# Manages your Stackdriver Monitoring data and configurations. Most projects
# must be associated with a Stackdriver account, with a few exceptions as
# noted on the individual method pages.
# noted on the individual method pages. The table entries below are
# presented in alphabetical order, not in order of common use. For
# explanations of the concepts found in the table entries, read the
# [Stackdriver Monitoring documentation](/monitoring/docs).
# - [Product Documentation][]
#
# ## Quick Start
Expand Down Expand Up @@ -385,6 +389,73 @@ def self.new \
end
end

module ServiceMonitoring
##
# The Stackdriver Monitoring Service-Oriented Monitoring API has endpoints for
# managing and querying aspects of a workspace's services. These include the
# `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy
# of categorized Health Metrics.
#
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
# Provides the means for authenticating requests made by the client. This parameter can
# be many types.
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
# authenticating requests made by this client.
# A `String` will be treated as the path to the keyfile to be used for the construction of
# credentials for this client.
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
# credentials for this client.
# A `GRPC::Core::Channel` will be used to make calls through.
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
# should already be composed with a `GRPC::Core::CallCredentials` object.
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
# metadata for requests, generally, to give OAuth credentials.
# @param scopes [Array<String>]
# The OAuth scopes for this service. This parameter is ignored if
# an updater_proc is supplied.
# @param client_config [Hash]
# A Hash for call options for each method. See
# Google::Gax#construct_settings for the structure of
# this data. Falls back to the default config if not specified
# or the specified config is missing data points.
# @param timeout [Numeric]
# The default timeout, in seconds, for calls made through this client.
# @param metadata [Hash]
# Default metadata to be sent with each request. This can be overridden on a per call basis.
# @param service_address [String]
# Override for the service hostname, or `nil` to leave as the default.
# @param service_port [Integer]
# Override for the service port, or `nil` to leave as the default.
# @param exception_transformer [Proc]
# An optional proc that intercepts any exceptions raised during an API call to inject
# custom error handling.
def self.new \
credentials: nil,
scopes: nil,
client_config: nil,
timeout: nil,
metadata: nil,
service_address: nil,
service_port: nil,
exception_transformer: nil,
lib_name: nil,
lib_version: nil
kwargs = {
credentials: credentials,
scopes: scopes,
client_config: client_config,
timeout: timeout,
metadata: metadata,
exception_transformer: exception_transformer,
lib_name: lib_name,
service_address: service_address,
service_port: service_port,
lib_version: lib_version
}.select { |_, v| v != nil }
Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.new(**kwargs)
end
end

module UptimeCheck
##
# The UptimeCheckService API is used to manage (list, create, delete, edit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@
},
"methods": {
"ListAlertPolicies": {
"timeout_millis": 30000,
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"GetAlertPolicy": {
"timeout_millis": 30000,
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"CreateAlertPolicy": {
"timeout_millis": 30000,
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"DeleteAlertPolicy": {
"timeout_millis": 30000,
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"UpdateAlertPolicy": {
"timeout_millis": 30000,
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
}
Expand Down
Loading

0 comments on commit 1d9dbf2

Please sign in to comment.