Class: Labkit::Tracing::Adapters::OpentelemetrySpan Private

Inherits:
BaseSpan
  • Object
show all
Defined in:
lib/labkit/tracing/adapters/opentelemetry_span.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary

Attributes inherited from BaseSpan

#span

Instance Method Summary collapse

Methods inherited from BaseSpan

#initialize

Constructor Details

This class inherits a constructor from Labkit::Tracing::Adapters::BaseSpan

Instance Method Details

#close(**opts) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



43
44
45
# File 'lib/labkit/tracing/adapters/opentelemetry_span.rb', line 43

def close(**opts)
  finish(**opts)
end

#contextObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



47
48
49
# File 'lib/labkit/tracing/adapters/opentelemetry_span.rb', line 47

def context
  span.context
end

#finish(**opts) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



35
36
37
38
39
40
41
# File 'lib/labkit/tracing/adapters/opentelemetry_span.rb', line 35

def finish(**opts)
  if opts[:end_timestamp]
    span.finish(end_timestamp: opts[:end_timestamp])
  else
    span.finish
  end
end

#log_event(name, **attributes) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
# File 'lib/labkit/tracing/adapters/opentelemetry_span.rb', line 24

def log_event(name, **attributes)
  span.add_event(name, attributes: stringify_keys(attributes))
end

#set_error(exception) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



28
29
30
31
32
33
# File 'lib/labkit/tracing/adapters/opentelemetry_span.rb', line 28

def set_error(exception)
  return if exception.blank?

  span.set_attribute("error", true)
  span.add_event("exception", attributes: stringify_keys(kv_tags_for_exception(exception)))
end

#set_tag(key, value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
# File 'lib/labkit/tracing/adapters/opentelemetry_span.rb', line 20

def set_tag(key, value)
  span.set_attribute(key, value)
end