Define a Custom Metric or Event

It can also be useful to report a value as a custom metric:

public String checkout(List<ItemOrders> orders) {
// ... Method code
double shoppingCartTotal = total(orders);
AppdynamicsAgent.getMetricPublisher().reportSumMetric("Cart Total", (long) shoppingCartTotal);
}
Note: It is recommended to provide a metric path along with the metric name in the code with format: Server|Component:<TierName>|Custom Metrics|<MetricName>, while publishing the metric.

Reporting custom metrics and events is possible irrespective of the Business Transaction context.