use of com.metamx.emitter.service.AlertEvent in project druid by druid-io.
the class GraphiteEmitter method emit.
@Override
public void emit(Event event) {
if (!started.get()) {
throw new ISE("WTF emit was called while service is not started yet");
}
if (event instanceof ServiceMetricEvent) {
final GraphiteEvent graphiteEvent = graphiteEventConverter.druidEventToGraphite((ServiceMetricEvent) event);
if (graphiteEvent == null) {
return;
}
try {
final boolean isSuccessful = eventsQueue.offer(graphiteEvent, graphiteEmitterConfig.getEmitWaitTime(), TimeUnit.MILLISECONDS);
if (!isSuccessful) {
if (countLostEvents.getAndIncrement() % 1000 == 0) {
log.error("Lost total of [%s] events because of emitter queue is full. Please increase the capacity or/and the consumer frequency", countLostEvents.get());
}
}
} catch (InterruptedException e) {
log.error(e, "got interrupted with message [%s]", e.getMessage());
Thread.currentThread().interrupt();
}
} else if (!emitterList.isEmpty() && event instanceof AlertEvent) {
for (Emitter emitter : emitterList) {
emitter.emit(event);
}
} else if (event instanceof AlertEvent) {
AlertEvent alertEvent = (AlertEvent) event;
log.error("The following alert is dropped, description is [%s], severity is [%s]", alertEvent.getDescription(), alertEvent.getSeverity());
} else {
log.error("unknown event type [%s]", event.getClass());
}
}
Aggregations