# Oreo EMF Metrics Utility
This package is an example Java library package using the HappierTrails build system. It provides a basic Apache Ant `build.xml` that imports the additional Ant scripts `happytrails.xml` and `happier-trails.xml`.
### How to use
- Build `IAMIntelOreoMetricUtils` from live
- Inject `com.amazon.iaminteloreometricutils.metrics.MetricsContextFactory` to client class using dagger. Remember to configure default dimensions if needed. [Example](https://code.amazon.com/packages/IAMIntelOreoInvokeWorkflowLambda/blobs/a09a22d2c8fb29cbecaaa7091380ef92ab6ef58d/--/src/com/amazon/iaminteloreoinvokeworkflowlambda/dagger/HandlerModule.java#L117-L122)
- Use try with resource block to get `MetricContext` per client. Discard after publishing metrics. [Example](https://code.amazon.com/packages/IAMIntelOreoInvokeWorkflowLambda/blobs/a09a22d2c8fb29cbecaaa7091380ef92ab6ef58d/--/src/com/amazon/iaminteloreoinvokeworkflowlambda/handler/Handler.java#L68)
- Each dimension will result in a new column on CW. Custom dimensions set for `MetricsContext` will be lost when it goes out of scope. But default dimensions will be preserved from `MetricsContextFactory`.
#References
* Apache Ant Manual: https://ant.apache.org/manual/index.html
* Debugging Apache Ant Scripts: https://ant.apache.org/problems.html
* JUnit5 User Guide: https://junit.org/junit5/docs/current/user-guide/
* JUnit5 Apache Ant Task: https://ant.apache.org/manual/Tasks/junitlauncher.html
* HappierTrails Wiki: https://w.amazon.com/bin/view/BrazilBuildSystem/HappierTrails/
* HappierTrails Properties Guide: https://w.amazon.com/index.php/BrazilBuildSystem/HappierTrails/PropertiesGuide