-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Make more explicit that recording a metric is safe to call #5365
Make more explicit that recording a metric is safe to call #5365
Conversation
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.
Thank you for the pull request. This is useful info to add to the docs for sure. I left some review.
@@ -3,6 +3,8 @@ | |||
|
|||
A `Meter` is the interface for collecting a set of measurements (which we individually call metrics) about your application. Meters in Micrometer are created from and held in a `MeterRegistry`. Each supported monitoring system has an implementation of `MeterRegistry`. How a registry is created varies for each implementation. | |||
|
|||
TIP: Recoding a measurement for a `Meter` is expected to be a simple math/tallying operation that will not consume any significant amount of computing time or throw exceptions. Transferring metrics to an external monitoring system is a scheduled operation on a separate thread and will not interfere with meter recordings. |
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.
I would simplify the first part to something along the lines "recording a measurement for a Meter
is expected to be a relatively cheap operation and it should not throw any exception."
The second sentence is about publishing which is a bit implementation dependent. Perhaps I would word it as something like "if the registry supports publishing metrics to a metrics backend, this should be done on a separate thread from recording metrics"
There's also a bit of a question of whether both these belong in this page (Registry) of the docs. Maybe we should move the Meters page to before the Registry page in the table of contents and have the first part about recording measurements there?
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.
I would simplify the first part to something along the lines "recording a measurement for a Meter is expected to be a relatively cheap operation and it should not throw any exception."
The second sentence is about publishing which is a bit implementation dependent. Perhaps I would word it as something like "if the registry supports publishing metrics to a metrics backend, this should be done on a separate thread from recording metrics"
Sounds good, I will rephrase according to your suggestion.
There's also a bit of a question of whether both these belong in this page (Registry) of the docs. Maybe we should move the Meters page to before the Registry page in the table of contents and have the first part about recording measurements there?
Interesting. That might be nice. Let me try and move things around a bit and then we can see how it looks.
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.
@shakuzen Is this what you had in mind?
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.
Yes, that looks good to me. I left a minor review comment.
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.
Thank you for the documentation improvement.
6255a0e
to
1efffe9
Compare
I've rebased the pull request on the |
I've added a
TIP
block to the Registry's docs to make it more explicit what happens when operations onMeter
s likeincrementCount
are called, which will make it clear that such operations are safe to call from regular code.This PR is the result of a discussion in Slack.
Of course, feel free to challenge the general usefulness of the added paragraph, its accuracy and wording.