Class: Appsignal::Extension::Jruby::Transaction Private
- 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
- #pointer ⇒ Object readonly private
Instance Method Summary collapse
- #complete ⇒ Object private
- #duplicate(new_transaction_id) ⇒ Object private
- #finish(gc_duration_ms) ⇒ Object private
- #finish_event(name, title, body, body_format, gc_duration_ms) ⇒ Object private
-
#initialize(pointer) ⇒ Transaction
constructor
private
A new instance of Transaction.
-
#record_event(name, title, body, body_format, duration, gc_duration_ms) ⇒ Object
private
rubocop:disable Metrics/ParameterLists.
-
#set_action(action_name) ⇒ Object
private
rubocop:disable Naming/AccessorMethodName.
- #set_error(name, message, backtrace) ⇒ Object private
- #set_metadata(key, value) ⇒ Object private
-
#set_namespace(namespace) ⇒ Object
private
rubocop:disable Naming/AccessorMethodName.
-
#set_queue_start(time) ⇒ Object
private
rubocop:disable Naming/AccessorMethodName.
- #set_sample_data(key, payload) ⇒ Object private
- #start_event(gc_duration_ms) ⇒ Object private
-
#to_json ⇒ Object
private
rubocop:disable Lint/ToJSON.
Methods included from StringHelpers
#make_appsignal_string, #make_ruby_string
Constructor Details
#initialize(pointer) ⇒ Transaction
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 Transaction.
334 335 336 337 338 339 |
# File 'lib/appsignal/extension/jruby.rb', line 334 def initialize(pointer) @pointer = FFI::AutoPointer.new( pointer, Extension.method(:appsignal_free_transaction) ) end |
Instance Attribute Details
#pointer ⇒ Object (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.
332 333 334 |
# File 'lib/appsignal/extension/jruby.rb', line 332 def pointer @pointer end |
Instance Method Details
#complete ⇒ 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.
450 451 452 |
# File 'lib/appsignal/extension/jruby.rb', line 450 def complete Extension.appsignal_complete_transaction(pointer) end |
#duplicate(new_transaction_id) ⇒ 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.
439 440 441 442 443 444 445 446 447 448 |
# File 'lib/appsignal/extension/jruby.rb', line 439 def duplicate(new_transaction_id) duplicate_transaction = Extension.appsignal_duplicate_transaction( pointer, make_appsignal_string(new_transaction_id) ) return if !duplicate_transaction || duplicate_transaction.null? Transaction.new(duplicate_transaction) end |
#finish(gc_duration_ms) ⇒ 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.
435 436 437 |
# File 'lib/appsignal/extension/jruby.rb', line 435 def finish(gc_duration_ms) Extension.appsignal_finish_transaction(pointer, gc_duration_ms) end |
#finish_event(name, title, body, body_format, gc_duration_ms) ⇒ 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.
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/appsignal/extension/jruby.rb', line 345 def finish_event(name, title, body, body_format, gc_duration_ms) case body when String method = :appsignal_finish_event body_arg = make_appsignal_string(body) when Data method = :appsignal_finish_event_data body_arg = body.pointer else raise ArgumentError, "body argument should be a String or Appsignal::Extension::Data" end Extension.public_send( method, pointer, make_appsignal_string(name), make_appsignal_string(title), body_arg, body_format, gc_duration_ms ) end |
#record_event(name, title, body, body_format, duration, gc_duration_ms) ⇒ 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 Metrics/ParameterLists
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
# File 'lib/appsignal/extension/jruby.rb', line 368 def record_event(name, title, body, body_format, duration, gc_duration_ms) # rubocop:disable Metrics/ParameterLists case body when String method = :appsignal_record_event body_arg = make_appsignal_string(body) when Data method = :appsignal_record_event_data body_arg = body.pointer else raise ArgumentError, "body argument should be a String or Appsignal::Extension::Data" end Extension.public_send( method, pointer, make_appsignal_string(name), make_appsignal_string(title), body_arg, body_format, duration, gc_duration_ms ) end |
#set_action(action_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
401 402 403 404 405 406 |
# File 'lib/appsignal/extension/jruby.rb', line 401 def set_action(action_name) # rubocop:disable Naming/AccessorMethodName Extension.appsignal_set_transaction_action( pointer, make_appsignal_string(action_name) ) end |
#set_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.
392 393 394 395 396 397 398 399 |
# File 'lib/appsignal/extension/jruby.rb', line 392 def set_error(name, , backtrace) Extension.appsignal_set_transaction_error( pointer, make_appsignal_string(name), make_appsignal_string(), backtrace.pointer ) end |
#set_metadata(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.
427 428 429 430 431 432 433 |
# File 'lib/appsignal/extension/jruby.rb', line 427 def (key, value) Extension.( pointer, make_appsignal_string(key), make_appsignal_string(value) ) end |
#set_namespace(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.
rubocop:disable Naming/AccessorMethodName
408 409 410 411 412 413 |
# File 'lib/appsignal/extension/jruby.rb', line 408 def set_namespace(namespace) # rubocop:disable Naming/AccessorMethodName Extension.appsignal_set_transaction_namespace( pointer, make_appsignal_string(namespace) ) end |
#set_queue_start(time) ⇒ 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
423 424 425 |
# File 'lib/appsignal/extension/jruby.rb', line 423 def set_queue_start(time) # rubocop:disable Naming/AccessorMethodName Extension.appsignal_set_transaction_queue_start(pointer, time) 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.
415 416 417 418 419 420 421 |
# File 'lib/appsignal/extension/jruby.rb', line 415 def set_sample_data(key, payload) Extension.appsignal_set_transaction_sample_data( pointer, make_appsignal_string(key), payload.pointer ) end |
#start_event(gc_duration_ms) ⇒ 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.
341 342 343 |
# File 'lib/appsignal/extension/jruby.rb', line 341 def start_event(gc_duration_ms) Extension.appsignal_start_event(pointer, gc_duration_ms) end |
#to_json ⇒ 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 Lint/ToJSON
454 455 456 457 |
# File 'lib/appsignal/extension/jruby.rb', line 454 def to_json # rubocop:disable Lint/ToJSON json = Extension.appsignal_transaction_to_json(pointer) make_ruby_string(json) if json[:len] > 0 end |