Class: Appsignal::Extension Private
- Extended by:
- Jruby
- Defined in:
- lib/appsignal/extension.rb,
lib/appsignal/extension/jruby.rb,
ext/appsignal_extension.c
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.
Defined Under Namespace
Modules: Jruby Classes: Data, Transaction
Class Method Summary collapse
- .add_distribution_value(key, value, tags) ⇒ Object
- .agent_config ⇒ Object private
- .agent_version ⇒ Object private
- .data_array_new ⇒ Object
-
.data_map_new ⇒ Object
private
Create a data map or array.
-
.diagnose ⇒ Object
private
Diagnostics.
-
.get_server_state(key) ⇒ Object
private
Server state.
- .increment_counter(key, count, tags) ⇒ Object
-
.install_allocation_event_hook ⇒ Object
private
Event hook installation.
-
.method_missing(m, *args, &block) ⇒ Object
private
Do nothing if the extension methods are not loaded.
- .running_in_container? ⇒ Boolean
-
.set_gauge(key, value, tags) ⇒ Object
private
Metrics.
- .set_host_gauge(key, value) ⇒ Object
- .set_process_gauge(key, value) ⇒ Object
-
.start ⇒ Object
private
Starting and stopping.
-
.start_transaction(transaction_id, namespace, gc_duration_ms) ⇒ Object
private
Start transaction.
- .stop ⇒ Object
Methods included from Jruby
add_distribution_value, data_array_new, data_map_new, diagnose, get_server_state, increment_counter, lib_extension, running_in_container?, set_gauge, set_host_gauge, set_process_gauge, start, start_transaction, stop
Methods included from Jruby::StringHelpers
#make_appsignal_string, #make_ruby_string
Class Method Details
.add_distribution_value(key, value, tags) ⇒ Object
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 |
# File 'ext/appsignal_extension.c', line 604
static VALUE add_distribution_value(VALUE self, VALUE key, VALUE value, VALUE tags) {
appsignal_data_t* tags_data;
Check_Type(key, T_STRING);
Check_Type(value, T_FLOAT);
Check_Type(tags, RUBY_T_DATA);
Data_Get_Struct(tags, appsignal_data_t, tags_data);
appsignal_add_distribution_value(
make_appsignal_string(key),
NUM2DBL(value),
tags_data
);
return Qnil;
}
|
.agent_config ⇒ 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.
25 26 27 28 29 |
# File 'lib/appsignal/extension.rb', line 25 def agent_config @agent_config ||= YAML.load( File.read(File.join(File.dirname(__FILE__), "../../ext/agent.yml")) ) end |
.agent_version ⇒ 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.
31 32 33 |
# File 'lib/appsignal/extension.rb', line 31 def agent_version agent_config["version"] end |
.data_array_new ⇒ Object
311 312 313 314 315 316 317 318 319 320 321 |
# File 'ext/appsignal_extension.c', line 311
static VALUE data_array_new(VALUE self) {
appsignal_data_t* data;
data = appsignal_data_array_new();
if (data) {
return Data_Wrap_Struct(Data, NULL, appsignal_free_data, data);
} else {
return Qnil;
}
}
|
.data_map_new ⇒ 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.
Create a data map or array
299 300 301 302 303 304 305 306 307 308 309 |
# File 'ext/appsignal_extension.c', line 299
static VALUE data_map_new(VALUE self) {
appsignal_data_t* data;
data = appsignal_data_map_new();
if (data) {
return Data_Wrap_Struct(Data, NULL, appsignal_free_data, data);
} else {
return Qnil;
}
}
|
.diagnose ⇒ 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.
Diagnostics
35 36 37 |
# File 'ext/appsignal_extension.c', line 35 static VALUE diagnose(VALUE self) { return make_ruby_string(appsignal_diagnose()); } |
.get_server_state(key) ⇒ 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.
Server state
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'ext/appsignal_extension.c', line 39
static VALUE get_server_state(VALUE self, VALUE key) {
appsignal_string_t string;
Check_Type(key, T_STRING);
string = appsignal_get_server_state(make_appsignal_string(key));
if (string.len > 0) {
return make_ruby_string(string);
} else {
return Qnil;
}
}
|
.increment_counter(key, count, tags) ⇒ Object
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 |
# File 'ext/appsignal_extension.c', line 587
static VALUE increment_counter(VALUE self, VALUE key, VALUE count, VALUE tags) {
appsignal_data_t* tags_data;
Check_Type(key, T_STRING);
Check_Type(count, T_FLOAT);
Check_Type(tags, RUBY_T_DATA);
Data_Get_Struct(tags, appsignal_data_t, tags_data);
appsignal_increment_counter(
make_appsignal_string(key),
NUM2DBL(count),
tags_data
);
return Qnil;
}
|
.install_allocation_event_hook ⇒ 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.
Event hook installation
625 626 627 628 629 630 631 632 633 634 635 636 |
# File 'ext/appsignal_extension.c', line 625
static VALUE install_allocation_event_hook() {
// This event hook is only available on Ruby 2.1 and 2.2
#if defined(RUBY_INTERNAL_EVENT_NEWOBJ)
rb_add_event_hook(
track_allocation,
RUBY_INTERNAL_EVENT_NEWOBJ,
Qnil
);
#endif
return Qnil;
}
|
.method_missing(m, *args, &block) ⇒ 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.
Do nothing if the extension methods are not loaded
Disabled in testing so we can make sure that we don't miss a extension function implementation.
39 40 41 |
# File 'lib/appsignal/extension.rb', line 39 def method_missing(m, *args, &block) super if Appsignal.testing? end |
.running_in_container? ⇒ Boolean
638 639 640 |
# File 'ext/appsignal_extension.c', line 638 static VALUE running_in_container() { return appsignal_running_in_container() == 1 ? Qtrue : Qfalse; } |
.set_gauge(key, value, tags) ⇒ 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.
Metrics
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
# File 'ext/appsignal_extension.c', line 548
static VALUE set_gauge(VALUE self, VALUE key, VALUE value, VALUE tags) {
appsignal_data_t* tags_data;
Check_Type(key, T_STRING);
Check_Type(value, T_FLOAT);
Check_Type(tags, RUBY_T_DATA);
Data_Get_Struct(tags, appsignal_data_t, tags_data);
appsignal_set_gauge(
make_appsignal_string(key),
NUM2DBL(value),
tags_data
);
return Qnil;
}
|
.set_host_gauge(key, value) ⇒ Object
565 566 567 568 569 570 571 572 573 574 |
# File 'ext/appsignal_extension.c', line 565
static VALUE set_host_gauge(VALUE self, VALUE key, VALUE value) {
Check_Type(key, T_STRING);
Check_Type(value, T_FLOAT);
appsignal_set_host_gauge(
make_appsignal_string(key),
NUM2DBL(value)
);
return Qnil;
}
|
.set_process_gauge(key, value) ⇒ Object
576 577 578 579 580 581 582 583 584 585 |
# File 'ext/appsignal_extension.c', line 576
static VALUE set_process_gauge(VALUE self, VALUE key, VALUE value) {
Check_Type(key, T_STRING);
Check_Type(value, T_FLOAT);
appsignal_set_process_gauge(
make_appsignal_string(key),
NUM2DBL(value)
);
return Qnil;
}
|
.start ⇒ 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.
Starting and stopping
23 24 25 26 27 |
# File 'ext/appsignal_extension.c', line 23 static VALUE start(VALUE self) { appsignal_start(); return Qnil; } |
.start_transaction(transaction_id, namespace, 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.
Start transaction
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'ext/appsignal_extension.c', line 52
static VALUE start_transaction(VALUE self, VALUE transaction_id, VALUE namespace, VALUE gc_duration_ms) {
appsignal_transaction_t* transaction;
Check_Type(transaction_id, T_STRING);
Check_Type(namespace, T_STRING);
Check_Type(gc_duration_ms, T_FIXNUM);
transaction = appsignal_start_transaction(
make_appsignal_string(transaction_id),
make_appsignal_string(namespace),
NUM2LONG(gc_duration_ms)
);
if (transaction) {
return Data_Wrap_Struct(Transaction, NULL, appsignal_free_transaction, transaction);
} else {
return Qnil;
}
}
|
.stop ⇒ Object
29 30 31 32 33 |
# File 'ext/appsignal_extension.c', line 29 static VALUE stop(VALUE self) { appsignal_stop(); return Qnil; } |