Skip to content

Commit 720ea81

Browse files
committed
Rename stat type fields
Signed-off-by: Andy Qin <[email protected]>
1 parent 7b532a5 commit 720ea81

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

src/main/java/org/opensearch/neuralsearch/stats/events/EventStatName.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
@Getter
2020
public enum EventStatName implements StatName {
21-
TEXT_EMBEDDING_PROCESSOR_EXECUTIONS("text_embedding_executions", "processors.ingest", EventStatType.TIMESTAMPED_COUNTER);
21+
TEXT_EMBEDDING_PROCESSOR_EXECUTIONS("text_embedding_executions", "processors.ingest", EventStatType.TIMESTAMPED_EVENT_COUNTER);
2222

2323
private final String nameString;
2424
private final String path;
@@ -43,7 +43,7 @@ public enum EventStatName implements StatName {
4343
this.statType = statType;
4444

4545
switch (statType) {
46-
case EventStatType.TIMESTAMPED_COUNTER:
46+
case EventStatType.TIMESTAMPED_EVENT_COUNTER:
4747
eventStat = new TimestampedEventStat(this);
4848
break;
4949
}

src/main/java/org/opensearch/neuralsearch/stats/events/EventStatType.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Enum for different kinds of event stat types to track
1313
*/
1414
public enum EventStatType implements StatType {
15-
TIMESTAMPED_COUNTER;
15+
TIMESTAMPED_EVENT_COUNTER;
1616

1717
/**
1818
* Gets the name of the stat type, the enum name in lowercase

src/main/java/org/opensearch/neuralsearch/stats/events/EventStatsManager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public Map<EventStatName, TimestampedEventStatSnapshot> getTimestampedEventStatS
7272
// Filter stats based on passed in collection
7373
Map<EventStatName, TimestampedEventStatSnapshot> eventStatsDataMap = new HashMap<>();
7474
for (EventStatName statName : statsToRetrieve) {
75-
if (statName.getStatType() == EventStatType.TIMESTAMPED_COUNTER) {
75+
if (statName.getStatType() == EventStatType.TIMESTAMPED_EVENT_COUNTER) {
7676
StatSnapshot<?> snapshot = statName.getEventStat().getStatSnapshot();
7777
if (snapshot instanceof TimestampedEventStatSnapshot) {
7878
// Get event data snapshot

src/main/java/org/opensearch/neuralsearch/stats/info/InfoStatName.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
@Getter
2020
public enum InfoStatName implements StatName {
2121
// Cluster info
22-
CLUSTER_VERSION("cluster_version", "", InfoStatType.SETTABLE_STRING),
23-
TEXT_EMBEDDING_PROCESSORS("text_embedding_processors_in_pipelines", "processors.ingest", InfoStatType.INFO_COUNTABLE);
22+
CLUSTER_VERSION("cluster_version", "", InfoStatType.INFO_STRING),
23+
TEXT_EMBEDDING_PROCESSORS("text_embedding_processors_in_pipelines", "processors.ingest", InfoStatType.INFO_COUNTER);
2424

2525
private final String nameString;
2626
private final String path;

src/main/java/org/opensearch/neuralsearch/stats/info/InfoStatType.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
* Enum for different kinds of info stat types to track
1313
*/
1414
public enum InfoStatType implements StatType {
15-
INFO_COUNTABLE,
16-
SETTABLE_STRING,
17-
SETTABLE_BOOLEAN;
15+
INFO_COUNTER,
16+
INFO_STRING,
17+
INFO_BOOLEAN;
1818

1919
/**
2020
* Gets the name of the stat type, the enum name in lowercase

src/main/java/org/opensearch/neuralsearch/stats/info/InfoStatsManager.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private Map<InfoStatName, CountableInfoStatSnapshot> getCountableStats() {
7272
// Initialize empty map with keys so stat names are visible in JSON even if the value is not counted
7373
Map<InfoStatName, CountableInfoStatSnapshot> countableInfoStats = new HashMap<>();
7474
for (InfoStatName stat : EnumSet.allOf(InfoStatName.class)) {
75-
if (stat.getStatType() == InfoStatType.INFO_COUNTABLE) {
75+
if (stat.getStatType() == InfoStatType.INFO_COUNTER) {
7676
countableInfoStats.put(stat, new CountableInfoStatSnapshot(stat));
7777
}
7878
}
@@ -92,8 +92,8 @@ private Map<InfoStatName, SettableInfoStatSnapshot<?>> getSettableStats() {
9292
Map<InfoStatName, SettableInfoStatSnapshot<?>> settableInfoStats = new HashMap<>();
9393
for (InfoStatName statName : EnumSet.allOf(InfoStatName.class)) {
9494
switch (statName.getStatType()) {
95-
case InfoStatType.SETTABLE_BOOLEAN -> settableInfoStats.put(statName, new SettableInfoStatSnapshot<Boolean>(statName));
96-
case InfoStatType.SETTABLE_STRING -> settableInfoStats.put(statName, new SettableInfoStatSnapshot<String>(statName));
95+
case InfoStatType.INFO_BOOLEAN -> settableInfoStats.put(statName, new SettableInfoStatSnapshot<Boolean>(statName));
96+
case InfoStatType.INFO_STRING -> settableInfoStats.put(statName, new SettableInfoStatSnapshot<String>(statName));
9797
}
9898
}
9999

src/test/java/org/opensearch/neuralsearch/rest/RestNeuralStatsActionIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void test_includeMetadata() throws Exception {
138138
String valueWithMetadata = ((Map<String, String>) clusterVersionStatMetadata).get(StatSnapshot.VALUE_FIELD);
139139

140140
// Stat type metadata should match
141-
assertEquals(InfoStatType.SETTABLE_STRING.getTypeString(), statType);
141+
assertEquals(InfoStatType.INFO_STRING.getTypeString(), statType);
142142

143143
// Fetch Without metadata
144144
params.put(RestNeuralStatsAction.INCLUDE_METADATA_PARAM, "false");

0 commit comments

Comments
 (0)