Module: Google::Cloud

Defined in:
lib/google-cloud-trace.rb,
lib/google/cloud/trace.rb,
lib/google/cloud/trace/span.rb,
lib/google/cloud/trace/rails.rb,
lib/google/cloud/trace/utils.rb,
lib/google/cloud/trace/project.rb,
lib/google/cloud/trace/service.rb,
lib/google/cloud/trace/version.rb,
lib/google/cloud/trace/label_key.rb,
lib/google/cloud/trace/span_kind.rb,
lib/google/cloud/trace/middleware.rb,
lib/google/cloud/trace/result_set.rb,
lib/google/cloud/trace/credentials.rb,
lib/google/cloud/trace/time_sampler.rb,
lib/google/cloud/trace/trace_record.rb,
lib/google/cloud/trace/notifications.rb,
lib/google/cloud/trace/async_reporter.rb,
lib/google/cloud/trace/faraday_middleware.rb,
lib/google/cloud/trace/v1/trace_service_client.rb

Defined Under Namespace

Modules: Trace

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.trace(project = nil, keyfile = nil, scope: nil, timeout: nil, client_config: nil) ⇒ Google::Cloud::Trace::Project

Creates a new object for connecting to the Stackdriver Trace service. Each call creates a new connection.

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

Examples:

require "google/cloud"

trace_client = Google::Cloud.trace

traces = trace_client.list_traces Time.now - 3600, Time.now
traces.each do |trace|
  puts "Retrieved trace ID: #{trace.trace_id}"
end

Parameters:

  • project (String) (defaults to: nil)

    Project identifier for the Stackdriver Trace service.

  • keyfile (String, Hash) (defaults to: nil)

    Keyfile downloaded from Google Cloud: either the JSON data or the path to a readable file.

  • 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.

Returns:



89
90
91
92
93
94
95
# File 'lib/google-cloud-trace.rb', line 89

def self.trace project = nil, keyfile = nil, scope: nil, timeout: nil,
               client_config: nil
  require "google/cloud/trace"
  Google::Cloud::Trace.new project: project, keyfile: keyfile,
                           scope: scope, timeout: timeout,
                           client_config: client_config
end

Instance Method Details

#trace(scope: nil, timeout: nil, client_config: nil) ⇒ Google::Cloud::Trace::Project

Creates a new object for connecting to the Stackdriver Trace service. Each call creates a new connection.

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

Examples:

require "google/cloud"

gcloud = Google::Cloud.new
trace_client = gcloud.trace

traces = trace_client.list_traces Time.now - 3600, Time.now
traces.each do |trace|
  puts "Retrieved trace ID: #{trace.trace_id}"
end

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.

Returns:



53
54
55
56
57
# File 'lib/google-cloud-trace.rb', line 53

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