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
821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 |
# File 'ext/appsignal_extension.c', line 821
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);
tags_data = rb_check_typeddata(tags, &data_data_type);
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
359 360 361 362 363 364 365 366 367 368 369 |
# File 'ext/appsignal_extension.c', line 359
static VALUE data_array_new(VALUE self) {
appsignal_data_t* data;
data = appsignal_data_array_new();
if (data) {
return TypedData_Wrap_Struct(Data, &data_data_type, 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
347 348 349 350 351 352 353 354 355 356 357 |
# File 'ext/appsignal_extension.c', line 347
static VALUE data_map_new(VALUE self) {
appsignal_data_t* data;
data = appsignal_data_map_new();
if (data) {
return TypedData_Wrap_Struct(Data, &data_data_type, 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
60 61 62 |
# File 'ext/appsignal_extension.c', line 60 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
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'ext/appsignal_extension.c', line 64
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
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 |
# File 'ext/appsignal_extension.c', line 805
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);
tags_data = rb_check_typeddata(tags, &data_data_type);
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
841 842 843 844 845 846 847 848 849 850 851 852 |
# File 'ext/appsignal_extension.c', line 841
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
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 |
# File 'ext/appsignal_extension.c', line 768
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);
attributes_data = rb_check_typeddata(attributes, &data_data_type);
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
854 855 856 |
# File 'ext/appsignal_extension.c', line 854 static VALUE running_in_container() { return appsignal_running_in_container() == 1 ? Qtrue : Qfalse; } |
.set_environment_metadata(key, value) ⇒ Object
858 859 860 861 862 863 864 |
# File 'ext/appsignal_extension.c', line 858
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
789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 |
# File 'ext/appsignal_extension.c', line 789
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);
tags_data = rb_check_typeddata(tags, &data_data_type);
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
48 49 50 51 52 |
# File 'ext/appsignal_extension.c', line 48 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
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'ext/appsignal_extension.c', line 77
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 TypedData_Wrap_Struct(Transaction, &transaction_data_type, transaction);
} else {
return Qnil;
}
}
|
.stop ⇒ Object
54 55 56 57 58 |
# File 'ext/appsignal_extension.c', line 54 static VALUE stop(VALUE self) { appsignal_stop(); return Qnil; } |