Search in sources :

Example 6 with TermsResult

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

the class SearchesTest method termsRecordsMetrics.

@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void termsRecordsMetrics() throws Exception {
    TermsResult result = searches.terms("n", 25, "*", 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 : Histogram(com.codahale.metrics.Histogram) Timer(com.codahale.metrics.Timer) TermsResult(org.graylog2.indexer.results.TermsResult) ZonedDateTime(java.time.ZonedDateTime) DateTime(org.joda.time.DateTime) UsingDataSet(com.lordofthejars.nosqlunit.annotation.UsingDataSet) Test(org.junit.Test)

Aggregations

TermsResult (org.graylog2.indexer.results.TermsResult)6 UsingDataSet (com.lordofthejars.nosqlunit.annotation.UsingDataSet)4 ZonedDateTime (java.time.ZonedDateTime)4 DateTime (org.joda.time.DateTime)4 Test (org.junit.Test)4 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 Terms (org.elasticsearch.search.aggregations.bucket.terms.Terms)1 IndexRange (org.graylog2.indexer.ranges.IndexRange)1 MongoIndexRange (org.graylog2.indexer.ranges.MongoIndexRange)1 ComputationResult (org.graylog2.plugin.dashboards.widgets.ComputationResult)1