mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
base exception metrics on name only
This commit is contained in:
parent
fed7a9e173
commit
d905c35254
@ -80,10 +80,10 @@ public class NBCycleErrorHandler implements CycleErrorHandler<Throwable, ErrorSt
|
|||||||
case retry:
|
case retry:
|
||||||
retry = true;
|
retry = true;
|
||||||
case histogram:
|
case histogram:
|
||||||
exceptionHistoMetrics.update(error,cce.getDurationNanos());
|
exceptionHistoMetrics.update(error.getClass().getSimpleName(),cce.getDurationNanos());
|
||||||
case count:
|
case count:
|
||||||
case counter:
|
case counter:
|
||||||
exceptionCountMetrics.count(error);
|
exceptionCountMetrics.count(error.getClass().getSimpleName());
|
||||||
case ignore:
|
case ignore:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -80,10 +80,10 @@ public class NBCycleErrorHandler implements CycleErrorHandler<Throwable, ErrorSt
|
|||||||
case retry:
|
case retry:
|
||||||
retry = true;
|
retry = true;
|
||||||
case histogram:
|
case histogram:
|
||||||
exceptionHistoMetrics.update(error,cce.getDurationNanos());
|
exceptionHistoMetrics.update(error.getClass().getSimpleName(),cce.getDurationNanos());
|
||||||
case count:
|
case count:
|
||||||
case counter:
|
case counter:
|
||||||
exceptionCountMetrics.count(error);
|
exceptionCountMetrics.count(error.getClass().getSimpleName());
|
||||||
case ignore:
|
case ignore:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -59,7 +59,7 @@ public class GraphErrorHandler {
|
|||||||
case retry:
|
case retry:
|
||||||
retry = true;
|
retry = true;
|
||||||
case count:
|
case count:
|
||||||
exceptionMeterMetrics.mark(realerror);
|
exceptionMeterMetrics.mark(realerror.getClass().getSimpleName());
|
||||||
case ignore:
|
case ignore:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -78,7 +78,7 @@ public class GraphErrorHandler {
|
|||||||
case retry:
|
case retry:
|
||||||
retry = true;
|
retry = true;
|
||||||
case count:
|
case count:
|
||||||
exceptionMeterMetrics.mark(retryable);
|
exceptionMeterMetrics.mark(retryable.getClass().getSimpleName());
|
||||||
case ignore:
|
case ignore:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -65,7 +65,7 @@ public class JDBCAction implements SyncAction {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.debug("Try " + tries + ": failed to execute statement: " + sql, e);
|
LOGGER.debug("Try " + tries + ": failed to execute statement: " + sql, e);
|
||||||
|
|
||||||
activity.getExceptionCount().count(e);
|
activity.getExceptionCount().count(e.getClass().getSimpleName());
|
||||||
|
|
||||||
if (e instanceof SQLException) {
|
if (e instanceof SQLException) {
|
||||||
SQLException sqle = (SQLException) e;
|
SQLException sqle = (SQLException) e;
|
||||||
|
@ -28,20 +28,20 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
* Use this to provide exception metering in a uniform way.
|
* Use this to provide exception metering in a uniform way.
|
||||||
*/
|
*/
|
||||||
public class ExceptionCountMetrics {
|
public class ExceptionCountMetrics {
|
||||||
private final ConcurrentHashMap<Class<? extends Throwable>, Counter> counters = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, Counter> counters = new ConcurrentHashMap<>();
|
||||||
private final ActivityDef activityDef;
|
private final ActivityDef activityDef;
|
||||||
|
|
||||||
public ExceptionCountMetrics(ActivityDef activityDef) {
|
public ExceptionCountMetrics(ActivityDef activityDef) {
|
||||||
this.activityDef = activityDef;
|
this.activityDef = activityDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void count(Throwable e) {
|
public void count(String name) {
|
||||||
Counter c = counters.get(e.getClass());
|
Counter c = counters.get(name);
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
synchronized (counters) {
|
synchronized (counters) {
|
||||||
c = counters.computeIfAbsent(
|
c = counters.computeIfAbsent(
|
||||||
e.getClass(),
|
name,
|
||||||
k -> ActivityMetrics.counter(activityDef, "errorcounts." + e.getClass().getSimpleName())
|
k -> ActivityMetrics.counter(activityDef, "errorcounts." + name)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,20 +30,20 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
* from each type of error you want to track.
|
* from each type of error you want to track.
|
||||||
*/
|
*/
|
||||||
public class ExceptionHistoMetrics {
|
public class ExceptionHistoMetrics {
|
||||||
private final ConcurrentHashMap<Class<? extends Throwable>, Histogram> histos = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, Histogram> histos = new ConcurrentHashMap<>();
|
||||||
private final ActivityDef activityDef;
|
private final ActivityDef activityDef;
|
||||||
|
|
||||||
public ExceptionHistoMetrics(ActivityDef activityDef) {
|
public ExceptionHistoMetrics(ActivityDef activityDef) {
|
||||||
this.activityDef = activityDef;
|
this.activityDef = activityDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(Throwable e, long magnitude) {
|
public void update(String name, long magnitude) {
|
||||||
Histogram h = histos.get(e.getClass());
|
Histogram h = histos.get(name);
|
||||||
if (h == null) {
|
if (h == null) {
|
||||||
synchronized (histos) {
|
synchronized (histos) {
|
||||||
h = histos.computeIfAbsent(
|
h = histos.computeIfAbsent(
|
||||||
e.getClass(),
|
name,
|
||||||
k -> ActivityMetrics.histogram(activityDef, "errorhistos." + e.getClass().getSimpleName())
|
k -> ActivityMetrics.histogram(activityDef, "errorhistos." + name)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,20 +28,20 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
* Use this to provide exception metering in a uniform way.
|
* Use this to provide exception metering in a uniform way.
|
||||||
*/
|
*/
|
||||||
public class ExceptionMeterMetrics {
|
public class ExceptionMeterMetrics {
|
||||||
private final ConcurrentHashMap<Class<? extends Throwable>, Meter> meters = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, Meter> meters = new ConcurrentHashMap<>();
|
||||||
private final ActivityDef activityDef;
|
private final ActivityDef activityDef;
|
||||||
|
|
||||||
public ExceptionMeterMetrics(ActivityDef activityDef) {
|
public ExceptionMeterMetrics(ActivityDef activityDef) {
|
||||||
this.activityDef = activityDef;
|
this.activityDef = activityDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mark(Throwable t) {
|
public void mark(String name) {
|
||||||
Meter c = meters.get(t.getClass());
|
Meter c = meters.get(name);
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
synchronized (meters) {
|
synchronized (meters) {
|
||||||
c = meters.computeIfAbsent(
|
c = meters.computeIfAbsent(
|
||||||
t.getClass(),
|
name,
|
||||||
k -> ActivityMetrics.meter(activityDef, "exceptions." + t.getClass().getSimpleName())
|
k -> ActivityMetrics.meter(activityDef, "exceptions." + name)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,20 +29,20 @@ import java.util.concurrent.TimeUnit;
|
|||||||
* Use this to provide exception metering in a uniform way.
|
* Use this to provide exception metering in a uniform way.
|
||||||
*/
|
*/
|
||||||
public class ExceptionTimerMetrics {
|
public class ExceptionTimerMetrics {
|
||||||
private final ConcurrentHashMap<Class<? extends Throwable>, Timer> timers = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, Timer> timers = new ConcurrentHashMap<>();
|
||||||
private final ActivityDef activityDef;
|
private final ActivityDef activityDef;
|
||||||
|
|
||||||
public ExceptionTimerMetrics(ActivityDef activityDef) {
|
public ExceptionTimerMetrics(ActivityDef activityDef) {
|
||||||
this.activityDef = activityDef;
|
this.activityDef = activityDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(Throwable throwable, long nanosDuration) {
|
public void update(String name, long nanosDuration) {
|
||||||
Timer timer = timers.get(throwable.getClass());
|
Timer timer = timers.get(name);
|
||||||
if (timer == null) {
|
if (timer == null) {
|
||||||
synchronized (timers) {
|
synchronized (timers) {
|
||||||
timer = timers.computeIfAbsent(
|
timer = timers.computeIfAbsent(
|
||||||
throwable.getClass(),
|
name,
|
||||||
k -> ActivityMetrics.timer(activityDef, "exceptions." + throwable.getClass().getSimpleName())
|
k -> ActivityMetrics.timer(activityDef, "exceptions." + name)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user