Skip to content

Commit

Permalink
Pass testStatsObjectCreationViaStream
Browse files Browse the repository at this point in the history
Signed-off-by: Bhumika Saini <[email protected]>
  • Loading branch information
Bhumika Saini committed Aug 14, 2023
1 parent 9adab8b commit 4e8f6e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions server/src/main/java/org/opensearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.opensearch.index.IndexModule;
import org.opensearch.index.IndexingPressureService;
import org.opensearch.index.recovery.RemoteStoreRestoreService;
import org.opensearch.index.remote.RemoteStorePressureService;
import org.opensearch.index.store.remote.filecache.FileCache;
import org.opensearch.index.store.remote.filecache.FileCacheCleaner;
import org.opensearch.index.store.remote.filecache.FileCacheFactory;
Expand Down Expand Up @@ -260,6 +261,7 @@
import java.util.stream.Stream;

import static java.util.stream.Collectors.toList;
import static org.opensearch.common.util.FeatureFlags.REMOTE_STORE;
import static org.opensearch.common.util.FeatureFlags.TELEMETRY;
import static org.opensearch.env.NodeEnvironment.collectFileCacheDataPath;
import static org.opensearch.index.ShardIndexingPressureSettings.SHARD_INDEXING_PRESSURE_ENABLED_ATTRIBUTE_KEY;
Expand Down Expand Up @@ -1266,6 +1268,12 @@ public Node start() throws NodeValidationException {
nodeService.getSearchBackpressureService().start();
nodeService.getTaskCancellationMonitoringService().start();

if (FeatureFlags.isEnabled(REMOTE_STORE)) {
IndicesService indicesService = injector.getInstance(IndicesService.class);
RemoteStorePressureService pressureService = injector.getInstance(RemoteStorePressureService.class);
indicesService.setPressureService(pressureService);
}

final ClusterService clusterService = injector.getInstance(ClusterService.class);

final NodeConnectionsService nodeConnectionsService = injector.getInstance(NodeConnectionsService.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,16 @@ private void populateUploadBytesStarted() {

private void populateDummyStats() {
int startedBytesUpload = randomIntBetween(10, 100);
int startedUploads = randomIntBetween(6, 10);

tracker.addUploadBytesStarted(startedBytesUpload);
tracker.addUploadBytesFailed(randomIntBetween(1, startedBytesUpload / 2));
tracker.addUploadBytesSucceeded(randomIntBetween(1, startedBytesUpload / 2));
tracker.addUploadTimeInMillis(randomIntBetween(10, 100));
tracker.setLastSuccessfulUploadTimestamp(System.currentTimeMillis() + randomIntBetween(10, 100));
tracker.addUploadsStarted(randomIntBetween(6, 10));
tracker.addUploadsFailed(randomIntBetween(1, 5));
tracker.addUploadsSucceeded(randomIntBetween(1, 5));
tracker.addUploadsFailed(randomIntBetween(1, startedUploads / 2));
tracker.addUploadsSucceeded(randomIntBetween(1, startedUploads / 2));

tracker.addDownloadBytesSucceeded(randomIntBetween(10, 100));
tracker.addDownloadTimeInMillis(randomIntBetween(10, 100));
Expand Down

0 comments on commit 4e8f6e8

Please sign in to comment.