#2293 - Metric hash back to MD5 of sql + name + loc (minus location file and line source) ~= Revert of #2288

This commit is contained in:
rbygrave
2021-08-09 14:05:10 +12:00
parent c4484c758e
commit c610f95b2d
27 changed files with 172 additions and 201 deletions
@@ -45,14 +45,6 @@ public interface ProfileLocation {
*/
String label();
/**
* Return a hash of the location that intentionally excludes the line number.
* <p>
* The hash is expected to be stable regardless of line number in the source file
* so that is identifies the class and method location over a long time.
*/
long hash();
/**
* Return the full location.
*/
@@ -45,15 +45,8 @@ public interface MetaQueryMetric extends MetaTimedMetric {
}
/**
* Return the hash of the sql.
* Return the hash of the plan.
*/
long sqlHash();
String hash();
/**
* Migrate to sqlHash().
*/
@Deprecated
default long getSqlHash() {
return sqlHash();
}
}
@@ -30,7 +30,7 @@ public interface MetaQueryPlan {
/**
* Return the hash of the plan.
*/
long sqlHash();
String hash();
/**
* Return a description of the bind values.
@@ -6,14 +6,6 @@ package io.ebean.meta;
*/
public interface MetaTimedMetric extends MetaMetric {
/**
* Return the metric location hash if defined.
* <p>
* This hash excludes line number with the intention of being stable over time
* as code changes move the source line (but the method is the same).
*/
long locationHash();
/**
* Return the metric location if defined.
*/
@@ -6,7 +6,7 @@ package io.ebean.meta;
public class MetricData {
private String name;
private long sqlHash;
private String hash;
private String loc;
private String sql;
@@ -14,7 +14,6 @@ public class MetricData {
private Long mean;
private Long max;
private Long total;
private long locHash;
public MetricData(String name) {
this.name = name;
@@ -31,20 +30,12 @@ public class MetricData {
this.name = name;
}
public long getSqlHash() {
return sqlHash;
public String getHash() {
return hash;
}
public void setSqlHash(long sqlHash) {
this.sqlHash = sqlHash;
}
public void setLocHash(long locHash) {
this.locHash = locHash;
}
public long getLocHash() {
return locHash;
public void setHash(String hash) {
this.hash = hash;
}
public String getLoc() {
@@ -10,7 +10,7 @@ public class QueryPlanInit {
private boolean all;
private Set<Long> hashes = new HashSet<>();
private Set<String> hashes = new HashSet<>();
private long thresholdMicros;
@@ -47,21 +47,21 @@ public class QueryPlanInit {
/**
* Return true if the query plan should be initiated based on it's hash.
*/
public boolean includeHash(long sqlHash) {
return all || hashes.contains(sqlHash);
public boolean includeHash(String hash) {
return all || hashes.contains(hash);
}
/**
* Return the specific hashes that we want to collect query plans on.
*/
public Set<Long> sqlHashes() {
public Set<String> hashes() {
return hashes;
}
/**
* Set the specific hashes that we want to collect query plans on.
*/
public void sqlHashes(Set<Long> hashes) {
public void hashes(Set<String> hashes) {
this.hashes = hashes;
}
}
@@ -12,11 +12,6 @@ public interface TimedMetricStats extends MetaTimedMetric {
*/
void setLocation(String location);
/**
* Additionally set the location hash.
*/
void setLocationHash(long locationHash);
/**
* Override the name based on profile location.
*/