-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add monitor instrumentation helpers #1161
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tombruijn
force-pushed
the
monitor-helper
branch
2 times, most recently
from
July 10, 2024 05:40
cf6a6b8
to
9d1b0bb
Compare
tombruijn
force-pushed
the
monitor-helper
branch
from
July 10, 2024 18:47
9d1b0bb
to
02b8705
Compare
unflxw
reviewed
Jul 11, 2024
tombruijn
force-pushed
the
monitor-helper
branch
from
July 11, 2024 14:31
f0b31c6
to
5427af6
Compare
@unflxw I've updated the helper. Please review :) |
tombruijn
force-pushed
the
monitor-helper
branch
from
July 11, 2024 18:07
5427af6
to
fdb0918
Compare
This comment has been minimized.
This comment has been minimized.
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.
Immediately call `yield` rather than check if a parent Transaction is active every time.
Clarify the docs and how to use the helper.
tombruijn
force-pushed
the
monitor-helper
branch
from
July 12, 2024 08:41
fdb0918
to
ffefa94
Compare
Avoid potential issues with the action name not being set and no transaction being reported. For most scenarios it will be fine to set the action name before the block is instrumented. For the more advanced scenarios the action name argument can be set to `nil` or `:set_later` and call `Appsignal.set_action` in the block to set the action name.
tombruijn
force-pushed
the
monitor-helper
branch
from
July 12, 2024 08:41
ffefa94
to
6727452
Compare
unflxw
approved these changes
Jul 12, 2024
This is a message from the daily scheduled checks. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add new "create a transaction" helpers to replace the
monitor_transaction
andmonitor_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 likeset_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 theAppsignal.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.
To do
monitor_transaction
andmonitor_single_transaction
helpers