Skip to content

Commit

Permalink
Merge pull request #26505 from vespa-engine/yngveaasheim/add-descript…
Browse files Browse the repository at this point in the history
…ion-to-units

Add description to units
  • Loading branch information
gjoranv authored Mar 21, 2023
2 parents 33eeb6e + 305e197 commit 76514ea
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public enum SearchNodeMetrics implements VespaMetrics {
CONTENT_PROTON_RESOURCE_USAGE_MEMORY_USAGE_TOTAL("content.proton.resource_usage.memory_usage.total", Unit.FRACTION, "The total relative amount of memory used by this content node (value in the range [0, 1])"),
CONTENT_PROTON_RESOURCE_USAGE_MEMORY_USAGE_TOTAL_UTILIZATION("content.proton.resource_usage.memory_usage.total_utilization", Unit.FRACTION, "The relative amount of memory used compared to the content node memory resource limit"),
CONTENT_PROTON_RESOURCE_USAGE_MEMORY_USAGE_TRANSIENT("content.proton.resource_usage.memory_usage.transient", Unit.FRACTION, "The relative amount of transient memory used by this content node (value in the range [0, 1])"),
CONTENT_PROTON_RESOURCE_USAGE_MEMORY_MAPPINGS("content.proton.resource_usage.memory_mappings", Unit.AREA, "The number of mapped memory areas"),
CONTENT_PROTON_RESOURCE_USAGE_MEMORY_MAPPINGS("content.proton.resource_usage.memory_mappings", Unit.FILE, "The number of memory mapped files"),
CONTENT_PROTON_RESOURCE_USAGE_OPEN_FILE_DESCRIPTORS("content.proton.resource_usage.open_file_descriptors", Unit.FILE, "The number of open files"),
CONTENT_PROTON_RESOURCE_USAGE_FEEDING_BLOCKED("content.proton.resource_usage.feeding_blocked", Unit.BINARY, "Whether feeding is blocked due to resource limits being reached (value is either 0 or 1)"),
CONTENT_PROTON_RESOURCE_USAGE_MALLOC_ARENA("content.proton.resource_usage.malloc_arena", Unit.BYTE, "Size of malloc arena"),
Expand Down
81 changes: 43 additions & 38 deletions container-core/src/main/java/com/yahoo/metrics/Unit.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,54 @@
*/
public enum Unit {

AREA(BaseUnit.AREA),
BINARY(BaseUnit.BINARY),
BUCKET(BaseUnit.BUCKET),
BYTE(BaseUnit.BYTE),
BYTE_PER_SECOND(BaseUnit.BYTE, BaseUnit.SECOND),
CONNECTION(BaseUnit.CONNECTION),
DOCUMENT(BaseUnit.DOCUMENT),
DOCUMENTID(BaseUnit.DOCUMENTID),
FAILURE(BaseUnit.FAILURE),
FILE(BaseUnit.FILE),
FRACTION(BaseUnit.FRACTION),
HIT(BaseUnit.HIT),
HIT_PER_QUERY(BaseUnit.HIT, BaseUnit.QUERY),
INSTANCE(BaseUnit.INSTANCE),
ITEM(BaseUnit.ITEM),
MILLISECOND(BaseUnit.MILLISECOND),
NANOSECOND(BaseUnit.NANOSECOND),
NODE(BaseUnit.NODE),
PACKET(BaseUnit.PACKET),
OPERATION(BaseUnit.OPERATION),
OPERATION_PER_SECOND(BaseUnit.OPERATION, BaseUnit.SECOND),
PERCENTAGE(BaseUnit.PERCENTAGE),
QUERY(BaseUnit.QUERY),
QUERY_PER_SECOND(BaseUnit.QUERY, BaseUnit.SECOND),
RECORD(BaseUnit.RECORD),
REQUEST(BaseUnit.REQUEST),
RESPONSE(BaseUnit.RESPONSE),
RESTART(BaseUnit.RESTART),
SCORE(BaseUnit.SCORE),
SECOND(BaseUnit.SECOND),
SESSION(BaseUnit.SESSION),
TASK(BaseUnit.TASK),
THREAD(BaseUnit.THREAD),
VERSION(BaseUnit.VERSION),
WAKEUP(BaseUnit.WAKEUP);
BINARY(BaseUnit.BINARY, "Zero or one. Zero typically indicate \"false\" while one indicate \"true\""),
BUCKET(BaseUnit.BUCKET, "A chunk of documents managed by a distributor service"),
BYTE(BaseUnit.BYTE, "A collection of 8 bits"),
BYTE_PER_SECOND(BaseUnit.BYTE, BaseUnit.SECOND, "A unit of storage capable of holding 8 bits"),
CONNECTION(BaseUnit.CONNECTION, "A link used for communication between a client and a server"),
DOCUMENT(BaseUnit.DOCUMENT, "Vespa document, a collection of fields defined in a schema file"),
DOCUMENTID(BaseUnit.DOCUMENTID, "A unique document identifier"),
FAILURE(BaseUnit.FAILURE, "Failures, typically for requests, operations or nodes"),
FILE(BaseUnit.FILE, "Data file stored on the disk on a node"),
FRACTION(BaseUnit.FRACTION, "A value in the range [0..1]. Higher values can occur for some metrics, but would indicate the value is outside of the allowed range."),
HIT(BaseUnit.HIT, "Document that meets the filtering/restriction criteria specified by a given query"),
HIT_PER_QUERY(BaseUnit.HIT, BaseUnit.QUERY, "Number of hits per query over a period of time"),
INSTANCE(BaseUnit.INSTANCE, "Typically tenant or application"),
ITEM(BaseUnit.ITEM, "Object or unit maintained in e.g. a queue"),
MILLISECOND(BaseUnit.MILLISECOND, "Millisecond, 1/1000 of a second"),
NANOSECOND(BaseUnit.NANOSECOND, "Nanosecond, 1/1000.000.000 of a second"),
NODE(BaseUnit.NODE, "(Virtual) computer that is part of a Vespa cluster"),
PACKET(BaseUnit.PACKET, "Collection of data transmitted over the network as a single unit"),
OPERATION(BaseUnit.OPERATION, "A clearly defined task"),
OPERATION_PER_SECOND(BaseUnit.OPERATION, BaseUnit.SECOND, "Number of operations per second"),
PERCENTAGE(BaseUnit.PERCENTAGE, "A number expressed as a fraction of 100. Typically in the range [0..100]."),
QUERY(BaseUnit.QUERY, "A request for matching, grouping and/or scoring documents stored in Vespa"),
QUERY_PER_SECOND(BaseUnit.QUERY, BaseUnit.SECOND, "Number of queries per second."),
RECORD(BaseUnit.RECORD, "A collection of information, typically a set of key/value, e.g. stored in a transaction log"),
REQUEST(BaseUnit.REQUEST, "A request sent from a client to a server"),
RESPONSE(BaseUnit.RESPONSE, "A response from a server to a client, typically as a response to a request"),
RESTART(BaseUnit.RESTART, "A service or node restarts"),
SCORE(BaseUnit.SCORE, "Relevance score for a document"),
SECOND(BaseUnit.SECOND, "Time span of 1 second"),
SESSION(BaseUnit.SESSION, "A set of operations taking place during one connection or as part of a higher level operation"),
TASK(BaseUnit.TASK, "Piece of work executed by a server, e.g. to perform back-ground data maintenance"),
THREAD(BaseUnit.THREAD, "Computer thread for executing e.g. tasks, operations or queries"),
VERSION(BaseUnit.VERSION, "Software or config version"),
WAKEUP(BaseUnit.WAKEUP, "Computer thread wake-ups for doing some work");


private final BaseUnit unit;
private final BaseUnit perUnit;
private final String description;

Unit(BaseUnit unit) {
this(unit, null);
Unit(BaseUnit unit, String description) {
this(unit, null, description);
}

Unit(BaseUnit unit, BaseUnit perUnit) {
Unit(BaseUnit unit, BaseUnit perUnit, String description) {
this.unit = unit;
this.perUnit = perUnit;
this.description = description;
}

public String fullName() {
Expand All @@ -66,6 +67,10 @@ public String shortName() {
unit.shortName + "/" + perUnit.shortName;
}

public String getDescription() {
return description;
}

private enum BaseUnit {

AREA("area"),
Expand Down

0 comments on commit 76514ea

Please sign in to comment.