Add the druid artifact version to metrics when emitted

This commit is contained in:
Charles Allen 2015-11-12 11:43:24 -08:00
parent 4f46d457f1
commit af34e9c8cb
1 changed files with 3 additions and 0 deletions

View File

@ -20,6 +20,7 @@ package io.druid.query;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.metamx.emitter.service.ServiceMetricEvent; import com.metamx.emitter.service.ServiceMetricEvent;
@ -37,6 +38,7 @@ public class DruidMetrics
public final static String INTERVAL = "interval"; public final static String INTERVAL = "interval";
public final static String ID = "id"; public final static String ID = "id";
public final static String STATUS = "status"; public final static String STATUS = "status";
public final static String VERSION = "version";
// task metrics // task metrics
public final static String TASK_TYPE = "taskType"; public final static String TASK_TYPE = "taskType";
@ -59,6 +61,7 @@ public class DruidMetrics
public static <T> ServiceMetricEvent.Builder makePartialQueryTimeMetric(Query<T> query) public static <T> ServiceMetricEvent.Builder makePartialQueryTimeMetric(Query<T> query)
{ {
return new ServiceMetricEvent.Builder() return new ServiceMetricEvent.Builder()
.setDimension(VERSION, Strings.nullToEmpty(DruidMetrics.class.getPackage().getImplementationVersion()))
.setDimension(DATASOURCE, DataSourceUtil.getMetricName(query.getDataSource())) .setDimension(DATASOURCE, DataSourceUtil.getMetricName(query.getDataSource()))
.setDimension(TYPE, query.getType()) .setDimension(TYPE, query.getType())
.setDimension( .setDimension(