Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix breaking API changes introduced during the release window #15980

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions server/src/main/java/org/opensearch/wlm/ResourceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import org.opensearch.common.annotation.PublicApi;
import org.opensearch.core.common.io.stream.StreamOutput;
import org.opensearch.tasks.Task;
import org.opensearch.wlm.tracker.CpuUsageCalculator;
import org.opensearch.wlm.tracker.MemoryUsageCalculator;
import org.opensearch.wlm.tracker.ResourceUsageCalculator;
Expand Down Expand Up @@ -69,6 +70,21 @@
return name;
}

/**
* Gets the resource usage for a given resource type and task.
*
* @param task the task for which to calculate resource usage
* @return the resource usage
*/
@Deprecated(forRemoval = true)
public long getResourceUsage(Task task) {
if (name.equals(CPU.name)) {
return task.getTotalResourceStats().getCpuTimeInNanos();

Check warning on line 82 in server/src/main/java/org/opensearch/wlm/ResourceType.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/wlm/ResourceType.java#L82

Added line #L82 was not covered by tests
} else {
return task.getTotalResourceStats().getMemoryInBytes();

Check warning on line 84 in server/src/main/java/org/opensearch/wlm/ResourceType.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/wlm/ResourceType.java#L84

Added line #L84 was not covered by tests
}
}

public boolean hasStatsEnabled() {
return statsEnabled;
}
Expand Down
Loading