From 44dde21fc93fce2ab1b2bc84da4c3d4bd79240b5 Mon Sep 17 00:00:00 2001 From: Narimm Date: Tue, 28 Apr 2020 14:09:09 +1000 Subject: [PATCH] Fix Codahale Shading and ensure class not found errors are solved for 2.1.6. Relocate DripReporter Signed-off-by: Narimm --- pom.xml | 18 +++++++- .../me/botsko/prism/actions/ActionMeter.java | 41 +++++++++---------- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index d98e9e9a2..e36e3bef2 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,19 @@ au.com.addstar.dripreporter DripReporterAPI - 1.0 + 1.0.1 + + + io.dropwizard.metrics + metrics-core + 4.1.2 + provided + + + io.dropwizard.metrics + metrics-healthchecks + 4.1.2 + provided com.sk89q.worldedit @@ -211,6 +223,10 @@ com.zaxxer.hikari com.botsko.prism.libs.hikari + + au.com.addstar.dripreporter + com.botsko.prism.libs.dripreporter + diff --git a/src/main/java/me/botsko/prism/actions/ActionMeter.java b/src/main/java/me/botsko/prism/actions/ActionMeter.java index e9f486bc4..5b4a072e3 100644 --- a/src/main/java/me/botsko/prism/actions/ActionMeter.java +++ b/src/main/java/me/botsko/prism/actions/ActionMeter.java @@ -1,7 +1,6 @@ package me.botsko.prism.actions; import au.com.addstar.dripreporter.DripMeter; -import com.codahale.metrics.Meter; import com.codahale.metrics.MetricRegistry; import me.botsko.prism.Prism; @@ -13,42 +12,42 @@ * Created by benjamincharlton on 25/02/2020. */ public class ActionMeter { - private static Map meter = new HashMap<>(); - private static boolean monitoring = false; + private static final Map meter = new HashMap<>(); + private static final boolean monitoring = Prism.getInstance().monitoring; static { - meter.put(GenericAction.class.getSimpleName(), new DripMeter()); - meter.put(EntityAction.class.getSimpleName(), new DripMeter()); - meter.put(BlockAction.class.getSimpleName(), new DripMeter()); - meter.put(BlockChangeAction.class.getSimpleName(), new DripMeter()); - meter.put(ItemStackAction.class.getSimpleName(), new DripMeter()); - meter.put(BlockShiftAction.class.getSimpleName(), new DripMeter()); - meter.put(EntityTravelAction.class.getSimpleName(), new DripMeter()); - meter.put(GrowAction.class.getSimpleName(), new DripMeter()); - meter.put(HangingItemAction.class.getSimpleName(), new DripMeter()); - meter.put(PlayerAction.class.getSimpleName(), new DripMeter()); - meter.put(PlayerDeathAction.class.getSimpleName(), new DripMeter()); - meter.put(PrismProcessAction.class.getSimpleName(), new DripMeter()); - meter.put(PrismRollbackAction.class.getSimpleName(), new DripMeter()); - meter.put(SignAction.class.getSimpleName(), new DripMeter()); - meter.put(VehicleAction.class.getSimpleName(), new DripMeter()); + if (monitoring) { + meter.put(GenericAction.class.getSimpleName(), new DripMeter()); + meter.put(EntityAction.class.getSimpleName(), new DripMeter()); + meter.put(BlockAction.class.getSimpleName(), new DripMeter()); + meter.put(BlockChangeAction.class.getSimpleName(), new DripMeter()); + meter.put(ItemStackAction.class.getSimpleName(), new DripMeter()); + meter.put(BlockShiftAction.class.getSimpleName(), new DripMeter()); + meter.put(EntityTravelAction.class.getSimpleName(), new DripMeter()); + meter.put(GrowAction.class.getSimpleName(), new DripMeter()); + meter.put(HangingItemAction.class.getSimpleName(), new DripMeter()); + meter.put(PlayerAction.class.getSimpleName(), new DripMeter()); + meter.put(PlayerDeathAction.class.getSimpleName(), new DripMeter()); + meter.put(PrismProcessAction.class.getSimpleName(), new DripMeter()); + meter.put(PrismRollbackAction.class.getSimpleName(), new DripMeter()); + meter.put(SignAction.class.getSimpleName(), new DripMeter()); + meter.put(VehicleAction.class.getSimpleName(), new DripMeter()); + } } /** * Setup the meter to record. - * @param registry metric registry */ public static void setupActionMeter(MetricRegistry registry) { for (Map.Entry e : meter.entrySet()) { registry.register(e.getKey(), e.getValue()); } - monitoring = Prism.getInstance().monitoring; } @SuppressWarnings("rawtypes") static void mark(Class clazz) { if (monitoring) { - Meter m = meter.get(clazz.getSimpleName()); + DripMeter m = meter.get(clazz.getSimpleName()); if (m == null) { m = meter.get(GenericAction.class.getSimpleName()); }