Module: Google::Cloud

Defined in:
lib/google-cloud-error_reporting.rb,
lib/google/cloud/error_reporting.rb,
lib/google/cloud/error_reporting/rails.rb,
lib/google/cloud/error_reporting/project.rb,
lib/google/cloud/error_reporting/service.rb,
lib/google/cloud/error_reporting/version.rb,
lib/google/cloud/error_reporting/middleware.rb,
lib/google/cloud/error_reporting/credentials.rb,
lib/google/cloud/error_reporting/error_event.rb,
lib/google/cloud/error_reporting/async_error_reporter.rb,
lib/google/cloud/error_reporting/v1beta1/doc/overview.rb,
lib/google/cloud/error_reporting/v1beta1/error_group_service_client.rb,
lib/google/cloud/error_reporting/v1beta1/error_stats_service_client.rb,
lib/google/cloud/error_reporting/v1beta1/report_errors_service_client.rb

Defined Under Namespace

Modules: ErrorReporting

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.error_reporting(project_id = nil, credentials = nil, scope: nil, timeout: nil, client_config: nil) ⇒ Google::Cloud::ErrorReporting::Project

Create a new object for connecting to the Stackdriver Error Reporting service. Each call creates a new connection.

For more information on connecting to Google Cloud see the Authentication Guide

Examples:

require "google/cloud/error_reporting"

error_reporting =
  Google::Cloud.error_reporting "GCP_Project_ID",
                                "/path/to/gcp/secretkey.json"

error_event = error_reporting.error_event "Error with Backtrace",
                                          event_time: Time.now,
                                          service_name: "my_app_name",
                                          service_version: "v8"
error_reporting.report error_event

Parameters:

  • project_id (String) (defaults to: nil)

    Google Cloud Platform project identifier for the Stackdriver Error Reporting service you are connecting to. If not present, the default project for the credentials is used.

  • credentials (String, Hash, Google::Auth::Credentials) (defaults to: nil)

    The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object. (See Google::Cloud::ErrorReporting::Credentials)

  • scope (String, Array<String>)

    The OAuth 2.0 scopes controlling the set of resources and operations that the connection can access. See Using OAuth 2.0 to Access Google APIs.

    The default scope is:

    • https://www.googleapis.com/auth/cloud-platform
  • timeout (Integer)

    Default timeout to use in requests. Optional.

  • client_config (Hash)

    A hash of values to override the default behavior of the API client. Optional.

Returns:



109
110
111
112
113
114
115
116
# File 'lib/google-cloud-error_reporting.rb', line 109

def self.error_reporting project_id = nil, credentials = nil, scope: nil,
                         timeout: nil, client_config: nil
  require "google/cloud/error_reporting"
  Google::Cloud::ErrorReporting.new project_id: project_id,
                                    credentials: credentials,
                                    scope: scope, timeout: timeout,
                                    client_config: client_config
end

Instance Method Details

#error_reporting(scope: nil, timeout: nil, client_config: nil) ⇒ Google::Cloud::ErrorReporting::Project

Create a new object for connecting to the Stackdriver Error Reporting service. Each call creates a new connection.

For more information on connecting to Google Cloud see the Authentication Guide

Examples:

require "google/cloud/error_reporting"

gcloud = Google::Cloud.new "GCP_Project_ID",
                           "/path/to/gcp/secretkey.json"
error_reporting = gcloud.error_reporting

error_event = error_reporting.error_event "Error with Backtrace",
                                          event_time: Time.now,
                                          service_name: "my_app_name",
                                          service_version: "v8"
error_reporting.report error_event

Parameters:

  • scope (String, Array<String>)

    The OAuth 2.0 scopes controlling the set of resources and operations that the connection can access. See Using OAuth 2.0 to Access Google APIs.

    The default scope is:

    • https://www.googleapis.com/auth/cloud-platform
  • timeout (Integer)

    Default timeout to use in requests. Optional.

  • client_config (Hash)

    A hash of values to override the default behavior of the API client. Optional.

Returns:



61
62
63
64
65
66
# File 'lib/google-cloud-error_reporting.rb', line 61

def error_reporting scope: nil, timeout: nil, client_config: nil
  Google::Cloud.error_reporting @project, @keyfile,
                                scope: scope,
                                timeout: (timeout || @timeout),
                                client_config: client_config
end