-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement logic for storing fields that are neither dimensions nor me…
…trics (aka tags) (#87929) For label fields (fields that are not dimensions nor metrics) we just propagate the latest value into the rollup index, the same that we do for a counter metric.
- Loading branch information
1 parent
71d5ad6
commit 504b30c
Showing
13 changed files
with
1,018 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...n/rollup/src/main/java/org/elasticsearch/xpack/rollup/v2/AbstractRollupFieldProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.rollup.v2; | ||
|
||
/** | ||
* Base class for classes that read metric and label fields. | ||
*/ | ||
abstract class AbstractRollupFieldProducer<T> { | ||
|
||
protected final String name; | ||
protected boolean isEmpty; | ||
|
||
AbstractRollupFieldProducer(String name) { | ||
this.name = name; | ||
this.isEmpty = true; | ||
} | ||
|
||
/** | ||
* Collect a value for the field applying the specific subclass collection strategy. | ||
* @param value the value to collect. | ||
*/ | ||
public abstract void collect(T value); | ||
|
||
/** | ||
* @return the name of the field. | ||
*/ | ||
public String name() { | ||
return name; | ||
} | ||
|
||
/** | ||
* @return the value of the field. | ||
*/ | ||
public abstract Object value(); | ||
|
||
/** | ||
* Resets the collected value to the specific subclass reset value. | ||
*/ | ||
public abstract void reset(); | ||
|
||
/** | ||
* @return true if the field has not collected any value. | ||
*/ | ||
public boolean isEmpty() { | ||
return isEmpty; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.