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.



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

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.



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

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.



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

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.



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

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.



478
479
480
# File 'lib/appsignal/extension/jruby.rb', line 478

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.



543
544
545
# File 'lib/appsignal/extension/jruby.rb', line 543

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.



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

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.



530
531
532
533
534
535
536
# File 'lib/appsignal/extension/jruby.rb', line 530

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.



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

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.



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

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



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

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.



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

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



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

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