diff options
author | Bjørn Christian Seime <bjorn.christian@seime.no> | 2021-01-11 15:48:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-11 15:48:54 +0100 |
commit | 6cbd2302b3ad1a45241e957559fd6f60e5c0bfb2 (patch) | |
tree | 17607e9e4beb7ca95a5ac2ceb69e82166d353487 /jdisc_http_service/src/main/java/com/yahoo/container/logging/Coverage.java | |
parent | 2587074c8498d76ed55a93f1935653d2a0bdb1e0 (diff) |
Revert "Merge container-accesslogging into jdisc_http_service"
Diffstat (limited to 'jdisc_http_service/src/main/java/com/yahoo/container/logging/Coverage.java')
-rw-r--r-- | jdisc_http_service/src/main/java/com/yahoo/container/logging/Coverage.java | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/jdisc_http_service/src/main/java/com/yahoo/container/logging/Coverage.java b/jdisc_http_service/src/main/java/com/yahoo/container/logging/Coverage.java deleted file mode 100644 index 9d122b90641..00000000000 --- a/jdisc_http_service/src/main/java/com/yahoo/container/logging/Coverage.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.container.logging; - -/** - * Carry information about how the query covered the document corpus. - */ -public class Coverage { - private final long docs; - private final long active; - private final long soonActive; - private final int degradedReason; - private final static int DEGRADED_BY_MATCH_PHASE = 1; - private final static int DEGRADED_BY_TIMEOUT = 2; - private final static int DEGRADED_BY_ADAPTIVE_TIMEOUT = 4; - public Coverage(long docs, long active, long soonActive, int degradedReason) { - this.docs = docs; - this.active = active; - this.soonActive = soonActive; - this.degradedReason = degradedReason; - } - - public long getDocs() { - return docs; - } - - public long getActive() { - return active; - } - - public static int toDegradation(boolean degradeByMatchPhase, boolean degradedByTimeout, boolean degradedByAdaptiveTimeout) { - int v = 0; - if (degradeByMatchPhase) { - v |= DEGRADED_BY_MATCH_PHASE; - } - if (degradedByTimeout) { - v |= DEGRADED_BY_TIMEOUT; - } - if (degradedByAdaptiveTimeout) { - v |= DEGRADED_BY_ADAPTIVE_TIMEOUT; - } - return v; - } - - public long getSoonActive() { return soonActive; } - - public boolean isDegraded() { return (degradedReason != 0) || isDegradedByNonIdealState(); } - public boolean isDegradedByMatchPhase() { return (degradedReason & DEGRADED_BY_MATCH_PHASE) != 0; } - public boolean isDegradedByTimeout() { return (degradedReason & DEGRADED_BY_TIMEOUT) != 0; } - public boolean isDegradedByAdapativeTimeout() { return (degradedReason & DEGRADED_BY_ADAPTIVE_TIMEOUT) != 0; } - public boolean isDegradedByNonIdealState() { return (degradedReason == 0) && (getResultPercentage() != 100);} - - /** - * An int between 0 (inclusive) and 100 (inclusive) representing how many - * percent coverage the result sets this Coverage instance contains information - * about had. - */ - public int getResultPercentage() { - if (docs < active) { - return (int) Math.round(docs * 100.0d / active); - } - return 100; - } - -} |