Class: Appsignal::Extension
- Inherits:
-
Object
show all
- Defined in:
- lib/appsignal/extension.rb,
ext/appsignal_extension.c
Defined Under Namespace
Classes: Data, Transaction
Class Method Summary
collapse
Class Method Details
.add_distribution_value(key, value) ⇒ Object
554
555
556
557
558
559
560
561
562
563
|
# File 'ext/appsignal_extension.c', line 554
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
17
18
19
20
21
|
# File 'lib/appsignal/extension.rb', line 17
def agent_config
@agent_config ||= YAML.load(
File.read(File.join(File.dirname(__FILE__), '../../ext/agent.yml'))
)
end
|
.agent_version ⇒ Object
23
24
25
|
# File 'lib/appsignal/extension.rb', line 23
def agent_version
agent_config['version']
end
|
.data_array_new ⇒ Object
279
280
281
282
283
284
285
286
287
288
289
|
# File 'ext/appsignal_extension.c', line 279
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
Create a data map or array
267
268
269
270
271
272
273
274
275
276
277
|
# File 'ext/appsignal_extension.c', line 267
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;
}
}
|
.get_server_state(key) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'ext/appsignal_extension.c', line 35
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
543
544
545
546
547
548
549
550
551
552
|
# File 'ext/appsignal_extension.c', line 543
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
569
570
571
572
573
574
575
576
577
578
579
580
|
# File 'ext/appsignal_extension.c', line 569
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
27
28
29
|
# File 'lib/appsignal/extension.rb', line 27
def method_missing(m, *args, &block)
end
|
.set_gauge(key, value) ⇒ Object
510
511
512
513
514
515
516
517
518
519
|
# File 'ext/appsignal_extension.c', line 510
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
521
522
523
524
525
526
527
528
529
530
|
# File 'ext/appsignal_extension.c', line 521
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
532
533
534
535
536
537
538
539
540
541
|
# File 'ext/appsignal_extension.c', line 532
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;
}
|
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'ext/appsignal_extension.c', line 48
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;
}
}
|
29
30
31
32
33
|
# File 'ext/appsignal_extension.c', line 29
static VALUE stop(VALUE self) {
appsignal_stop();
return Qnil;
}
|