diff --git a/api/src/main/java/datawave/microservice/querymetric/BaseQueryMetric.java b/api/src/main/java/datawave/microservice/querymetric/BaseQueryMetric.java index 6c071ec..438770a 100644 --- a/api/src/main/java/datawave/microservice/querymetric/BaseQueryMetric.java +++ b/api/src/main/java/datawave/microservice/querymetric/BaseQueryMetric.java @@ -671,6 +671,10 @@ public int getFieldNumber(String name) { @XmlElement protected long seekCount = 0; @XmlElement + protected long evaluatedCount = 0; + @XmlElement + protected long rejectedCount = 0; + @XmlElement protected long yieldCount = 0L; @XmlElement @XmlJavaTypeAdapter(StringMapAdapter.class) @@ -897,6 +901,22 @@ public void setSeekCount(long seekCount) { this.seekCount = seekCount; } + public long getEvaluatedCount() { + return evaluatedCount; + } + + public void setEvaluatedCount(long evaluatedCount) { + this.evaluatedCount = evaluatedCount; + } + + public long getRejectedCount() { + return rejectedCount; + } + + public void setRejectedCount(long rejectedCount) { + this.rejectedCount = rejectedCount; + } + public long getYieldCount() { return this.yieldCount; } diff --git a/api/src/main/java/datawave/microservice/querymetric/QueryMetric.java b/api/src/main/java/datawave/microservice/querymetric/QueryMetric.java index 2db59b2..a9ce56b 100644 --- a/api/src/main/java/datawave/microservice/querymetric/QueryMetric.java +++ b/api/src/main/java/datawave/microservice/querymetric/QueryMetric.java @@ -97,6 +97,8 @@ public QueryMetric(QueryMetric other) { this.sourceCount = other.sourceCount; this.nextCount = other.nextCount; this.seekCount = other.seekCount; + this.evaluatedCount = other.evaluatedCount; + this.rejectedCount = other.rejectedCount; this.yieldCount = other.yieldCount; this.versionMap = other.versionMap; this.docSize = other.docSize; @@ -143,7 +145,7 @@ public int hashCode() { .append(this.getParameters()).append(this.getSourceCount()).append(this.getNextCount()).append(this.getSeekCount()) .append(this.getYieldCount()).append(this.getDocSize()).append(this.getDocRanges()).append(this.getFiRanges()).append(this.getPlan()) .append(this.getLoginTime()).append(this.getPredictions()).append(this.getMarkings()).append(this.getNumUpdates()) - .append(this.getVersionMap()).toHashCode(); + .append(this.getVersionMap()).append(this.getEvaluatedCount()).append(this.getRejectedCount()).toHashCode(); } @Override @@ -169,6 +171,7 @@ public boolean equals(Object o) { .append(this.getErrorCode(), other.getErrorCode()).append(this.getSourceCount(), other.getSourceCount()) .append(this.getNextCount(), other.getNextCount()).append(this.getSeekCount(), other.getSeekCount()) .append(this.getYieldCount(), other.getYieldCount()).append(this.getDocSize(), other.getDocSize()) + .append(this.getEvaluatedCount(), other.getEvaluatedCount()).append(this.getRejectedCount(), other.getRejectedCount()) .append(this.getDocRanges(), other.getDocRanges()).append(this.getFiRanges(), other.getFiRanges()) .append(this.getPlan(), other.getPlan()).append(this.getLoginTime(), other.getLoginTime()) .append(this.getPredictions(), other.getPredictions()).append(this.getMarkings(), other.getMarkings()) @@ -209,6 +212,8 @@ public String toString() { buf.append(" Source Count: ").append(this.getSourceCount()); buf.append(" NextCount: ").append(this.getNextCount()); buf.append(" Seek Count: ").append(this.getSeekCount()); + buf.append(" Evaluated Count: ").append(this.getEvaluatedCount()); + buf.append(" Rejected Count: ").append(this.getRejectedCount()); buf.append(" Yield Count: ").append(this.getYieldCount()); buf.append(" Doc Size: ").append(this.getDocSize()); buf.append(" Doc Ranges: ").append(this.getDocRanges()); @@ -406,8 +411,10 @@ public void writeTo(Output output, QueryMetric message) throws IOException { output.writeString(38, StringUtils.join(Arrays.asList(entry.getKey(), entry.getValue()), "\0"), true); } } - + output.writeInt64(39, message.docSize, false); + output.writeInt64(40, message.evaluatedCount, false); + output.writeInt64(41, message.rejectedCount, false); } public void mergeFrom(Input input, QueryMetric message) throws IOException { @@ -559,6 +566,12 @@ public void mergeFrom(Input input, QueryMetric message) throws IOException { case 39: message.docSize = input.readInt64(); break; + case 40: + message.evaluatedCount = input.readInt64(); + break; + case 41: + message.rejectedCount = input.readInt64(); + break; default: input.handleUnknownField(number, this); break; @@ -647,6 +660,10 @@ public String getFieldName(int number) { return "versionMap"; case 39: return "docSize"; + case 40: + return "evaluatedCount"; + case 41: + return "rejectedCount"; default: return null; } @@ -699,6 +716,8 @@ public int getFieldNumber(String name) { fieldMap.put("version", 37); fieldMap.put("versionMap", 38); fieldMap.put("docSize", 39); + fieldMap.put("evaluatedCount", 40); + fieldMap.put("rejectedCount", 41); } }; diff --git a/api/src/main/java/datawave/microservice/querymetric/QueryMetricModel.java b/api/src/main/java/datawave/microservice/querymetric/QueryMetricModel.java index 39a72b2..982bdf4 100644 --- a/api/src/main/java/datawave/microservice/querymetric/QueryMetricModel.java +++ b/api/src/main/java/datawave/microservice/querymetric/QueryMetricModel.java @@ -145,6 +145,14 @@ public String getSeekCountStr() { return nf.format(seekCount); } + public String getEvaluatedCountStr() { + return nf.format(evaluatedCount); + } + + public String getRejectedCountStr() { + return nf.format(rejectedCount); + } + public String getYieldCountStr() { return nf.format(yieldCount); } diff --git a/api/src/main/java/datawave/microservice/querymetric/QueryMetricModelFormat.java b/api/src/main/java/datawave/microservice/querymetric/QueryMetricModelFormat.java index bbbfa28..39b6d9e 100644 --- a/api/src/main/java/datawave/microservice/querymetric/QueryMetricModelFormat.java +++ b/api/src/main/java/datawave/microservice/querymetric/QueryMetricModelFormat.java @@ -58,6 +58,10 @@ public interface QueryMetricModelFormat { String getSeekCountStr(); + String getEvaluatedCountStr(); + + String getRejectedCountStr(); + String getYieldCountStr(); String getVersionStr(); diff --git a/api/src/main/resources/templates/querymetric-horizontal.html b/api/src/main/resources/templates/querymetric-horizontal.html index 0be9408..3156a9d 100644 --- a/api/src/main/resources/templates/querymetric-horizontal.html +++ b/api/src/main/resources/templates/querymetric-horizontal.html @@ -58,6 +58,8 @@

Query Metrics

Sources Next Calls Seek Calls + Evaluated Events + Rejected Events Yield Count Versions Total Page Time (ms) diff --git a/api/src/main/resources/templates/querymetric.html b/api/src/main/resources/templates/querymetric.html index b08ef8d..7be5841 100644 --- a/api/src/main/resources/templates/querymetric.html +++ b/api/src/main/resources/templates/querymetric.html @@ -130,6 +130,8 @@

Query Metrics

Sources Next Calls Seek Calls + Events Evaluated + Events Rejected Yield Count Total Page Time (ms) Total Page Call Time (ms) diff --git a/service/src/main/java/datawave/microservice/querymetric/MetricUpdateEntryProcessor.java b/service/src/main/java/datawave/microservice/querymetric/MetricUpdateEntryProcessor.java index 05f154a..c797e2c 100644 --- a/service/src/main/java/datawave/microservice/querymetric/MetricUpdateEntryProcessor.java +++ b/service/src/main/java/datawave/microservice/querymetric/MetricUpdateEntryProcessor.java @@ -41,6 +41,8 @@ public Long process(Map.Entry entry) { storedHolder.addValue("sourceCount", updatedMetric.getSourceCount()); storedHolder.addValue("nextCount", updatedMetric.getNextCount()); storedHolder.addValue("seekCount", updatedMetric.getSeekCount()); + storedHolder.addValue("evaluatedCount", updatedMetric.getEvaluatedCount()); + storedHolder.addValue("rejectedCount", updatedMetric.getRejectedCount()); storedHolder.addValue("yieldCount", updatedMetric.getYieldCount()); storedHolder.addValue("docSize", updatedMetric.getDocSize()); storedHolder.addValue("docRanges", updatedMetric.getDocRanges()); diff --git a/service/src/main/java/datawave/microservice/querymetric/config/QueryMetricHandlerProperties.java b/service/src/main/java/datawave/microservice/querymetric/config/QueryMetricHandlerProperties.java index 3e4b1e0..3d80814 100644 --- a/service/src/main/java/datawave/microservice/querymetric/config/QueryMetricHandlerProperties.java +++ b/service/src/main/java/datawave/microservice/querymetric/config/QueryMetricHandlerProperties.java @@ -95,6 +95,7 @@ public class QueryMetricHandlerProperties { "END_DATE", "ERROR_CODE", "ERROR_MESSAGE", + "EVALUATED_COUNT", "FI_RANGES", "HOST", "LIFECYCLE", @@ -113,6 +114,7 @@ public class QueryMetricHandlerProperties { "QUERY_LOGIC", "QUERY_NAME", "QUERY_TYPE", + "REJECTED_COUNT", "SEEK_COUNT", "SETUP_TIME", "SOURCE_COUNT", @@ -144,9 +146,11 @@ public class QueryMetricHandlerProperties { "DOC_RANGES", "DOC_SIZE", "ELAPSED_TIME", + "EVALUATED_COUNT", "FI_RANGES", "LOGIN_TIME", "NEXT_COUNT", + "REJECTED_COUNT", "SEEK_COUNT", "SETUP_TIME", "SOURCE_COUNT", diff --git a/service/src/main/java/datawave/microservice/querymetric/handler/ContentQueryMetricsIngestHelper.java b/service/src/main/java/datawave/microservice/querymetric/handler/ContentQueryMetricsIngestHelper.java index e5ad36d..ca19491 100644 --- a/service/src/main/java/datawave/microservice/querymetric/handler/ContentQueryMetricsIngestHelper.java +++ b/service/src/main/java/datawave/microservice/querymetric/handler/ContentQueryMetricsIngestHelper.java @@ -219,6 +219,9 @@ public Multimap getEventFieldsToWrite(T updated, T stored) { if (isChanged(updated.getErrorMessage(), stored == null ? null : stored.getErrorMessage())) { fields.put("ERROR_MESSAGE", updated.getErrorMessage()); } + if (isChanged(updated.getEvaluatedCount(), stored == null ? -1 : stored.getEvaluatedCount())) { + fields.put("EVALUATED_COUNT", Long.toString(updated.getEvaluatedCount())); + } if (isChanged(updated.getFiRanges(), stored == null ? -1 : stored.getFiRanges())) { fields.put("FI_RANGES", Long.toString(updated.getFiRanges())); } @@ -323,6 +326,9 @@ public Multimap getEventFieldsToWrite(T updated, T stored) { fields.put("QUERY_TYPE", updated.getQueryType()); } } + if (isChanged(updated.getRejectedCount(), stored == null ? -1 : stored.getRejectedCount())) { + fields.put("REJECTED_COUNT", Long.toString(updated.getRejectedCount())); + } if (isFirstWrite(updated.getSetupTime(), stored == null ? -1 : stored.getSetupTime(), -1)) { fields.put("SETUP_TIME", Long.toString(updated.getSetupTime())); } @@ -392,6 +398,9 @@ public Multimap getEventFieldsToDelete(T updated, T stored) { if (isChanged(updated.getElapsedTime(), stored.getElapsedTime())) { fields.put("ELAPSED_TIME", Long.toString(stored.getElapsedTime())); } + if (isChanged(updated.getEvaluatedCount(), stored.getEvaluatedCount())) { + fields.put("EVALUATED_COUNT", Long.toString(stored.getEvaluatedCount())); + } if (isChanged(updated.getFiRanges(), stored.getFiRanges())) { fields.put("FI_RANGES", Long.toString(stored.getFiRanges())); } @@ -450,6 +459,9 @@ public Multimap getEventFieldsToDelete(T updated, T stored) { fields.put("PLAN", stored.getPlan()); } } + if (isChanged(updated.getRejectedCount(), stored.getRejectedCount())) { + fields.put("REJECTED_COUNT", Long.toString(stored.getRejectedCount())); + } if (isChanged(updated.getSeekCount(), stored.getSeekCount())) { fields.put("SEEK_COUNT", Long.toString(stored.getSeekCount())); } diff --git a/service/src/main/java/datawave/microservice/querymetric/handler/QueryMetricCombiner.java b/service/src/main/java/datawave/microservice/querymetric/handler/QueryMetricCombiner.java index d015086..34cb7ac 100644 --- a/service/src/main/java/datawave/microservice/querymetric/handler/QueryMetricCombiner.java +++ b/service/src/main/java/datawave/microservice/querymetric/handler/QueryMetricCombiner.java @@ -183,6 +183,8 @@ public T combineMetrics(T updatedQueryMetric, T cachedQueryMetric, QueryMetricTy combinedMetric.setSourceCount(combinedMetric.getSourceCount() + updatedQueryMetric.getSourceCount()); combinedMetric.setNextCount(combinedMetric.getNextCount() + updatedQueryMetric.getNextCount()); combinedMetric.setSeekCount(combinedMetric.getSeekCount() + updatedQueryMetric.getSeekCount()); + combinedMetric.setEvaluatedCount(combinedMetric.getEvaluatedCount() + updatedQueryMetric.getEvaluatedCount()); + combinedMetric.setRejectedCount(combinedMetric.getRejectedCount() + updatedQueryMetric.getRejectedCount()); combinedMetric.setYieldCount(combinedMetric.getYieldCount() + updatedQueryMetric.getYieldCount()); combinedMetric.setDocSize(combinedMetric.getDocSize() + updatedQueryMetric.getDocSize()); combinedMetric.setDocRanges(combinedMetric.getDocRanges() + updatedQueryMetric.getDocRanges()); @@ -191,6 +193,8 @@ public T combineMetrics(T updatedQueryMetric, T cachedQueryMetric, QueryMetricTy combinedMetric.setSourceCount(updatedQueryMetric.getSourceCount()); combinedMetric.setNextCount(updatedQueryMetric.getNextCount()); combinedMetric.setSeekCount(updatedQueryMetric.getSeekCount()); + combinedMetric.setEvaluatedCount(updatedQueryMetric.getEvaluatedCount()); + combinedMetric.setRejectedCount(updatedQueryMetric.getRejectedCount()); combinedMetric.setYieldCount(updatedQueryMetric.getYieldCount()); combinedMetric.setDocSize(updatedQueryMetric.getDocSize()); combinedMetric.setDocRanges(updatedQueryMetric.getDocRanges()); diff --git a/service/src/main/java/datawave/microservice/querymetric/handler/ShardTableQueryMetricHandler.java b/service/src/main/java/datawave/microservice/querymetric/handler/ShardTableQueryMetricHandler.java index e04468d..3eb0f9a 100644 --- a/service/src/main/java/datawave/microservice/querymetric/handler/ShardTableQueryMetricHandler.java +++ b/service/src/main/java/datawave/microservice/querymetric/handler/ShardTableQueryMetricHandler.java @@ -593,6 +593,15 @@ public T toMetric(EventBase event) { m.setErrorCode(fieldValue); } else if (fieldName.equals("ERROR_MESSAGE")) { m.setErrorMessage(fieldValue); + } else if (fieldName.equals("EVALUATED_COUNT")) { + try { + long l = Long.parseLong(fieldValue); + if (l > m.getEvaluatedCount()) { + m.setEvaluatedCount(l); + } + } catch (Exception e) { + log.error(fieldName + ":" + fieldValue + ":" + e.getMessage()); + } } else if (fieldName.equals("FI_RANGES")) { try { long l = Long.parseLong(fieldValue); @@ -701,6 +710,15 @@ public T toMetric(EventBase event) { m.setQueryName(fieldValue); } else if (fieldName.equals("QUERY_TYPE")) { m.setQueryType(fieldValue); + } else if (fieldName.equals("REJECTED_COUNT")) { + try { + long l = Long.parseLong(fieldValue); + if (l > m.getRejectedCount()) { + m.setRejectedCount(l); + } + } catch (Exception e) { + log.error(fieldName + ":" + fieldValue + ":" + e.getMessage()); + } } else if (fieldName.equals("SEEK_COUNT")) { try { long l = Long.parseLong(fieldValue); diff --git a/service/src/main/java/datawave/microservice/querymetric/persistence/AccumuloMapStore.java b/service/src/main/java/datawave/microservice/querymetric/persistence/AccumuloMapStore.java index 0fbd7e5..b8c67bc 100644 --- a/service/src/main/java/datawave/microservice/querymetric/persistence/AccumuloMapStore.java +++ b/service/src/main/java/datawave/microservice/querymetric/persistence/AccumuloMapStore.java @@ -161,6 +161,8 @@ public void store(QueryMetricUpdateHolder queryMetricUpdate) throws Exception updatedMetric.setSourceCount(queryMetricUpdate.getValue("sourceCount")); updatedMetric.setNextCount(queryMetricUpdate.getValue("nextCount")); updatedMetric.setSeekCount(queryMetricUpdate.getValue("seekCount")); + updatedMetric.setEvaluatedCount(queryMetricUpdate.getValue("evaluatedCount")); + updatedMetric.setRejectedCount(queryMetricUpdate.getValue("rejectedCount")); updatedMetric.setYieldCount(queryMetricUpdate.getValue("yieldCount")); updatedMetric.setDocSize(queryMetricUpdate.getValue("docSize")); updatedMetric.setDocRanges(queryMetricUpdate.getValue("docRanges")); @@ -205,6 +207,8 @@ public void store(QueryMetricUpdateHolder queryMetricUpdate) throws Exception queryMetricUpdate.getMetric().setSourceCount(updatedMetric.getSourceCount()); queryMetricUpdate.getMetric().setNextCount(updatedMetric.getNextCount()); queryMetricUpdate.getMetric().setSeekCount(updatedMetric.getSeekCount()); + queryMetricUpdate.getMetric().setEvaluatedCount(updatedMetric.getEvaluatedCount()); + queryMetricUpdate.getMetric().setRejectedCount(updatedMetric.getRejectedCount()); queryMetricUpdate.getMetric().setYieldCount(updatedMetric.getYieldCount()); queryMetricUpdate.getMetric().setDocSize(updatedMetric.getDocSize()); queryMetricUpdate.getMetric().setDocRanges(updatedMetric.getDocRanges());