public void handleAfter(AdvisorContext advisorContext) {
logger.info("MyHandler handleAfter() called");
// use the NamingStrategy to create proper metric qualifiers
// the domain is related to the area where the metric originates
String name = DefaultNamingStrategy.getInstrumentedAdviceName(advisorContext);
MetricMessage message = new MetricMessage(Domain.application, name, new Date());
// you can add any amount of field to the message.
message.addField("correlationId", advisorContext.getCorrelationId());
message.addField("trigger", trigger);
message.addField("args", args);
try {
// always access via the CollectorFactory
ApexCollectorFactory.get().reportDirect(this.getClass(), message);
} catch (Exception e) {
logger.error("Could not send message", e);
}
}