forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support to provide tags with value in Gauge metric
Signed-off-by: Gagan Juneja <[email protected]>
- Loading branch information
Gagan Juneja
committed
Jun 5, 2024
1 parent
39ae32a
commit 472af7f
Showing
10 changed files
with
179 additions
and
0 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
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
53 changes: 53 additions & 0 deletions
53
libs/telemetry/src/main/java/org/opensearch/telemetry/metrics/ObservableMeasurement.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,53 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.telemetry.metrics; | ||
|
||
import org.opensearch.common.annotation.ExperimentalApi; | ||
import org.opensearch.telemetry.metrics.tags.Tags; | ||
|
||
/** | ||
* Observable Measurement for the Asynchronous instruments. | ||
* @opensearch.experimental | ||
*/ | ||
@ExperimentalApi | ||
public class ObservableMeasurement { | ||
private final Double value; | ||
private final Tags tags; | ||
|
||
/** | ||
* Factory method to create the {@link ObservableMeasurement} object. | ||
* @param value value. | ||
* @param tags tags to be added per value. | ||
* @return ObservableMeasurement | ||
*/ | ||
public static ObservableMeasurement create(double value, Tags tags) { | ||
return new ObservableMeasurement(value, tags); | ||
} | ||
|
||
private ObservableMeasurement(double value, Tags tags) { | ||
this.value = value; | ||
this.tags = tags; | ||
} | ||
|
||
/** | ||
* Returns the value. | ||
* @return value | ||
*/ | ||
public Double getValue() { | ||
return value; | ||
} | ||
|
||
/** | ||
* Returns the tags. | ||
* @return tags | ||
*/ | ||
public Tags getTags() { | ||
return tags; | ||
} | ||
} |
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
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
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