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.



451
452
453
454
455
456
# File 'lib/appsignal/extension/jruby.rb', line 451

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.



449
450
451
# File 'lib/appsignal/extension/jruby.rb', line 449

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.



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

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.



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

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.



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

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.



528
529
530
# File 'lib/appsignal/extension/jruby.rb', line 528

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.



507
508
509
510
511
512
513
# File 'lib/appsignal/extension/jruby.rb', line 507

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.



515
516
517
518
519
520
521
# File 'lib/appsignal/extension/jruby.rb', line 515

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.



499
500
501
502
503
504
505
# File 'lib/appsignal/extension/jruby.rb', line 499

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.



491
492
493
494
495
496
497
# File 'lib/appsignal/extension/jruby.rb', line 491

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



484
485
486
487
488
489
# File 'lib/appsignal/extension/jruby.rb', line 484

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.



476
477
478
479
480
481
482
# File 'lib/appsignal/extension/jruby.rb', line 476

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.

rubocop:disable Lint/ToJSON



523
524
525
526
# File 'lib/appsignal/extension/jruby.rb', line 523

def to_json # rubocop:disable Lint/ToJSON
  json = Extension.appsignal_span_to_json(pointer)
  make_ruby_string(json) if json[:len] > 0
end