Class: OCI::ApmTraces::Models::Span

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/apm_traces/models/span.rb

Overview

Definition of a span object.

Constant Summary collapse

SOURCE_NAME_ENUM =
[
  SOURCE_NAME_SPANS = 'SPANS'.freeze,
  SOURCE_NAME_SYN_SPANS = 'SYN_SPANS'.freeze,
  SOURCE_NAME_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Span

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/oci/apm_traces/models/span.rb', line 155

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.key = attributes[:'key'] if attributes[:'key']

  self.parent_span_key = attributes[:'parentSpanKey'] if attributes[:'parentSpanKey']

  raise 'You cannot provide both :parentSpanKey and :parent_span_key' if attributes.key?(:'parentSpanKey') && attributes.key?(:'parent_span_key')

  self.parent_span_key = attributes[:'parent_span_key'] if attributes[:'parent_span_key']

  self.trace_key = attributes[:'traceKey'] if attributes[:'traceKey']

  raise 'You cannot provide both :traceKey and :trace_key' if attributes.key?(:'traceKey') && attributes.key?(:'trace_key')

  self.trace_key = attributes[:'trace_key'] if attributes[:'trace_key']

  self.time_started = attributes[:'timeStarted'] if attributes[:'timeStarted']

  raise 'You cannot provide both :timeStarted and :time_started' if attributes.key?(:'timeStarted') && attributes.key?(:'time_started')

  self.time_started = attributes[:'time_started'] if attributes[:'time_started']

  self.time_ended = attributes[:'timeEnded'] if attributes[:'timeEnded']

  raise 'You cannot provide both :timeEnded and :time_ended' if attributes.key?(:'timeEnded') && attributes.key?(:'time_ended')

  self.time_ended = attributes[:'time_ended'] if attributes[:'time_ended']

  self.duration_in_ms = attributes[:'durationInMs'] if attributes[:'durationInMs']

  raise 'You cannot provide both :durationInMs and :duration_in_ms' if attributes.key?(:'durationInMs') && attributes.key?(:'duration_in_ms')

  self.duration_in_ms = attributes[:'duration_in_ms'] if attributes[:'duration_in_ms']

  self.operation_name = attributes[:'operationName'] if attributes[:'operationName']

  raise 'You cannot provide both :operationName and :operation_name' if attributes.key?(:'operationName') && attributes.key?(:'operation_name')

  self.operation_name = attributes[:'operation_name'] if attributes[:'operation_name']

  self.service_name = attributes[:'serviceName'] if attributes[:'serviceName']

  raise 'You cannot provide both :serviceName and :service_name' if attributes.key?(:'serviceName') && attributes.key?(:'service_name')

  self.service_name = attributes[:'service_name'] if attributes[:'service_name']

  self.kind = attributes[:'kind'] if attributes[:'kind']

  self.tags = attributes[:'tags'] if attributes[:'tags']

  self. = attributes[:'tagsMetadata'] if attributes[:'tagsMetadata']

  raise 'You cannot provide both :tagsMetadata and :tags_metadata' if attributes.key?(:'tagsMetadata') && attributes.key?(:'tags_metadata')

  self. = attributes[:'tags_metadata'] if attributes[:'tags_metadata']

  self.logs = attributes[:'logs'] if attributes[:'logs']

  self.is_error = attributes[:'isError'] unless attributes[:'isError'].nil?

  raise 'You cannot provide both :isError and :is_error' if attributes.key?(:'isError') && attributes.key?(:'is_error')

  self.is_error = attributes[:'is_error'] unless attributes[:'is_error'].nil?

  self.source_name = attributes[:'sourceName'] if attributes[:'sourceName']

  raise 'You cannot provide both :sourceName and :source_name' if attributes.key?(:'sourceName') && attributes.key?(:'source_name')

  self.source_name = attributes[:'source_name'] if attributes[:'source_name']
end

Instance Attribute Details

#duration_in_msInteger

[Required] Total span duration in milliseconds.

Returns:

  • (Integer)


49
50
51
# File 'lib/oci/apm_traces/models/span.rb', line 49

def duration_in_ms
  @duration_in_ms
end

#is_errorBOOLEAN

[Required] Indicates if the span has an error.

Returns:

  • (BOOLEAN)


84
85
86
# File 'lib/oci/apm_traces/models/span.rb', line 84

def is_error
  @is_error
end

#keyString

[Required] Unique identifier (spanId) for the span. Note that this field is defined as spanKey in the API and it maps to the spanId in the trace data in Application Performance Monitoring.

Returns:

  • (String)


24
25
26
# File 'lib/oci/apm_traces/models/span.rb', line 24

def key
  @key
end

#kindString

Kind associated with the span.

Returns:

  • (String)


64
65
66
# File 'lib/oci/apm_traces/models/span.rb', line 64

def kind
  @kind
end

#logsArray<OCI::ApmTraces::Models::SpanLogCollection>

List of logs associated with the span.



79
80
81
# File 'lib/oci/apm_traces/models/span.rb', line 79

def logs
  @logs
end

#operation_nameString

[Required] Span name associated with the trace. This is usually the method or URI of the request.

Returns:

  • (String)


54
55
56
# File 'lib/oci/apm_traces/models/span.rb', line 54

def operation_name
  @operation_name
end

#parent_span_keyString

Unique parent identifier for the span if one exists. For root spans this will be null.

Returns:

  • (String)


29
30
31
# File 'lib/oci/apm_traces/models/span.rb', line 29

def parent_span_key
  @parent_span_key
end

#service_nameString

Service name associated with the span.

Returns:

  • (String)


59
60
61
# File 'lib/oci/apm_traces/models/span.rb', line 59

def service_name
  @service_name
end

#source_nameString

Source of span (spans, syn_spans).

Returns:

  • (String)


89
90
91
# File 'lib/oci/apm_traces/models/span.rb', line 89

def source_name
  @source_name
end

#tagsArray<OCI::ApmTraces::Models::Tag>

List of tags associated with the span.

Returns:



69
70
71
# File 'lib/oci/apm_traces/models/span.rb', line 69

def tags
  @tags
end

#tags_metadataHash<String, OCI::ApmTraces::Models::TagMetadata>

Metadata about the tags in the span.

Returns:



74
75
76
# File 'lib/oci/apm_traces/models/span.rb', line 74

def 
  @tags_metadata
end

#time_endedDateTime

[Required] Span end time. Timestamp when the span was completed.

Returns:

  • (DateTime)


44
45
46
# File 'lib/oci/apm_traces/models/span.rb', line 44

def time_ended
  @time_ended
end

#time_startedDateTime

[Required] Span start time. Timestamp when the span was started.

Returns:

  • (DateTime)


39
40
41
# File 'lib/oci/apm_traces/models/span.rb', line 39

def time_started
  @time_started
end

#trace_keyString

[Required] Unique identifier for the trace.

Returns:

  • (String)


34
35
36
# File 'lib/oci/apm_traces/models/span.rb', line 34

def trace_key
  @trace_key
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/oci/apm_traces/models/span.rb', line 92

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'key': :'key',
    'parent_span_key': :'parentSpanKey',
    'trace_key': :'traceKey',
    'time_started': :'timeStarted',
    'time_ended': :'timeEnded',
    'duration_in_ms': :'durationInMs',
    'operation_name': :'operationName',
    'service_name': :'serviceName',
    'kind': :'kind',
    'tags': :'tags',
    'tags_metadata': :'tagsMetadata',
    'logs': :'logs',
    'is_error': :'isError',
    'source_name': :'sourceName'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/oci/apm_traces/models/span.rb', line 114

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'key': :'String',
    'parent_span_key': :'String',
    'trace_key': :'String',
    'time_started': :'DateTime',
    'time_ended': :'DateTime',
    'duration_in_ms': :'Integer',
    'operation_name': :'String',
    'service_name': :'String',
    'kind': :'String',
    'tags': :'Array<OCI::ApmTraces::Models::Tag>',
    'tags_metadata': :'Hash<String, OCI::ApmTraces::Models::TagMetadata>',
    'logs': :'Array<OCI::ApmTraces::Models::SpanLogCollection>',
    'is_error': :'BOOLEAN',
    'source_name': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/oci/apm_traces/models/span.rb', line 250

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    key == other.key &&
    parent_span_key == other.parent_span_key &&
    trace_key == other.trace_key &&
    time_started == other.time_started &&
    time_ended == other.time_ended &&
    duration_in_ms == other.duration_in_ms &&
    operation_name == other.operation_name &&
    service_name == other.service_name &&
    kind == other.kind &&
    tags == other.tags &&
     == other. &&
    logs == other.logs &&
    is_error == other.is_error &&
    source_name == other.source_name
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/oci/apm_traces/models/span.rb', line 293

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


273
274
275
# File 'lib/oci/apm_traces/models/span.rb', line 273

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



282
283
284
# File 'lib/oci/apm_traces/models/span.rb', line 282

def hash
  [key, parent_span_key, trace_key, time_started, time_ended, duration_in_ms, operation_name, service_name, kind, tags, , logs, is_error, source_name].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



326
327
328
329
330
331
332
333
334
335
# File 'lib/oci/apm_traces/models/span.rb', line 326

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



320
321
322
# File 'lib/oci/apm_traces/models/span.rb', line 320

def to_s
  to_hash.to_s
end