-
Notifications
You must be signed in to change notification settings - Fork 856
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
Metrics #23
Comments
I'm curious if this has gotten any more thought, is there a current recommendation? For our use-cases, we mostly care about the request volume and latency. I found that I can get most of what I care about using the pluggable http client support. I'm creating a wrapper for an
For synchronous clients we have a hacky way to get the first two by looking at the stacktrace and seeing what the entry point to the SDK was. For async clients that is not viable. Is there a better way to access that type of information at the HTTP client layer? More generally, is there a better integration point that could be used? |
For metrics, volume and latency the ExecutionInterceptor is probably the best integration point for a custom metrics implementation. |
Thanks for the pointer @millems . Looks like it solves most of my problems. |
@brharrington LMK if you have any questions. |
@millems What is the right way to log latencies for a request using the Interceptor API. One way could be to add the start timestamp in a Is that the recommended approach? |
@swaranga That's the recommended way to log the latency for the entire execution (which includes marshalling and retries), yes. |
@millems One problem with this approach is that if I want to execute a different interceptor per request so that I can tie the metrics logging with my parent unit of work I cannot do that since there is no way to add a interceptor for a request object. This is useful for instance when I am serving a request for my callers and as part of that I need to call an AWS API, I would like to log metrics for that particular call along with other metrics for the incoming request to my service. I could probably achieve this by using hacky This could be addressed by adding support for per request interceptors but assuming both the SDK level interceptors and the request level interceptors are executed for a given request, for metrics logging that may not be the most optimal API design and here is why: Consider an an application that processes messages from Kinesis using the KCL library which are then transformed and written to a different Kinesis stream. In such a case, I will want to use the same SDK instance for both the read and write to/from Kinesis as recommended by SDK docs. And since I have no way of assigning a request level interceptor for the get records call from KCL (since the call is made directly from the KCL code), I will have to add an SDK level interceptor. At the same time, I will also want to add a request level interceptor for the part of my code that does the Kinesis write so that the Kinesis write call metrics are tied to my unit of work which is the processing of each message. In such a setup, if both the interceptors are executed, I will have incorrect metrics logged (call counts, failures, avg latency etc). I thus think the interceptor API is too low level to be useful for flexible metrics logging and I ask that you reconsider the design you had for the V1 SDK that only executed one A dedicated API is definitely needed, purpose-built for metrics logging and should be addressed before the V2 SDK become more ubiquitous. |
Thank you, I have added my comments on the design PR |
An incremental implementation that at least adds the Java JVM Memory, JVM Threads and OS File Descriptors would be beneficial while the interfaces to the AWS specific metrics are worked out. |
@jeffsteinmetz Why should the SDK provide metrics on your application's JVM memory usage, file descriptors and threads? Do you mean memory, file descriptors and threads used by the SDK itself? If so, threads might be doable but I am not sure about memory usage. For file descriptors, may be it can provide number of open Http connections from the SDK but beyond that I am not very sure this should be in scope. |
@swaranga, feature parity with the 1.x Java SDK to provide JVM and Machine Metrics. We use this in the 1.x java sdk, see and https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/generating-sdk-metrics.html
and from the 1.x docs
|
+1, I could see it being nice to get JVM metrics into cloudwatch. It's more of a "Java on AWS" feature than a "Java SDK" feature, but it was included in the Java SDK 1.11.x, so it makes sense as a feature request. |
Understood. Although there seems to be no new development on the related PR's. Is this still a priority? |
We recognize this feature to be a blocker for many customers to migrate from 1.x to 2.x. We still believe this feature to be important and intend to implement it. |
Feature request from v1: Allow a user to add a JVM shutdown hook to drain metrics queue - aws/aws-sdk-java#1296 |
Hello! Do you have any ETA for this? Thanks. |
@gigiigig Sorry, we unfortunately can't provide ETAs, but we will keep this issue up to date as we progress. |
Hi all, We're happy to announce that the preview of the client-side metrics feature is now released! You can try it out starting with version |
From the blog post, it seems like the metrics publisher is configured at the SDK level. Can I also attach one at the per request level? The V1 SDK had that option to override it at the per request level that allowed us to publish the metrics for the request along with the current unit of work. Is that feasible? |
@swaranga Yep, absolutely. You can set publishers at the request level as well using the GetObjectRequest.builder()
...
.overrideConfiguration(o -> o.addMetricPublisher(myPublisher))
.build(); |
Is there any plan to provide a Micrometer based implementation for the metric publisher? |
Hi @gmariotti we don't have any plans currently for a Micrometer implementation. |
Hi everyone, the Metrics feature is now GA so I'm going to ahead and close this issue. Please check it out and feel free to open an Issue for any problems or feedback you have. https://aws.amazon.com/blogs/developer/client-side-metrics-for-the-aws-sdk-for-java-v2-is-now-generally-available/ |
It's possible to implement your own
|
@rehevkor5 Has your attempt to expose metrics to Micrometer been successful? Thanks! |
@rehevkor5 @ginkel this is my solution: https://gist.github.com/PatrykGala/e4aec004eb55cd8cbdee328f217771c7 |
Review the inherited state of V1 metrics and determine which changes are necessary for V2.
(Feel free to comment on this issue with desired changes).
The text was updated successfully, but these errors were encountered: