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.

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):



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
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
# File 'lib/oci/apm_traces/models/span.rb', line 132

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.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?
end

Instance Attribute Details

#duration_in_msInteger

[Required] Total span duration in milliseconds.

Returns:

  • (Integer)


42
43
44
# File 'lib/oci/apm_traces/models/span.rb', line 42

def duration_in_ms
  @duration_in_ms
end

#is_errorBOOLEAN

[Required] Indicates if the span has an error.

Returns:

  • (BOOLEAN)


72
73
74
# File 'lib/oci/apm_traces/models/span.rb', line 72

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)


17
18
19
# File 'lib/oci/apm_traces/models/span.rb', line 17

def key
  @key
end

#kindString

Kind associated with the span.

Returns:

  • (String)


57
58
59
# File 'lib/oci/apm_traces/models/span.rb', line 57

def kind
  @kind
end

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

List of logs associated with the span.



67
68
69
# File 'lib/oci/apm_traces/models/span.rb', line 67

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)


47
48
49
# File 'lib/oci/apm_traces/models/span.rb', line 47

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)


22
23
24
# File 'lib/oci/apm_traces/models/span.rb', line 22

def parent_span_key
  @parent_span_key
end

#service_nameString

Service name associated with the span.

Returns:

  • (String)


52
53
54
# File 'lib/oci/apm_traces/models/span.rb', line 52

def service_name
  @service_name
end

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

List of tags associated with the span.

Returns:



62
63
64
# File 'lib/oci/apm_traces/models/span.rb', line 62

def tags
  @tags
end

#time_endedDateTime

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

Returns:

  • (DateTime)


37
38
39
# File 'lib/oci/apm_traces/models/span.rb', line 37

def time_ended
  @time_ended
end

#time_startedDateTime

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

Returns:

  • (DateTime)


32
33
34
# File 'lib/oci/apm_traces/models/span.rb', line 32

def time_started
  @time_started
end

#trace_keyString

[Required] Unique identifier for the trace.

Returns:

  • (String)


27
28
29
# File 'lib/oci/apm_traces/models/span.rb', line 27

def trace_key
  @trace_key
end

Class Method Details

.attribute_mapObject

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



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/oci/apm_traces/models/span.rb', line 75

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',
    'logs': :'logs',
    'is_error': :'isError'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



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

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>',
    'logs': :'Array<OCI::ApmTraces::Models::SpanLogCollection>',
    'is_error': :'BOOLEAN'
    # 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



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/oci/apm_traces/models/span.rb', line 202

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 &&
    logs == other.logs &&
    is_error == other.is_error
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



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/oci/apm_traces/models/span.rb', line 243

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


223
224
225
# File 'lib/oci/apm_traces/models/span.rb', line 223

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



232
233
234
# File 'lib/oci/apm_traces/models/span.rb', line 232

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

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



276
277
278
279
280
281
282
283
284
285
# File 'lib/oci/apm_traces/models/span.rb', line 276

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



270
271
272
# File 'lib/oci/apm_traces/models/span.rb', line 270

def to_s
  to_hash.to_s
end