Example of using metrics in java applications