Add getters for AlertEvent (#5522)

* Add getters for AlertEvent

* Move PublicApi and ExtensionPoint to java-util

* Fix publicapi annotation usage

* Add publicapi annotations to ServiceMetricEvent and RequestLogEvent
This commit is contained in:
Atul Mohan 2018-04-12 11:38:20 -05:00 committed by Roman Leventov
parent 48c1a1ef57
commit 19f359957f
5 changed files with 34 additions and 0 deletions

View File

@ -21,14 +21,17 @@ package io.druid.java.util.emitter.service;
import com.fasterxml.jackson.annotation.JsonValue;
import com.google.common.collect.ImmutableMap;
import io.druid.guice.annotations.PublicApi;
import io.druid.java.util.common.DateTimes;
import io.druid.java.util.emitter.core.Event;
import org.joda.time.DateTime;
import java.util.Collections;
import java.util.Map;
/**
*/
@PublicApi
public class AlertEvent implements Event
{
private final ImmutableMap<String, String> serviceDimensions;
@ -106,6 +109,24 @@ public class AlertEvent implements Event
return "alerts";
}
/*
* This method is used in certain proprietary emitter extensions
*/
@SuppressWarnings("unused")
public String getService()
{
return serviceDimensions.get("service");
}
/*
* This method is used in certain proprietary emitter extensions
*/
@SuppressWarnings("unused")
public String getHost()
{
return serviceDimensions.get("host");
}
public Severity getSeverity()
{
return severity;
@ -116,6 +137,15 @@ public class AlertEvent implements Event
return description;
}
/*
* This method is used in certain proprietary emitter extensions
*/
@SuppressWarnings("unused")
public Map<String, Object> getDataMap()
{
return Collections.unmodifiableMap(dataMap);
}
@Override
@JsonValue
public Map<String, Object> toMap()

View File

@ -23,6 +23,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import io.druid.guice.annotations.PublicApi;
import io.druid.java.util.common.DateTimes;
import io.druid.java.util.common.ISE;
import io.druid.java.util.emitter.core.Event;
@ -33,6 +34,7 @@ import java.util.Map;
/**
*/
@PublicApi
public class ServiceMetricEvent implements Event
{
public static Builder builder()

View File

@ -22,6 +22,7 @@ package io.druid.server.log;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import com.google.common.collect.ImmutableMap;
import io.druid.guice.annotations.PublicApi;
import io.druid.java.util.emitter.core.Event;
import io.druid.java.util.emitter.service.ServiceEmitter;
import io.druid.java.util.emitter.service.ServiceEventBuilder;
@ -58,6 +59,7 @@ public class EmittingRequestLogger implements RequestLogger
'}';
}
@PublicApi
public static class RequestLogEvent implements Event
{
final ImmutableMap<String, String> serviceDimensions;