Search in sources :

Example 1 with HistogramTransformer

use of com.codahale.metrics.newrelic.transformer.HistogramTransformer in project dropwizard-metrics-newrelic by newrelic.

the class NewRelicReporterTest method setup.

@BeforeEach
void setup() {
    commonAttributes = new Attributes().put("name", "the best").put("foo", false);
    gaugeTransformer = mock(GaugeTransformer.class);
    histogramTransformer = mock(HistogramTransformer.class);
    counterTransformer = mock(CounterTransformer.class);
    meterTransformer = mock(MeterTransformer.class);
    timerTransformer = mock(TimerTransformer.class);
    sender = mock(TelemetryClient.class);
    timeTracker = mock(TimeTracker.class);
    metricRegistry = new MetricRegistry();
}
Also used : CounterTransformer(com.codahale.metrics.newrelic.transformer.CounterTransformer) HistogramTransformer(com.codahale.metrics.newrelic.transformer.HistogramTransformer) TimerTransformer(com.codahale.metrics.newrelic.transformer.TimerTransformer) TimeTracker(com.codahale.metrics.newrelic.util.TimeTracker) MetricRegistry(com.codahale.metrics.MetricRegistry) Attributes(com.newrelic.telemetry.Attributes) MeterTransformer(com.codahale.metrics.newrelic.transformer.MeterTransformer) TelemetryClient(com.newrelic.telemetry.TelemetryClient) GaugeTransformer(com.codahale.metrics.newrelic.transformer.GaugeTransformer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with HistogramTransformer

use of com.codahale.metrics.newrelic.transformer.HistogramTransformer in project dropwizard-metrics-newrelic by newrelic.

the class NewRelicReporterBuilder method build.

public NewRelicReporter build() {
    long rateFactor = rateUnit.toSeconds(1);
    double durationFactor = durationUnit.toNanos(1);
    Predicate<MetricAttribute> metricAttributePredicate = attr -> !disabledMetricAttributes.contains(attr);
    TimeTracker timeTracker = new TimeTracker(Clock.defaultClock());
    MeterTransformer meterTransformer = MeterTransformer.build(timeTracker, rateFactor, metricAttributePredicate, nameCustomizer, attributeCustomizer);
    TimerTransformer timerTransformer = TimerTransformer.build(timeTracker, rateFactor, durationFactor, metricAttributePredicate, nameCustomizer, attributeCustomizer);
    GaugeTransformer gaugeTransformer = new GaugeTransformer(nameCustomizer, attributeCustomizer);
    CounterTransformer counterTransformer = new CounterTransformer(nameCustomizer, attributeCustomizer);
    HistogramTransformer histogramTransformer = HistogramTransformer.build(timeTracker, nameCustomizer, attributeCustomizer);
    return new NewRelicReporter(timeTracker, registry, name, filter, rateUnit, durationUnit, new TelemetryClient(metricBatchSender, null, null, null), commonAttributes, histogramTransformer, gaugeTransformer, counterTransformer, meterTransformer, timerTransformer, disabledMetricAttributes);
}
Also used : Clock(com.codahale.metrics.Clock) TimeTracker(com.codahale.metrics.newrelic.util.TimeTracker) MetricRegistry(com.codahale.metrics.MetricRegistry) MetricAttributesCustomizer(com.codahale.metrics.newrelic.transformer.customizer.MetricAttributesCustomizer) TelemetryClient(com.newrelic.telemetry.TelemetryClient) TimerTransformer(com.codahale.metrics.newrelic.transformer.TimerTransformer) Predicate(java.util.function.Predicate) Attributes(com.newrelic.telemetry.Attributes) Set(java.util.Set) HistogramTransformer(com.codahale.metrics.newrelic.transformer.HistogramTransformer) TimeUnit(java.util.concurrent.TimeUnit) MetricAttribute(com.codahale.metrics.MetricAttribute) CounterTransformer(com.codahale.metrics.newrelic.transformer.CounterTransformer) MeterTransformer(com.codahale.metrics.newrelic.transformer.MeterTransformer) MetricNameCustomizer(com.codahale.metrics.newrelic.transformer.customizer.MetricNameCustomizer) MetricBatchSender(com.newrelic.telemetry.metrics.MetricBatchSender) MetricFilter(com.codahale.metrics.MetricFilter) GaugeTransformer(com.codahale.metrics.newrelic.transformer.GaugeTransformer) Collections(java.util.Collections) HistogramTransformer(com.codahale.metrics.newrelic.transformer.HistogramTransformer) TimerTransformer(com.codahale.metrics.newrelic.transformer.TimerTransformer) MeterTransformer(com.codahale.metrics.newrelic.transformer.MeterTransformer) MetricAttribute(com.codahale.metrics.MetricAttribute) TelemetryClient(com.newrelic.telemetry.TelemetryClient) CounterTransformer(com.codahale.metrics.newrelic.transformer.CounterTransformer) TimeTracker(com.codahale.metrics.newrelic.util.TimeTracker) GaugeTransformer(com.codahale.metrics.newrelic.transformer.GaugeTransformer)

Aggregations

MetricRegistry (com.codahale.metrics.MetricRegistry)2 CounterTransformer (com.codahale.metrics.newrelic.transformer.CounterTransformer)2 GaugeTransformer (com.codahale.metrics.newrelic.transformer.GaugeTransformer)2 HistogramTransformer (com.codahale.metrics.newrelic.transformer.HistogramTransformer)2 MeterTransformer (com.codahale.metrics.newrelic.transformer.MeterTransformer)2 TimerTransformer (com.codahale.metrics.newrelic.transformer.TimerTransformer)2 TimeTracker (com.codahale.metrics.newrelic.util.TimeTracker)2 Attributes (com.newrelic.telemetry.Attributes)2 TelemetryClient (com.newrelic.telemetry.TelemetryClient)2 Clock (com.codahale.metrics.Clock)1 MetricAttribute (com.codahale.metrics.MetricAttribute)1 MetricFilter (com.codahale.metrics.MetricFilter)1 MetricAttributesCustomizer (com.codahale.metrics.newrelic.transformer.customizer.MetricAttributesCustomizer)1 MetricNameCustomizer (com.codahale.metrics.newrelic.transformer.customizer.MetricNameCustomizer)1 MetricBatchSender (com.newrelic.telemetry.metrics.MetricBatchSender)1 Collections (java.util.Collections)1 Set (java.util.Set)1 TimeUnit (java.util.concurrent.TimeUnit)1 Predicate (java.util.function.Predicate)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1