-
Notifications
You must be signed in to change notification settings - Fork 139
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 an Opbeat Tracer #262
Add an Opbeat Tracer #262
Conversation
Nice! I don't know Hutch – but I noticed one thing. You need to wrap the whole thing in a transaction. Translations have traces. In Rails for example, every action is wrapped in a Transaction, and the DB calls are traces. Opbeat.transaction(sig, KIND, extra: extra_from(message)) do
@klass.process(message)
end.done(true) Be aware that the Opbeat client might need to be started manually if running in another process than Rails (where it's started during boot). |
@mikker Is this how to use trace/transaction? |
sig, KIND, extra: extra_from(message) | ||
) { @klass.process(message) } | ||
::Opbeat.trace(sig, KIND, extra: extra_from(message)) { | ||
::Opbeat.transaction(sig, KIND, extra: extra_from(message)) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other way around 😄 Transaction(Trace())
69e2513
to
b149479
Compare
@mikker Thanks for checking my work. Re-check? |
|
||
def extra_from(message) | ||
{ | ||
body: message.body.to_s, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider: Make this scrubbable, somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scrubbable how? You don't need the trace, actually. Transaction automatically have one root trace, so adding another one is probably redundant. I can see how I could've let you to add one. Sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the note on the trace, I'll remove that inner bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On scrubbing: As we may send confidential information in a Message, its body is perhaps not for everyone's eyes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scrubbing feature is way outside the scope of this PR. (Use-cases include: Anonymize hospital person data, for instance. Name=Jane Doe
, that kind of thing.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Data scrubbing is arguably outside of Hutch's scope. If you are serious about this, use TLS and payload encryption, then scrub as much as you need in your own app.
@michaelklishin What's your preferred way to "only ever load this |
5ad3d83
to
5ac8222
Compare
The JRuby seems to have had a hiccup on an unrelated test. |
@olleolleolle |
Thank you! |
Thank you for this! 👍 (cc @roncohen) |
Go team! So many incremental baby-steps, so many helpful nudges and high-fives. |
This PR adds a new autoloaded Tracer implementation for Opbeat.