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

feat: Add S3 latency metrics #397

Merged
merged 2 commits into from
Oct 3, 2023
Merged

feat: Add S3 latency metrics #397

merged 2 commits into from
Oct 3, 2023

Conversation

jeqo
Copy link
Contributor

@jeqo jeqo commented Sep 26, 2023

For better monitoring, latency metrics will help to understand how long are we waiting on the plugin side for a response from S3.

See commits for more details, a small refactor on the testing is included separately.

@jeqo jeqo requested a review from a team as a code owner September 26, 2023 10:18
if (sensor != null) {
sensor.record();
// metrics are reported per request, so 1 value can be assumed.
if (metricValues.size() == 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The for loop was introduced intentionally after the discussion with @ivanyu and I guess it will not affect anything if what you specified in the comment is true, however both me and @ivanyu were not sure if that's the case. So could you elaborate how did you find out that the size will always be 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

API is not clear about it, but docs mention the following: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/metrics-list.html

Metrics collected with each request

So, my interpretation (and while testing this) is that each instance of metric collection corresponds to a single API call.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I looked into the SDK code and seems you are right 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

But OTOH what harm would it do it it remains a loop? It'd be more future-proof and we wouldn't expect this internal behavior to change in a casual dependency upgrade

Copy link
Contributor

Choose a reason for hiding this comment

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

The thing is that we will not be able to understand to what request type the latency metric belongs if there will be multiple values AFAIU. Otherwise I would agree.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see. That's very unfortunate. Well, let's rely on our tests as much as we can then

AnatolyPopov
AnatolyPopov previously approved these changes Sep 29, 2023
Copy link
Contributor

@AnatolyPopov AnatolyPopov left a comment

Choose a reason for hiding this comment

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

LGTM

if (sensor != null) {
sensor.record();
// metrics are reported per request, so 1 value can be assumed.
if (metricValues.size() == 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, I'm thinking that maybe it's worth logging a warning if the size is different from 1

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking the same actually, so yeah, lets have it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense. Adding it now.

Copy link
Contributor

@ivanyu ivanyu left a comment

Choose a reason for hiding this comment

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

One more comment, but otherwise LGTM

}

final var durations = metricCollection.metricValues(CoreMetric.API_CALL_DURATION);
if (durations.size() == 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need the same warning in the else here

@jeqo jeqo force-pushed the jeqo/metrics-s3-latency branch from dd2c69f to fcf1817 Compare October 3, 2023 07:18
@jeqo jeqo requested a review from ivanyu October 3, 2023 07:20
@ivanyu ivanyu merged commit d8f2823 into main Oct 3, 2023
6 checks passed
@ivanyu ivanyu deleted the jeqo/metrics-s3-latency branch October 3, 2023 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants