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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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



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

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.



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

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



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

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