Skip to content

Commit

Permalink
Merge pull request apache#430 from metamx/fix-null-query-id
Browse files Browse the repository at this point in the history
Set queryId in MetricsEmittingQueryRunner
  • Loading branch information
fjy committed Mar 17, 2014
2 parents 8e5cbca + 7e97073 commit bd2ef2f
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ public MetricsEmittingQueryRunner<T> withWaitMeasuredFromNow()
public Sequence<T> run(final Query<T> query)
{
final ServiceMetricEvent.Builder builder = builderFn.apply(query);
String queryId = query.getId();
if (queryId == null) {
queryId = "";
}
builder.setUser8(queryId);

return new Sequence<T>()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ public ServiceMetricEvent.Builder makeMetricBuilder(GroupByQuery query)
.setUser5(Joiner.on(",").join(query.getIntervals()))
.setUser6(String.valueOf(query.hasFilters()))
.setUser7(String.format("%,d aggs", query.getAggregatorSpecs().size()))
.setUser9(Minutes.minutes(numMinutes).toString())
.setUser10(query.getId());
.setUser9(Minutes.minutes(numMinutes).toString());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ public ServiceMetricEvent.Builder makeMetricBuilder(SegmentMetadataQuery query)
.setUser4(query.getType())
.setUser5(Joiner.on(",").join(query.getIntervals()))
.setUser6(String.valueOf(query.hasFilters()))
.setUser9(Minutes.minutes(numMinutes).toString())
.setUser10(query.getId());
.setUser9(Minutes.minutes(numMinutes).toString());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ public ServiceMetricEvent.Builder makeMetricBuilder(SearchQuery query)
.setUser4("search")
.setUser5(COMMA_JOIN.join(query.getIntervals()))
.setUser6(String.valueOf(query.hasFilters()))
.setUser9(Minutes.minutes(numMinutes).toString())
.setUser10(query.getId());
.setUser9(Minutes.minutes(numMinutes).toString());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ public ServiceMetricEvent.Builder makeMetricBuilder(SelectQuery query)
.setUser4("Select")
.setUser5(COMMA_JOIN.join(query.getIntervals()))
.setUser6(String.valueOf(query.hasFilters()))
.setUser9(Minutes.minutes(numMinutes).toString())
.setUser10(query.getId());
.setUser9(Minutes.minutes(numMinutes).toString());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ public ServiceMetricEvent.Builder makeMetricBuilder(TimeBoundaryQuery query)
return new ServiceMetricEvent.Builder()
.setUser2(query.getDataSource().toString())
.setUser4(query.getType())
.setUser6("false")
.setUser10(query.getId());
.setUser6("false");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ public ServiceMetricEvent.Builder makeMetricBuilder(TimeseriesQuery query)
.setUser5(COMMA_JOIN.join(query.getIntervals()))
.setUser6(String.valueOf(query.hasFilters()))
.setUser7(String.format("%,d aggs", query.getAggregatorSpecs().size()))
.setUser9(Minutes.minutes(numMinutes).toString())
.setUser10(query.getId());
.setUser9(Minutes.minutes(numMinutes).toString());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ public ServiceMetricEvent.Builder makeMetricBuilder(TopNQuery query)
.setUser5(COMMA_JOIN.join(query.getIntervals()))
.setUser6(String.valueOf(query.hasFilters()))
.setUser7(String.format("%,d aggs", query.getAggregatorSpecs().size()))
.setUser9(Minutes.minutes(numMinutes).toString())
.setUser10(query.getId());
.setUser9(Minutes.minutes(numMinutes).toString());
}

@Override
Expand Down

0 comments on commit bd2ef2f

Please sign in to comment.