mirror of https://github.com/apache/druid.git
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:
parent
48c1a1ef57
commit
19f359957f
|
@ -21,14 +21,17 @@ package io.druid.java.util.emitter.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import io.druid.guice.annotations.PublicApi;
|
||||||
import io.druid.java.util.common.DateTimes;
|
import io.druid.java.util.common.DateTimes;
|
||||||
import io.druid.java.util.emitter.core.Event;
|
import io.druid.java.util.emitter.core.Event;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@PublicApi
|
||||||
public class AlertEvent implements Event
|
public class AlertEvent implements Event
|
||||||
{
|
{
|
||||||
private final ImmutableMap<String, String> serviceDimensions;
|
private final ImmutableMap<String, String> serviceDimensions;
|
||||||
|
@ -106,6 +109,24 @@ public class AlertEvent implements Event
|
||||||
return "alerts";
|
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()
|
public Severity getSeverity()
|
||||||
{
|
{
|
||||||
return severity;
|
return severity;
|
||||||
|
@ -116,6 +137,15 @@ public class AlertEvent implements Event
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This method is used in certain proprietary emitter extensions
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public Map<String, Object> getDataMap()
|
||||||
|
{
|
||||||
|
return Collections.unmodifiableMap(dataMap);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JsonValue
|
@JsonValue
|
||||||
public Map<String, Object> toMap()
|
public Map<String, Object> toMap()
|
||||||
|
|
|
@ -23,6 +23,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Maps;
|
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.DateTimes;
|
||||||
import io.druid.java.util.common.ISE;
|
import io.druid.java.util.common.ISE;
|
||||||
import io.druid.java.util.emitter.core.Event;
|
import io.druid.java.util.emitter.core.Event;
|
||||||
|
@ -33,6 +34,7 @@ import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@PublicApi
|
||||||
public class ServiceMetricEvent implements Event
|
public class ServiceMetricEvent implements Event
|
||||||
{
|
{
|
||||||
public static Builder builder()
|
public static Builder builder()
|
||||||
|
|
|
@ -22,6 +22,7 @@ package io.druid.server.log;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import com.google.common.collect.ImmutableMap;
|
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.core.Event;
|
||||||
import io.druid.java.util.emitter.service.ServiceEmitter;
|
import io.druid.java.util.emitter.service.ServiceEmitter;
|
||||||
import io.druid.java.util.emitter.service.ServiceEventBuilder;
|
import io.druid.java.util.emitter.service.ServiceEventBuilder;
|
||||||
|
@ -58,6 +59,7 @@ public class EmittingRequestLogger implements RequestLogger
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PublicApi
|
||||||
public static class RequestLogEvent implements Event
|
public static class RequestLogEvent implements Event
|
||||||
{
|
{
|
||||||
final ImmutableMap<String, String> serviceDimensions;
|
final ImmutableMap<String, String> serviceDimensions;
|
||||||
|
|
Loading…
Reference in New Issue