Probably you know that we published a library that can be used to fetch some basic stats about AWS calls. That library uses an AWS request handler to build metrics that are later published in a text file, in various formats.
Recently we found an interesting library that does almost the same things, in a different manner, but it publishes many more stats. The repository of this library can be found here. Instead of using a request handler, it uses Java Proxy mechanism to inject code that extracts call details. Another name for this mechanism is dynamic proxy.
What we found interesting about this library:
- the mechanism to get metrics is very elegant
- The large number of stats collected for each AWS client and API type
- Prefix support that gives flexibility to build different metrics for the same AWS client
And some aspects to be improved
- No maven version: to use it, you have to clone the repository, build and then integrate in your application.
- Documentation is pretty bad. Examples provided in the documentation don’t compile, so you have to inspect code to see exactly how to use it. Also, there is no example on how exactly to get metrics. How we managed to generate some metrics:
//decorate AWS client MetricRegistry registry = new MetricRegistry(); InstrumentedAwsClientFactory instrument = new InstrumentedAwsClientFactory(registry); AmazonCloudWatch amazonCloudWatch = instrument.instrument(AmazonCloudWatch.class, cloudWatch, "my-test"); //call AWS DescribeAlarmsResult describeAlarmsResult = amazonCloudWatch.describeAlarms(); //get the metrics number System.out.println(registry.getMetrics().size());
- It would be nice to have a metod to dump all metrics somewhere. This means that after metrics are published, all counters are reset. From what we checked, this can be done only manually.
Hoping that the author of this library will consider our comments as being constructive, we declare more than open to work to improve this library that could become a must have in any AWS Java application 🙂