Class: Appsignal::Extension::Jruby::Span Private

Inherits:
Object
  • Object
show all
Extended by:
StringHelpers
Includes:
StringHelpers
Defined in:
lib/appsignal/extension/jruby.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 collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from StringHelpers

make_appsignal_string, make_ruby_string

Constructor Details

#initialize(pointer) ⇒ Span

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.

Returns a new instance of Span.



462
463
464
465
466
467
# File 'lib/appsignal/extension/jruby.rb', line 462

def initialize(pointer)
  @pointer = FFI::AutoPointer.new(
    pointer,
    Extension.method(:appsignal_free_span)
  )
end

Instance Attribute Details

#pointerObject (readonly)

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.



460
461
462
# File 'lib/appsignal/extension/jruby.rb', line 460

def pointer
  @pointer
end

Class Method Details

.root(namespace) ⇒ 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.



469
470
471
472
# File 'lib/appsignal/extension/jruby.rb', line 469

def self.root(namespace)
  namespace = make_appsignal_string(namespace)
  Span.new(Extension.appsignal_create_root_span(namespace))
end

Instance Method Details

#add_error(name, message, backtrace) ⇒ 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.



478
479
480
481
482
483
484
485
# File 'lib/appsignal/extension/jruby.rb', line 478

def add_error(name, message, backtrace)
  Extension.appsignal_add_span_error(
    pointer,
    make_appsignal_string(name),
    make_appsignal_string(message),
    backtrace.pointer
  )
end

#childObject

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.



474
475
476
# File 'lib/appsignal/extension/jruby.rb', line 474

def child
  Span.new(Extension.appsignal_create_child_span(pointer))
end

#closeObject

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.



539
540
541
# File 'lib/appsignal/extension/jruby.rb', line 539

def close
  Extension.appsignal_close_span(pointer)
end

#set_attribute_bool(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.



518
519
520
521
522
523
524
# File 'lib/appsignal/extension/jruby.rb', line 518

def set_attribute_bool(key, value)
  Extension.appsignal_set_span_attribute_bool(
    pointer,
    make_appsignal_string(key),
    value
  )
end

#set_attribute_double(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.



526
527
528
529
530
531
532
# File 'lib/appsignal/extension/jruby.rb', line 526

def set_attribute_double(key, value)
  Extension.appsignal_set_span_attribute_double(
    pointer,
    make_appsignal_string(key),
    value
  )
end

#set_attribute_int(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.



510
511
512
513
514
515
516
# File 'lib/appsignal/extension/jruby.rb', line 510

def set_attribute_int(key, value)
  Extension.appsignal_set_span_attribute_int(
    pointer,
    make_appsignal_string(key),
    value
  )
end

#set_attribute_string(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.



502
503
504
505
506
507
508
# File 'lib/appsignal/extension/jruby.rb', line 502

def set_attribute_string(key, value)
  Extension.appsignal_set_span_attribute_string(
    pointer,
    make_appsignal_string(key),
    make_appsignal_string(value)
  )
end

#set_name(name) ⇒ 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.

rubocop:disable Naming/AccessorMethodName



495
496
497
498
499
500
# File 'lib/appsignal/extension/jruby.rb', line 495

def set_name(name) # rubocop:disable Naming/AccessorMethodName
  Extension.appsignal_set_span_name(
    pointer,
    make_appsignal_string(name)
  )
end

#set_sample_data(key, payload) ⇒ 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.



487
488
489
490
491
492
493
# File 'lib/appsignal/extension/jruby.rb', line 487

def set_sample_data(key, payload)
  Extension.appsignal_set_span_sample_data(
    pointer,
    make_appsignal_string(key),
    payload.pointer
  )
end

#to_jsonObject

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.



534
535
536
537
# File 'lib/appsignal/extension/jruby.rb', line 534

def to_json
  json = Extension.appsignal_span_to_json(pointer)
  make_ruby_string(json) if json[:len] > 0
end