You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add new "create a transaction" helpers to replace the
`monitor_transaction` and `monitor_single_transaction` helpers.
These helpers do too much and are confusing to use. We didn't end up
using them ourselves anymore in our integrations.
These new helpers are based on what we most commonly do in the Ruby gem
to instrument blocks of code.
These helpers don't accept adding metadata to the transaction using an
`env` argument. This can now be set using the instrumentation helpers
like `set_action`, `set_params`, `set_custom_data`, etc.
If an app wants to track blocks of code with an instrumentation event,
`Appsignal.instrument` needs to be called in the `Appsignal.monitor`
block.
If this helper were to both create a transaction and an instrumentation
event the arguments would get complicated and it becomes unclear what
it's meant to be used for.
These helpers support nested transaction in such a way that it won't
break anything, but the namespace and action arguments are ignored when
a parent transaction is active.
Add `Appsignal.monitor` and `Appsignal.monitor_and_stop` instrumentation helpers. These helpers are a replacement for the `Appsignal.monitor_transaction` and `Appsignal.monitor_single_transaction` helpers.
7
+
8
+
Use these new helpers to create an AppSignal transaction and track any exceptions that occur within the instrumented block. This new helper supports custom namespaces and has a simpler way to set an action name. Use this helper in combination with our other `Appsignal.set_*` helpers to add more metadata to the transaction.
9
+
10
+
```ruby
11
+
# New helper
12
+
Appsignal.monitor(
13
+
:namespace => "my_namespace",
14
+
:action => "MyClass#my_method"
15
+
) do
16
+
# Track an instrumentation event
17
+
Appsignal.instrument("my_event.my_group") do
18
+
# Some code
19
+
end
20
+
end
21
+
22
+
# Old helper
23
+
Appsignal.monitor_transaction(
24
+
"process_action.my_group",
25
+
:class_name => "MyClass",
26
+
:action_name => "my_method"
27
+
) do
28
+
# Some code
29
+
end
30
+
```
31
+
32
+
The `Appsignal.monitor_and_stop` helper can be used in the same scenarios as the `Appsignal.monitor_single_transaction` helper is used. One-off Ruby scripts that are not part of a long running process.
0 commit comments