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, MockData, MockTransaction, Span, 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
Other helper methods.
-
.log(group, severity, format, message, attributes) ⇒ Object
private
Logging.
-
.method_missing(_method, *args, &block) ⇒ Object
private
Do nothing if the extension methods are not loaded.
- .running_in_container? ⇒ Boolean
- .set_environment_metadata(key, value) ⇒ Object
-
.set_gauge(key, value, tags) ⇒ Object
private
Metrics.
-
.start ⇒ Object
private
Starting and stopping.
-
.start_transaction(transaction_id, namespace, gc_duration_ms) ⇒ Object
private
Start transaction.
- .stop ⇒ Object
Instance Method Summary collapse
- #data_array_new ⇒ Object private
- #data_map_new ⇒ Object private
Methods included from Jruby
add_distribution_value, diagnose, get_server_state, increment_counter, lib_extension, log, running_in_container?, set_environment_metadata, set_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
803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 |
# File 'ext/appsignal_extension.c', line 803
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.
24 25 26 27 |
# File 'lib/appsignal/extension.rb', line 24 def agent_config require_relative "../../ext/agent" ::APPSIGNAL_AGENT_CONFIG 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.
29 30 31 |
# File 'lib/appsignal/extension.rb', line 29 def agent_version agent_config["version"] end |
.data_array_new ⇒ Object
336 337 338 339 340 341 342 343 344 345 346 |
# File 'ext/appsignal_extension.c', line 336
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
324 325 326 327 328 329 330 331 332 333 334 |
# File 'ext/appsignal_extension.c', line 324
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
36 37 38 |
# File 'ext/appsignal_extension.c', line 36 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
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'ext/appsignal_extension.c', line 40
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
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 |
# File 'ext/appsignal_extension.c', line 786
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.
Other helper methods
824 825 826 827 828 829 830 831 832 833 834 835 |
# File 'ext/appsignal_extension.c', line 824
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;
}
|
.log(group, severity, format, message, attributes) ⇒ 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.
Logging
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 |
# File 'ext/appsignal_extension.c', line 747
static VALUE a_log(VALUE self, VALUE group, VALUE severity, VALUE format, VALUE message, VALUE attributes) {
appsignal_data_t* attributes_data;
Check_Type(group, T_STRING);
Check_Type(severity, T_FIXNUM);
Check_Type(format, T_FIXNUM);
Check_Type(message, T_STRING);
Check_Type(attributes, RUBY_T_DATA);
Data_Get_Struct(attributes, appsignal_data_t, attributes_data);
appsignal_log(
make_appsignal_string(group),
FIX2INT(severity),
FIX2INT(format),
make_appsignal_string(message),
attributes_data
);
return Qnil;
}
|
.method_missing(_method, *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.
37 38 39 |
# File 'lib/appsignal/extension.rb', line 37 def method_missing(_method, *args, &block) super if Appsignal.testing? end |
.running_in_container? ⇒ Boolean
837 838 839 |
# File 'ext/appsignal_extension.c', line 837 static VALUE running_in_container() { return appsignal_running_in_container() == 1 ? Qtrue : Qfalse; } |
.set_environment_metadata(key, value) ⇒ Object
841 842 843 844 845 846 847 |
# File 'ext/appsignal_extension.c', line 841
static VALUE set_environment_metadata(VALUE self, VALUE key, VALUE value) {
appsignal_set_environment_metadata(
make_appsignal_string(key),
make_appsignal_string(value)
);
return Qnil;
}
|
.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
769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 |
# File 'ext/appsignal_extension.c', line 769
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;
}
|
.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
24 25 26 27 28 |
# File 'ext/appsignal_extension.c', line 24 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
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'ext/appsignal_extension.c', line 53
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
30 31 32 33 34 |
# File 'ext/appsignal_extension.c', line 30 static VALUE stop(VALUE self) { appsignal_stop(); return Qnil; } |