Skip to content

Commit

Permalink
Rename remote store stats field names (#9763) (#9771)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8fdd9b4)

Signed-off-by: Ashish Singh <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
opensearch-trigger-bot[bot] authored Sep 6, 2023
1 parent e247100 commit 60591ea
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ private void buildTranslogUploadStats(XContentBuilder builder) throws IOExceptio
.field(SubFields.SUCCEEDED, remoteTranslogShardStats.totalUploadsSucceeded);
builder.endObject();

builder.startObject(UploadStatsFields.TOTAL_UPLOADS_IN_BYTES);
builder.field(SubFields.STARTED, remoteTranslogShardStats.uploadBytesStarted)
.field(SubFields.FAILED, remoteTranslogShardStats.uploadBytesFailed)
.field(SubFields.SUCCEEDED, remoteTranslogShardStats.uploadBytesSucceeded);
builder.startObject(UploadStatsFields.TOTAL_UPLOAD_SIZE);
builder.field(SubFields.STARTED_BYTES, remoteTranslogShardStats.uploadBytesStarted)
.field(SubFields.FAILED_BYTES, remoteTranslogShardStats.uploadBytesFailed)
.field(SubFields.SUCCEEDED_BYTES, remoteTranslogShardStats.uploadBytesSucceeded);
builder.endObject();

builder.field(UploadStatsFields.TOTAL_UPLOAD_TIME_IN_MILLIS, remoteTranslogShardStats.totalUploadTimeInMillis);
Expand All @@ -146,8 +146,8 @@ private void buildTranslogDownloadStats(XContentBuilder builder) throws IOExcept
builder.field(SubFields.SUCCEEDED, remoteTranslogShardStats.totalDownloadsSucceeded);
builder.endObject();

builder.startObject(DownloadStatsFields.TOTAL_DOWNLOADS_IN_BYTES);
builder.field(SubFields.SUCCEEDED, remoteTranslogShardStats.downloadBytesSucceeded);
builder.startObject(DownloadStatsFields.TOTAL_DOWNLOAD_SIZE);
builder.field(SubFields.SUCCEEDED_BYTES, remoteTranslogShardStats.downloadBytesSucceeded);
builder.endObject();

builder.field(DownloadStatsFields.TOTAL_DOWNLOAD_TIME_IN_MILLIS, remoteTranslogShardStats.totalDownloadTimeInMillis);
Expand All @@ -173,15 +173,15 @@ private void buildSegmentUploadStats(XContentBuilder builder) throws IOException
.field(UploadStatsFields.BYTES_LAG, remoteSegmentShardStats.bytesLag)
.field(UploadStatsFields.BACKPRESSURE_REJECTION_COUNT, remoteSegmentShardStats.rejectionCount)
.field(UploadStatsFields.CONSECUTIVE_FAILURE_COUNT, remoteSegmentShardStats.consecutiveFailuresCount);
builder.startObject(UploadStatsFields.TOTAL_SYNCS_TO_REMOTE)
builder.startObject(UploadStatsFields.TOTAL_UPLOADS)
.field(SubFields.STARTED, remoteSegmentShardStats.totalUploadsStarted)
.field(SubFields.SUCCEEDED, remoteSegmentShardStats.totalUploadsSucceeded)
.field(SubFields.FAILED, remoteSegmentShardStats.totalUploadsFailed);
builder.endObject();
builder.startObject(UploadStatsFields.TOTAL_UPLOADS_IN_BYTES)
.field(SubFields.STARTED, remoteSegmentShardStats.uploadBytesStarted)
.field(SubFields.SUCCEEDED, remoteSegmentShardStats.uploadBytesSucceeded)
.field(SubFields.FAILED, remoteSegmentShardStats.uploadBytesFailed);
builder.startObject(UploadStatsFields.TOTAL_UPLOAD_SIZE)
.field(SubFields.STARTED_BYTES, remoteSegmentShardStats.uploadBytesStarted)
.field(SubFields.SUCCEEDED_BYTES, remoteSegmentShardStats.uploadBytesSucceeded)
.field(SubFields.FAILED_BYTES, remoteSegmentShardStats.uploadBytesFailed);
builder.endObject();
builder.startObject(UploadStatsFields.REMOTE_REFRESH_SIZE_IN_BYTES)
.field(SubFields.LAST_SUCCESSFUL, remoteSegmentShardStats.lastSuccessfulRemoteRefreshBytes)
Expand All @@ -200,10 +200,10 @@ private void buildSegmentDownloadStats(XContentBuilder builder) throws IOExcepti
DownloadStatsFields.LAST_SYNC_TIMESTAMP,
remoteSegmentShardStats.directoryFileTransferTrackerStats.lastTransferTimestampMs
);
builder.startObject(DownloadStatsFields.TOTAL_DOWNLOADS_IN_BYTES)
.field(SubFields.STARTED, remoteSegmentShardStats.directoryFileTransferTrackerStats.transferredBytesStarted)
.field(SubFields.SUCCEEDED, remoteSegmentShardStats.directoryFileTransferTrackerStats.transferredBytesSucceeded)
.field(SubFields.FAILED, remoteSegmentShardStats.directoryFileTransferTrackerStats.transferredBytesFailed);
builder.startObject(DownloadStatsFields.TOTAL_DOWNLOAD_SIZE)
.field(SubFields.STARTED_BYTES, remoteSegmentShardStats.directoryFileTransferTrackerStats.transferredBytesStarted)
.field(SubFields.SUCCEEDED_BYTES, remoteSegmentShardStats.directoryFileTransferTrackerStats.transferredBytesSucceeded)
.field(SubFields.FAILED_BYTES, remoteSegmentShardStats.directoryFileTransferTrackerStats.transferredBytesFailed);
builder.endObject();
builder.startObject(DownloadStatsFields.DOWNLOAD_SIZE_IN_BYTES)
.field(SubFields.LAST_SUCCESSFUL, remoteSegmentShardStats.directoryFileTransferTrackerStats.lastSuccessfulTransferInBytes)
Expand Down Expand Up @@ -276,11 +276,6 @@ static final class UploadStatsFields {
*/
static final String CONSECUTIVE_FAILURE_COUNT = "consecutive_failure_count";

/**
* Represents the number of remote refreshes
*/
static final String TOTAL_SYNCS_TO_REMOTE = "total_syncs_to_remote";

/**
* Represents the size of new data to be uploaded as part of a refresh
*/
Expand All @@ -304,7 +299,7 @@ static final class UploadStatsFields {
/**
* Represents the total uploads to remote store in bytes
*/
static final String TOTAL_UPLOADS_IN_BYTES = "total_uploads_in_bytes";
static final String TOTAL_UPLOAD_SIZE = "total_upload_size";

/**
* Total time spent on remote store uploads
Expand Down Expand Up @@ -351,7 +346,7 @@ static final class DownloadStatsFields {
/**
* Total bytes of files downloaded from the remote store
*/
static final String TOTAL_DOWNLOADS_IN_BYTES = "total_downloads_in_bytes";
static final String TOTAL_DOWNLOAD_SIZE = "total_download_size";

/**
* Average size of a file downloaded from the remote store
Expand All @@ -377,6 +372,10 @@ static final class SubFields {
static final String SUCCEEDED = "succeeded";
static final String FAILED = "failed";

static final String STARTED_BYTES = "started_bytes";
static final String SUCCEEDED_BYTES = "succeeded_bytes";
static final String FAILED_BYTES = "failed_bytes";

static final String DOWNLOAD = "download";
static final String UPLOAD = "upload";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
}

private void buildUploadStats(XContentBuilder builder) throws IOException {
builder.startObject(Fields.TOTAL_UPLOADS);
builder.startObject(Fields.TOTAL_UPLOAD_SIZE);
builder.humanReadableField(Fields.STARTED_BYTES, Fields.STARTED, new ByteSizeValue(uploadBytesStarted));
builder.humanReadableField(Fields.SUCCEEDED_BYTES, Fields.SUCCEEDED, new ByteSizeValue(uploadBytesSucceeded));
builder.humanReadableField(Fields.FAILED_BYTES, Fields.FAILED, new ByteSizeValue(uploadBytesFailed));
Expand All @@ -270,7 +270,7 @@ private void buildUploadStats(XContentBuilder builder) throws IOException {
}

private void buildDownloadStats(XContentBuilder builder) throws IOException {
builder.startObject(Fields.TOTAL_DOWNLOADS);
builder.startObject(Fields.TOTAL_DOWNLOAD_SIZE);
builder.humanReadableField(Fields.STARTED_BYTES, Fields.STARTED, new ByteSizeValue(downloadBytesStarted));
builder.humanReadableField(Fields.SUCCEEDED_BYTES, Fields.SUCCEEDED, new ByteSizeValue(downloadBytesSucceeded));
builder.humanReadableField(Fields.FAILED_BYTES, Fields.FAILED, new ByteSizeValue(downloadBytesFailed));
Expand All @@ -282,8 +282,8 @@ static final class Fields {
static final String REMOTE_STORE = "remote_store";
static final String UPLOAD = "upload";
static final String DOWNLOAD = "download";
static final String TOTAL_UPLOADS = "total_uploads";
static final String TOTAL_DOWNLOADS = "total_downloads";
static final String TOTAL_UPLOAD_SIZE = "total_upload_size";
static final String TOTAL_DOWNLOAD_SIZE = "total_download_size";
static final String MAX_REFRESH_TIME_LAG = "max_refresh_time_lag";
static final String MAX_REFRESH_TIME_LAG_IN_MILLIS = "max_refresh_time_lag_in_millis";
static final String REFRESH_SIZE_LAG = "refresh_size_lag";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,20 @@ static void compareStatsResponse(
(int) segmentTransferStats.directoryFileTransferTrackerStats.lastTransferTimestampMs
);
assertEquals(
((Map) segmentDownloads.get(RemoteStoreStats.DownloadStatsFields.TOTAL_DOWNLOADS_IN_BYTES)).get(
RemoteStoreStats.SubFields.STARTED
((Map) segmentDownloads.get(RemoteStoreStats.DownloadStatsFields.TOTAL_DOWNLOAD_SIZE)).get(
RemoteStoreStats.SubFields.STARTED_BYTES
),
(int) segmentTransferStats.directoryFileTransferTrackerStats.transferredBytesStarted
);
assertEquals(
((Map) segmentDownloads.get(RemoteStoreStats.DownloadStatsFields.TOTAL_DOWNLOADS_IN_BYTES)).get(
RemoteStoreStats.SubFields.SUCCEEDED
((Map) segmentDownloads.get(RemoteStoreStats.DownloadStatsFields.TOTAL_DOWNLOAD_SIZE)).get(
RemoteStoreStats.SubFields.SUCCEEDED_BYTES
),
(int) segmentTransferStats.directoryFileTransferTrackerStats.transferredBytesSucceeded
);
assertEquals(
((Map) segmentDownloads.get(RemoteStoreStats.DownloadStatsFields.TOTAL_DOWNLOADS_IN_BYTES)).get(
RemoteStoreStats.SubFields.FAILED
((Map) segmentDownloads.get(RemoteStoreStats.DownloadStatsFields.TOTAL_DOWNLOAD_SIZE)).get(
RemoteStoreStats.SubFields.FAILED_BYTES
),
(int) segmentTransferStats.directoryFileTransferTrackerStats.transferredBytesFailed
);
Expand Down Expand Up @@ -222,20 +222,20 @@ static void compareStatsResponse(
(int) segmentTransferStats.consecutiveFailuresCount
);
assertEquals(
((Map) segmentUploads.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOADS_IN_BYTES)).get(
RemoteStoreStats.SubFields.STARTED
((Map) segmentUploads.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOAD_SIZE)).get(
RemoteStoreStats.SubFields.STARTED_BYTES
),
(int) segmentTransferStats.uploadBytesStarted
);
assertEquals(
((Map) segmentUploads.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOADS_IN_BYTES)).get(
RemoteStoreStats.SubFields.SUCCEEDED
((Map) segmentUploads.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOAD_SIZE)).get(
RemoteStoreStats.SubFields.SUCCEEDED_BYTES
),
(int) segmentTransferStats.uploadBytesSucceeded
);
assertEquals(
((Map) segmentUploads.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOADS_IN_BYTES)).get(
RemoteStoreStats.SubFields.FAILED
((Map) segmentUploads.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOAD_SIZE)).get(
RemoteStoreStats.SubFields.FAILED_BYTES
),
(int) segmentTransferStats.uploadBytesFailed
);
Expand All @@ -258,19 +258,15 @@ static void compareStatsResponse(
segmentTransferStats.uploadBytesPerSecMovingAverage
);
assertEquals(
((Map) segmentUploads.get(RemoteStoreStats.UploadStatsFields.TOTAL_SYNCS_TO_REMOTE)).get(
RemoteStoreStats.SubFields.STARTED
),
((Map) segmentUploads.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOADS)).get(RemoteStoreStats.SubFields.STARTED),
(int) segmentTransferStats.totalUploadsStarted
);
assertEquals(
((Map) segmentUploads.get(RemoteStoreStats.UploadStatsFields.TOTAL_SYNCS_TO_REMOTE)).get(
RemoteStoreStats.SubFields.SUCCEEDED
),
((Map) segmentUploads.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOADS)).get(RemoteStoreStats.SubFields.SUCCEEDED),
(int) segmentTransferStats.totalUploadsSucceeded
);
assertEquals(
((Map) segmentUploads.get(RemoteStoreStats.UploadStatsFields.TOTAL_SYNCS_TO_REMOTE)).get(RemoteStoreStats.SubFields.FAILED),
((Map) segmentUploads.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOADS)).get(RemoteStoreStats.SubFields.FAILED),
(int) segmentTransferStats.totalUploadsFailed
);
assertEquals(
Expand Down Expand Up @@ -320,24 +316,24 @@ static void compareStatsResponse(
assertEquals(
translogTransferStats.uploadBytesStarted,
Long.parseLong(
((Map<?, ?>) tlogUploadStatsObj.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOADS_IN_BYTES)).get(
RemoteStoreStats.SubFields.STARTED
((Map<?, ?>) tlogUploadStatsObj.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOAD_SIZE)).get(
RemoteStoreStats.SubFields.STARTED_BYTES
).toString()
)
);
assertEquals(
translogTransferStats.uploadBytesSucceeded,
Long.parseLong(
((Map<?, ?>) tlogUploadStatsObj.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOADS_IN_BYTES)).get(
RemoteStoreStats.SubFields.SUCCEEDED
((Map<?, ?>) tlogUploadStatsObj.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOAD_SIZE)).get(
RemoteStoreStats.SubFields.SUCCEEDED_BYTES
).toString()
)
);
assertEquals(
translogTransferStats.uploadBytesFailed,
Long.parseLong(
((Map<?, ?>) tlogUploadStatsObj.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOADS_IN_BYTES)).get(
RemoteStoreStats.SubFields.FAILED
((Map<?, ?>) tlogUploadStatsObj.get(RemoteStoreStats.UploadStatsFields.TOTAL_UPLOAD_SIZE)).get(
RemoteStoreStats.SubFields.FAILED_BYTES
).toString()
)
);
Expand Down Expand Up @@ -386,8 +382,8 @@ static void compareStatsResponse(
assertEquals(
translogTransferStats.downloadBytesSucceeded,
Long.parseLong(
((Map<?, ?>) tlogDownloadStatsObj.get(RemoteStoreStats.DownloadStatsFields.TOTAL_DOWNLOADS_IN_BYTES)).get(
RemoteStoreStats.SubFields.SUCCEEDED
((Map<?, ?>) tlogDownloadStatsObj.get(RemoteStoreStats.DownloadStatsFields.TOTAL_DOWNLOAD_SIZE)).get(
RemoteStoreStats.SubFields.SUCCEEDED_BYTES
).toString()
)
);
Expand Down Expand Up @@ -415,7 +411,7 @@ static void compareStatsResponse(
)
);
} else {
assertNull(tlogDownloadStatsObj.get(RemoteStoreStats.DownloadStatsFields.TOTAL_DOWNLOADS_IN_BYTES));
assertNull(tlogDownloadStatsObj.get(RemoteStoreStats.DownloadStatsFields.TOTAL_DOWNLOAD_SIZE));
}
}
}

0 comments on commit 60591ea

Please sign in to comment.