Search in sources :

Example 1 with RegexMetricFilter

use of ratpack.dropwizard.metrics.internal.RegexMetricFilter in project ratpack by ratpack.

the class MetricsWebsocketBroadcastHandler method handle.

@Override
public void handle(final Context context) throws Exception {
    final MetricsBroadcaster broadcaster = context.get(MetricsBroadcaster.class);
    final ByteBufAllocator byteBufAllocator = context.get(ByteBufAllocator.class);
    final DropwizardMetricsConfig config = context.get(DropwizardMetricsConfig.class);
    MetricFilter filter = MetricFilter.ALL;
    if (config.getWebSocket().isPresent()) {
        filter = new RegexMetricFilter(config.getWebSocket().get().getIncludeFilter(), config.getWebSocket().get().getExcludeFilter());
    }
    websocketByteBufBroadcast(context, broadcaster.map(new MetricRegistryJsonMapper(byteBufAllocator, filter)));
}
Also used : ByteBufAllocator(io.netty.buffer.ByteBufAllocator) MetricsBroadcaster(ratpack.dropwizard.metrics.internal.MetricsBroadcaster) MetricFilter(com.codahale.metrics.MetricFilter) RegexMetricFilter(ratpack.dropwizard.metrics.internal.RegexMetricFilter) MetricRegistryJsonMapper(ratpack.dropwizard.metrics.internal.MetricRegistryJsonMapper) RegexMetricFilter(ratpack.dropwizard.metrics.internal.RegexMetricFilter)

Aggregations

MetricFilter (com.codahale.metrics.MetricFilter)1 ByteBufAllocator (io.netty.buffer.ByteBufAllocator)1 MetricRegistryJsonMapper (ratpack.dropwizard.metrics.internal.MetricRegistryJsonMapper)1 MetricsBroadcaster (ratpack.dropwizard.metrics.internal.MetricsBroadcaster)1 RegexMetricFilter (ratpack.dropwizard.metrics.internal.RegexMetricFilter)1