Class: Appsignal::Extension::ExtTransaction

Inherits:
Object
  • Object
show all
Defined in:
ext/appsignal_extension.c

Instance Method Summary collapse

Instance Method Details

#completeObject


167
168
169
170
171
172
173
174
# File 'ext/appsignal_extension.c', line 167

static VALUE complete_transaction(VALUE self) {
  appsignal_transaction* transaction;

  Data_Get_Struct(self, appsignal_transaction, transaction);

  appsignal_complete_transaction(transaction);
  return Qnil;
}

#finishObject


157
158
159
160
161
162
163
164
165
# File 'ext/appsignal_extension.c', line 157

static VALUE finish_transaction(VALUE self) {
  appsignal_transaction* transaction;
  int sample;

  Data_Get_Struct(self, appsignal_transaction, transaction);

  sample = appsignal_finish_transaction(transaction);
  return sample == 1 ? Qtrue : Qfalse;
}

#finish_event(name, title, body, body_format) ⇒ Object


60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'ext/appsignal_extension.c', line 60

static VALUE finish_event(VALUE self, VALUE name, VALUE title, VALUE body, VALUE body_format) {
  appsignal_transaction* transaction;

  Check_Type(name, T_STRING);
  Check_Type(title, T_STRING);
  Check_Type(body, T_STRING);
  Check_Type(body_format, T_FIXNUM);
  Data_Get_Struct(self, appsignal_transaction, transaction);

  appsignal_finish_event(
      transaction,
      StringValueCStr(name),
      StringValueCStr(title),
      StringValueCStr(body),
      FIX2INT(body_format)
  );
  return Qnil;
}

#set_action(action) ⇒ Object


111
112
113
114
115
116
117
118
119
120
121
122
# File 'ext/appsignal_extension.c', line 111

static VALUE set_transaction_action(VALUE self, VALUE action) {
  appsignal_transaction* transaction;

  Check_Type(action, T_STRING);
  Data_Get_Struct(self, appsignal_transaction, transaction);

  appsignal_set_transaction_action(
      transaction,
      StringValueCStr(action)
  );
  return Qnil;
}

#set_error(name, message, backtrace) ⇒ Object


79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'ext/appsignal_extension.c', line 79

static VALUE set_transaction_error(VALUE self, VALUE name, VALUE message, VALUE backtrace) {
  appsignal_transaction* transaction;

  Check_Type(name, T_STRING);
  Check_Type(message, T_STRING);
  Check_Type(backtrace, T_STRING);
  Data_Get_Struct(self, appsignal_transaction, transaction);

  appsignal_set_transaction_error(
      transaction,
      StringValueCStr(name),
      StringValueCStr(message),
      StringValueCStr(backtrace)
  );
  return Qnil;
}

#set_metadata(key, value) ⇒ Object


142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'ext/appsignal_extension.c', line 142

static VALUE set_transaction_metadata(VALUE self, VALUE key, VALUE value) {
  appsignal_transaction* transaction;

  Check_Type(key, T_STRING);
  Check_Type(value, T_STRING);
  Data_Get_Struct(self, appsignal_transaction, transaction);

  appsignal_set_transaction_metadata(
      transaction,
      StringValueCStr(key),
      StringValueCStr(value)
  );
  return Qnil;
}

#set_queue_start(queue_start) ⇒ Object


124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'ext/appsignal_extension.c', line 124

static VALUE set_transaction_queue_start(VALUE self, VALUE queue_start) {
  appsignal_transaction* transaction;
  int queue_start_type;

  queue_start_type = TYPE(queue_start);
  if (queue_start_type != T_FIXNUM && queue_start_type != T_BIGNUM) {
      rb_raise(rb_eTypeError, "queue_start should be a Fixnum or Bignum");
  }

  Data_Get_Struct(self, appsignal_transaction, transaction);

  appsignal_set_transaction_queue_start(
      transaction,
      NUM2LONG(queue_start)
  );
  return Qnil;
}

#set_sample_data(key, payload) ⇒ Object


96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'ext/appsignal_extension.c', line 96

static VALUE set_transaction_sample_data(VALUE self, VALUE key, VALUE payload) {
  appsignal_transaction* transaction;

  Check_Type(key, T_STRING);
  Check_Type(payload, T_STRING);
  Data_Get_Struct(self, appsignal_transaction, transaction);

  appsignal_set_transaction_sample_data(
      transaction,
      StringValueCStr(key),
      StringValueCStr(payload)
  );
  return Qnil;
}

#start_eventObject

Transaction instance methods


50
51
52
53
54
55
56
57
58
# File 'ext/appsignal_extension.c', line 50

static VALUE start_event(VALUE self) {
  appsignal_transaction* transaction;

  Data_Get_Struct(self, appsignal_transaction, transaction);

  appsignal_start_event(transaction);

  return Qnil;
}