Class: Google::Cloud::Trace::Project
- Inherits:
-
Object
- Object
- Google::Cloud::Trace::Project
- Defined in:
- lib/google/cloud/trace/project.rb
Overview
Project
Projects are top-level containers in Google Cloud Platform. They store information about billing and authorized users, and they control access to Stackdriver Trace resources. Each project has a friendly name and a unique ID. Projects can be created only in the Google Developers Console.
This class is a client to make API calls for the project's trace data.
Create an instance using new or
Google::Cloud#trace. You may then use the get_trace
method to
retrieve a trace by ID, list_traces
to query for a set of traces,
and patch_traces
to update trace data. You may also use new_trace
as a convenience constructor to build a
TraceRecord object.
Instance Method Summary collapse
-
#get_trace(trace_id) ⇒ Google::Cloud::Trace::TraceRecord?
Gets a single trace by its ID.
-
#list_traces(start_time, end_time, filter: nil, order_by: nil, view: nil, page_size: nil, page_token: nil) ⇒ Google::Cloud::Trace::ResultSet
Returns of a list of traces that match the specified conditions.
-
#new_trace(trace_context: :DEFAULT) ⇒ Google::Cloud::Trace::TraceRecord
Create a new empty trace record for this project.
-
#patch_traces(traces) ⇒ Array{Google::Cloud::Trace::TraceRecord}
Sends new traces to Stackdriver Trace or updates existing traces.
-
#project ⇒ String
The ID of the current project.
Instance Method Details
#get_trace(trace_id) ⇒ Google::Cloud::Trace::TraceRecord?
Gets a single trace by its ID.
146 147 148 149 |
# File 'lib/google/cloud/trace/project.rb', line 146 def get_trace trace_id ensure_service! service.get_trace trace_id end |
#list_traces(start_time, end_time, filter: nil, order_by: nil, view: nil, page_size: nil, page_token: nil) ⇒ Google::Cloud::Trace::ResultSet
Returns of a list of traces that match the specified conditions. You must provide a time interval. You may optionally provide a filter, an ordering, a view type. Results are paginated, and you may specify a page size. The result will come with a token you can pass back to retrieve the next page.
184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/google/cloud/trace/project.rb', line 184 def list_traces start_time, end_time, filter: nil, order_by: nil, view: nil, page_size: nil, page_token: nil ensure_service! service.list_traces project, start_time, end_time, filter: filter, order_by: order_by, view: view, page_size: page_size, page_token: page_token end |
#new_trace(trace_context: :DEFAULT) ⇒ Google::Cloud::Trace::TraceRecord
Create a new empty trace record for this project. Uses the current thread's TraceContext by default; otherwise you may provide a specific TraceContext.
96 97 98 99 100 101 |
# File 'lib/google/cloud/trace/project.rb', line 96 def new_trace trace_context: :DEFAULT if trace_context == :DEFAULT trace_context = Stackdriver::Core::TraceContext.get end Google::Cloud::Trace::TraceRecord.new project, trace_context end |
#patch_traces(traces) ⇒ Array{Google::Cloud::Trace::TraceRecord}
Sends new traces to Stackdriver Trace or updates existing traces. If the ID of a trace that you send matches that of an existing trace, any fields in the existing trace and its spans are overwritten by the provided values, and any new fields provided are merged with the existing trace data. If the ID does not match, a new trace is created.
127 128 129 130 |
# File 'lib/google/cloud/trace/project.rb', line 127 def patch_traces traces ensure_service! service.patch_traces traces end |
#project ⇒ String
The ID of the current project.
70 71 72 |
# File 'lib/google/cloud/trace/project.rb', line 70 def project service.project end |