Class: Appsignal::Extension
- Defined in:
- lib/appsignal/extension.rb,
ext/appsignal_extension.c
Defined Under Namespace
Classes: ExtTransaction
Class Method Summary collapse
- .add_distribution_value(key, value) ⇒ Object
- .agent_config ⇒ Object
- .agent_version ⇒ Object
-
.get_server_state(key) ⇒ Object
Server state.
- .increment_counter(key, count) ⇒ Object
-
.install_allocation_event_hook ⇒ Object
Event hook installation.
- .install_gc_event_hooks ⇒ Object
- .method_missing(m, *args, &block) ⇒ Object
-
.set_gauge(key, value) ⇒ Object
Metrics.
- .set_host_gauge(key, value) ⇒ Object
- .set_process_gauge(key, value) ⇒ Object
-
.start ⇒ Object
Starting and stopping.
-
.start_transaction(transaction_id, namespace) ⇒ Object
Start transaction.
- .stop ⇒ Object
Class Method Details
.add_distribution_value(key, value) ⇒ Object
260 261 262 263 264 265 266 267 268 269 |
# File 'ext/appsignal_extension.c', line 260
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 |
.get_server_state(key) ⇒ Object
Server state
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'ext/appsignal_extension.c', line 34
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
249 250 251 252 253 254 255 256 257 258 |
# File 'ext/appsignal_extension.c', line 249
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
Event hook installation
283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'ext/appsignal_extension.c', line 283
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;
}
|
.install_gc_event_hooks ⇒ Object
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'ext/appsignal_extension.c', line 296
static VALUE install_gc_event_hooks() {
// These event hooks are only available on Ruby 2.1 and 2.2
#if defined(RUBY_INTERNAL_EVENT_GC_START)
rb_add_event_hook(
track_gc_start,
RUBY_INTERNAL_EVENT_GC_START,
Qnil
);
#endif
#if defined(RUBY_INTERNAL_EVENT_GC_END_MARK)
rb_add_event_hook(
track_gc_end,
RUBY_INTERNAL_EVENT_GC_END_MARK,
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) # Do nothing if the extension methods are not loaded end |
.set_gauge(key, value) ⇒ Object
Metrics
216 217 218 219 220 221 222 223 224 225 |
# File 'ext/appsignal_extension.c', line 216
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
227 228 229 230 231 232 233 234 235 236 |
# File 'ext/appsignal_extension.c', line 227
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
238 239 240 241 242 243 244 245 246 247 |
# File 'ext/appsignal_extension.c', line 238
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
Starting and stopping
22 23 24 25 26 |
# File 'ext/appsignal_extension.c', line 22 static VALUE start(VALUE self) { appsignal_start(); return Qnil; } |
.start_transaction(transaction_id, namespace) ⇒ Object
Start transaction
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'ext/appsignal_extension.c', line 47
static VALUE start_transaction(VALUE self, VALUE transaction_id, VALUE namespace) {
appsignal_transaction_t* transaction;
Check_Type(transaction_id, T_STRING);
Check_Type(namespace, T_STRING);
transaction = appsignal_start_transaction(
make_appsignal_string(transaction_id),
make_appsignal_string(namespace)
);
if (transaction) {
return Data_Wrap_Struct(ExtTransaction, NULL, appsignal_free_transaction, transaction);
} else {
return Qnil;
}
}
|
.stop ⇒ Object
28 29 30 31 32 |
# File 'ext/appsignal_extension.c', line 28 static VALUE stop(VALUE self) { appsignal_stop(); return Qnil; } |