Skip to content
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

Revise Shutdown and Draining section #1512

Merged
merged 1 commit into from
Mar 2, 2020

Conversation

rhcarvalho
Copy link
Contributor

The original motivation was a continuation to getsentry/sentry-go#106, to clarify the usage of Flush in the Go SDK.

I went ahead and revised the contents for other languages as well.

@rhcarvalho
Copy link
Contributor Author

The only language I didn't touch was C#/.NET.

This was intentional, as I believe @bruno-garcia would rather not mention Flush, and the current state seems to be accurate.

The global changes would still take effect, and I think generally the edits make sense for C#:

  • The "Typically SDKs provide two ways" paragraph was redundant.
  • The "After shutdown the client cannot be used" paragraph doesn't make sense, since the SDK should not be used outside of the SentrySdk.Init block anyway.

BEFORE

image

AFTER

image

Comment on lines -6 to -9
if sentry.Flush(time.Second * 2) {
fmt.Println("All queued events delivered!")
} else {
fmt.Println("Flush timeout reached")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally omit checking on the return value of sentry.Flush.

Printing debug messages is redundant, and the same visibility can be achieved by enabling debug logging on the SDK.

There's nothing useful users can do if Flush times out. For instance, retrying is not an option because that could be replaced with a longer timeout to begin with, and typically Flush is called in a moment where the program should not hang indefinitely (and that's the very reason for having a timeout).

Comment on lines 11 to 12
After calling `close` the current client cannot be used any more so make sure to
only do that right before you shut down the application.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is moved here from the global context, with one important edit: "the client" => "the current client".

Comment on lines +4 to +5
If you use multiple clients, arrange for each of them to be flushed as
appropriate.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we want to add a similar note for other languages?

```javascript
```rust
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops 😄

Comment on lines 14 to 15
After shutdown the current client cannot be used any more so make sure to only
do that right before you shut down the application.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is moved here from the global context, with one important edit: "the client" => "the current client".

Comment on lines -10 to -12
Typically SDKs provide two ways to shut down: a controlled shutdown where the system will wait up to about two
seconds to flush out events (configurable) and an uncontrolled shutdown (also referred to as "killing" the
client).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't sound useful to me. It is a generic statement, and unclear whether it applies to the SDK the user is interested in.

Each language/platform from the dropdown includes the relevant mechanisms that exist in that language/platform.

Comment on lines -16 to -17
After shutdown the client cannot be used any more so make sure to only do that right before you shut down
the application.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this to the languages/platforms where it applies.

Comment on lines -6 to -8
Most SDKs use a background queue to send out events. Because the queue sends asynchronously in the background
it means that some events might be lost if the application shuts down unexpectedly. To prevent this all SDKs
provide mechanisms to cope with this.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded.

@rhcarvalho rhcarvalho marked this pull request as ready for review February 25, 2020 11:59
Copy link
Contributor

@kamilogorek kamilogorek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one small nitpick from me. Nicely done

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving on this

@rhcarvalho
Copy link
Contributor Author

@MimiDumpling could you please have a look?

@MimiDumpling
Copy link
Contributor

@MimiDumpling could you please have a look?

@rhcarvalho I'll try to have it done by EOD, if not tomorrow. :smile

Copy link
Contributor

@MimiDumpling MimiDumpling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple edits. 😸 Thanks for updating the docs!

@rhcarvalho
Copy link
Contributor Author

Couple edits. Thanks for updating the docs!

Thanks @MimiDumpling!!! Amazing, thanks for your help!

I do have a couple of questions before applying the suggestions, to make sure we stay both technically correct and with good prose :)

(inline comments re: "only" and re: "right before")

@MimiDumpling
Copy link
Contributor

Couple edits. Thanks for updating the docs!

Thanks @MimiDumpling!!! Amazing, thanks for your help!

I do have a couple of questions before applying the suggestions, to make sure we stay both technically correct and with good prose :)

(inline comments re: "only" and re: "right before")

Happy to help! 😄 Made some alternate suggestions. Let me know if they work well with the technical accuracy. If not, we can try other sentence structures.

Co-Authored-By: Kamil Ogórek <kamil.ogorek@gmail.com>
Co-Authored-By: Tien "Mimi" Nguyen <tienmiminguyen@gmail.com>
@rhcarvalho
Copy link
Contributor Author

Applied suggestions from Mimi, merging this in.

@rhcarvalho rhcarvalho merged commit 7efe5ad into getsentry:master Mar 2, 2020
@rhcarvalho rhcarvalho deleted the shutdown-draining-reloaded branch March 2, 2020 15:22
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants