Class: Appsignal::Extension Private
- Defined in:
- lib/appsignal/extension.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
Classes: Data, Transaction
Class Method Summary collapse
- .add_distribution_value(key, value) ⇒ 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) ⇒ Object
-
.install_allocation_event_hook ⇒ Object
private
Event hook installation.
- .method_missing(m, *args, &block) ⇒ Object private
- .running_in_container? ⇒ Boolean
-
.set_gauge(key, value) ⇒ 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
Class Method Details
.add_distribution_value(key, value) ⇒ Object
577 578 579 580 581 582 583 584 585 586 |
# File 'ext/appsignal_extension.c', line 577
static VALUE add_distribution_value(VALUE self, VALUE key, VALUE value) {
Check_Type(key, T_STRING);
Check_Type(value, T_FLOAT);
appsignal_add_distribution_value(
make_appsignal_string(key),
NUM2DBL(value)
);
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.
18 19 20 21 22 |
# File 'lib/appsignal/extension.rb', line 18 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.
24 25 26 |
# File 'lib/appsignal/extension.rb', line 24 def agent_version agent_config["version"] end |
.data_array_new ⇒ Object
296 297 298 299 300 301 302 303 304 305 306 |
# File 'ext/appsignal_extension.c', line 296
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
284 285 286 287 288 289 290 291 292 293 294 |
# File 'ext/appsignal_extension.c', line 284
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) ⇒ Object
566 567 568 569 570 571 572 573 574 575 |
# File 'ext/appsignal_extension.c', line 566
static VALUE increment_counter(VALUE self, VALUE key, VALUE count) {
Check_Type(key, T_STRING);
Check_Type(count, T_FIXNUM);
appsignal_increment_counter(
make_appsignal_string(key),
FIX2INT(count)
);
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
592 593 594 595 596 597 598 599 600 601 602 603 |
# File 'ext/appsignal_extension.c', line 592
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.
28 29 30 |
# File 'lib/appsignal/extension.rb', line 28 def method_missing(m, *args, &block) # Do nothing if the extension methods are not loaded end |
.running_in_container? ⇒ Boolean
605 606 607 |
# File 'ext/appsignal_extension.c', line 605 static VALUE running_in_container() { return appsignal_running_in_container() == 1 ? Qtrue : Qfalse; } |
.set_gauge(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.
Metrics
533 534 535 536 537 538 539 540 541 542 |
# File 'ext/appsignal_extension.c', line 533
static VALUE set_gauge(VALUE self, VALUE key, VALUE value) {
Check_Type(key, T_STRING);
Check_Type(value, T_FLOAT);
appsignal_set_gauge(
make_appsignal_string(key),
NUM2DBL(value)
);
return Qnil;
}
|
.set_host_gauge(key, value) ⇒ Object
544 545 546 547 548 549 550 551 552 553 |
# File 'ext/appsignal_extension.c', line 544
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
555 556 557 558 559 560 561 562 563 564 |
# File 'ext/appsignal_extension.c', line 555
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; } |