Class: Google::Apis::TracingV1::Span

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/tracing_v1/classes.rb,
generated/google/apis/tracing_v1/representations.rb,
generated/google/apis/tracing_v1/representations.rb

Overview

A span represents a single operation within a trace. Spans can be nested to form a trace tree. Often, a trace contains a root span that describes the end-to-end latency and, optionally, one or more subspans for its sub-operations. (A trace could alternatively contain multiple root spans, or none at all.) Spans do not need to be contiguous. There may be gaps and/or overlaps between spans in a trace.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::JsonObjectSupport

#to_json

Methods included from Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ Span

Returns a new instance of Span



573
574
575
# File 'generated/google/apis/tracing_v1/classes.rb', line 573

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#attributesHash<String,Google::Apis::TracingV1::AttributeValue>

Properties of a span in key:value format. The maximum length for the key is 128 characters. The value can be a string (up to 2000 characters), int, or boolean. Some common pair examples: "/instance_id": "my-instance" "/zone": "us-central1-a" "/grpc/peer_address": "ip:port" (dns, etc.) "/grpc/deadline": "Duration" "/http/user_agent" "/http/request_bytes": 300 "/http/response_bytes": 1200 "/http/url": google.com/apis "abc.com/myattribute": true Corresponds to the JSON property attributes

Returns:



464
465
466
# File 'generated/google/apis/tracing_v1/classes.rb', line 464

def attributes
  @attributes
end

#has_remote_parentBoolean Also known as: has_remote_parent?

True if this span has a remote parent (is an RPC server span). Corresponds to the JSON property hasRemoteParent

Returns:

  • (Boolean)


484
485
486
# File 'generated/google/apis/tracing_v1/classes.rb', line 484

def has_remote_parent
  @has_remote_parent
end

#idFixnum

Identifier for the span. Must be a 64-bit integer other than 0 and unique within a trace. Corresponds to the JSON property id

Returns:

  • (Fixnum)


470
471
472
# File 'generated/google/apis/tracing_v1/classes.rb', line 470

def id
  @id
end

A collection of links, which are references from this span to another span in a different trace. Corresponds to the JSON property links

Returns:



571
572
573
# File 'generated/google/apis/tracing_v1/classes.rb', line 571

def links
  @links
end

#local_end_timeString

End time of the span. On the client side, this is the local machine clock time at which the span execution was ended; on the server side, this is the time at which the server application handler stopped running. Corresponds to the JSON property localEndTime

Returns:

  • (String)


494
495
496
# File 'generated/google/apis/tracing_v1/classes.rb', line 494

def local_end_time
  @local_end_time
end

#local_start_timeString

Start time of the span. On the client side, this is the local machine clock time at which the span execution was started; on the server side, this is the time at which the server application handler started running. Corresponds to the JSON property localStartTime

Returns:

  • (String)


479
480
481
# File 'generated/google/apis/tracing_v1/classes.rb', line 479

def local_start_time
  @local_start_time
end

#nameString

Name of the span. The span name is sanitized and displayed in the Stackdriver Trace tool in the % dynamic print site_values.console_name %. The name may be a method name or some other per-call site name. For the same executable and the same call point, a best practice is to use a consistent name, which makes it easier to correlate cross-trace spans. Corresponds to the JSON property name

Returns:

  • (String)


560
561
562
# File 'generated/google/apis/tracing_v1/classes.rb', line 560

def name
  @name
end

#parent_idFixnum

ID of the parent span. If this is a root span, the value must be 0 or empty. Corresponds to the JSON property parentId

Returns:

  • (Fixnum)


500
501
502
# File 'generated/google/apis/tracing_v1/classes.rb', line 500

def parent_id
  @parent_id
end

#stack_traceGoogle::Apis::TracingV1::StackTrace

StackTrace collected in a trace. Corresponds to the JSON property stackTrace



565
566
567
# File 'generated/google/apis/tracing_v1/classes.rb', line 565

def stack_trace
  @stack_trace
end

#statusGoogle::Apis::TracingV1::Status

The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. The error model is designed to be:

  • Simple to use and understand for most users
  • Flexible enough to meet unexpected needs # Overview The Status message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package google.rpc which can be used for common error conditions. # Language mapping The Status message is the logical representation of the error model, but it is not necessarily the actual wire format. When the Status message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the Status message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include:
  • Partial errors. If a service needs to return partial errors to the client, it may embed the Status in the normal response to indicate the partial errors.
  • Workflow errors. A typical workflow has multiple steps. Each step may have a Status message for error reporting purpose.
  • Batch operations. If a client uses batch request and batch response, the Status message should be used directly inside batch response, one for each error sub-response.
  • Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the Status message.
  • Logging. If some API errors are stored in logs, the message Status could be used directly after any stripping needed for security/privacy reasons. Corresponds to the JSON property status


550
551
552
# File 'generated/google/apis/tracing_v1/classes.rb', line 550

def status
  @status
end

#time_eventsArray<Google::Apis::TracingV1::TimeEvent>

A collection of TimeEvents. A TimeEvent is a time-stamped annotation on the span, consisting of either user-supplied key:value pairs, or details of an RPC message sent/received on the network. Corresponds to the JSON property timeEvents



507
508
509
# File 'generated/google/apis/tracing_v1/classes.rb', line 507

def time_events
  @time_events
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



578
579
580
581
582
583
584
585
586
587
588
589
590
# File 'generated/google/apis/tracing_v1/classes.rb', line 578

def update!(**args)
  @attributes = args[:attributes] if args.key?(:attributes)
  @id = args[:id] if args.key?(:id)
  @local_start_time = args[:local_start_time] if args.key?(:local_start_time)
  @has_remote_parent = args[:has_remote_parent] if args.key?(:has_remote_parent)
  @local_end_time = args[:local_end_time] if args.key?(:local_end_time)
  @parent_id = args[:parent_id] if args.key?(:parent_id)
  @time_events = args[:time_events] if args.key?(:time_events)
  @status = args[:status] if args.key?(:status)
  @name = args[:name] if args.key?(:name)
  @stack_trace = args[:stack_trace] if args.key?(:stack_trace)
  @links = args[:links] if args.key?(:links)
end