Search in sources :

Example 6 with FieldStatsResult

use of org.graylog2.indexer.results.FieldStatsResult in project graylog2-server by Graylog2.

the class SearchesTest method fieldStatsRecordsMetrics.

@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void fieldStatsRecordsMetrics() throws Exception {
    FieldStatsResult result = searches.fieldStats("n", "*", AbsoluteRange.create(new DateTime(2015, 1, 1, 0, 0, DateTimeZone.UTC), new DateTime(2015, 1, 2, 0, 0, DateTimeZone.UTC)));
    assertThat(metricRegistry.getTimers()).containsKey(REQUEST_TIMER_NAME);
    assertThat(metricRegistry.getHistograms()).containsKey(RANGES_HISTOGRAM_NAME);
    Timer timer = metricRegistry.timer(REQUEST_TIMER_NAME);
    assertThat(timer.getCount()).isEqualTo(1L);
    Histogram histogram = metricRegistry.histogram(RANGES_HISTOGRAM_NAME);
    assertThat(histogram.getCount()).isEqualTo(1L);
    assertThat(histogram.getSnapshot().getValues()).containsExactly(86400L);
}
Also used : FieldStatsResult(org.graylog2.indexer.results.FieldStatsResult) Histogram(com.codahale.metrics.Histogram) Timer(com.codahale.metrics.Timer) ZonedDateTime(java.time.ZonedDateTime) DateTime(org.joda.time.DateTime) UsingDataSet(com.lordofthejars.nosqlunit.annotation.UsingDataSet) Test(org.junit.Test)

Aggregations

FieldStatsResult (org.graylog2.indexer.results.FieldStatsResult)6 DateTime (org.joda.time.DateTime)3 UsingDataSet (com.lordofthejars.nosqlunit.annotation.UsingDataSet)2 ZonedDateTime (java.time.ZonedDateTime)2 Searches (org.graylog2.indexer.searches.Searches)2 Test (org.junit.Test)2 Histogram (com.codahale.metrics.Histogram)1 Timer (com.codahale.metrics.Timer)1 SearchRequest (org.elasticsearch.action.search.SearchRequest)1 SearchRequestBuilder (org.elasticsearch.action.search.SearchRequestBuilder)1 SearchResponse (org.elasticsearch.action.search.SearchResponse)1 Filter (org.elasticsearch.search.aggregations.bucket.filter.Filter)1 FilterAggregationBuilder (org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder)1 InvalidRangeFormatException (org.graylog2.indexer.InvalidRangeFormatException)1 ResultMessage (org.graylog2.indexer.results.ResultMessage)1 Message (org.graylog2.plugin.Message)1 MessageSummary (org.graylog2.plugin.MessageSummary)1 ComputationResult (org.graylog2.plugin.dashboards.widgets.ComputationResult)1 InvalidRangeParametersException (org.graylog2.plugin.indexer.searches.timeranges.InvalidRangeParametersException)1 RelativeRange (org.graylog2.plugin.indexer.searches.timeranges.RelativeRange)1