2021-09-03 22:10:15 +08:00
|
|
|
/*
|
|
|
|
* BlobWorkerCommon.h
|
|
|
|
*
|
|
|
|
* This source file is part of the FoundationDB open source project
|
|
|
|
*
|
2022-03-22 04:36:23 +08:00
|
|
|
* Copyright 2013-2022 Apple Inc. and the FoundationDB project authors
|
2021-09-03 22:10:15 +08:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FDBCLIENT_BLOBWORKERCOMMON_H
|
|
|
|
#define FDBCLIENT_BLOBWORKERCOMMON_H
|
|
|
|
|
|
|
|
#include "fdbrpc/Stats.h"
|
|
|
|
|
|
|
|
struct BlobWorkerStats {
|
|
|
|
CounterCollection cc;
|
|
|
|
Counter s3PutReqs, s3GetReqs, s3DeleteReqs;
|
|
|
|
Counter deltaFilesWritten, snapshotFilesWritten;
|
|
|
|
Counter deltaBytesWritten, snapshotBytesWritten;
|
|
|
|
Counter bytesReadFromFDBForInitialSnapshot;
|
|
|
|
Counter bytesReadFromS3ForCompaction;
|
2021-09-03 22:10:15 +08:00
|
|
|
Counter rangeAssignmentRequests, readRequests;
|
2021-09-03 22:10:15 +08:00
|
|
|
Counter wrongShardServer;
|
2021-09-03 22:10:15 +08:00
|
|
|
Counter changeFeedInputBytes;
|
|
|
|
Counter readReqTotalFilesReturned;
|
2021-09-03 22:10:15 +08:00
|
|
|
Counter readReqDeltaBytesReturned;
|
2021-09-23 01:46:20 +08:00
|
|
|
Counter commitVersionChecks;
|
|
|
|
Counter granuleUpdateErrors;
|
2022-02-10 05:35:49 +08:00
|
|
|
Counter granuleRequestTimeouts;
|
2021-09-03 22:10:15 +08:00
|
|
|
|
|
|
|
int numRangesAssigned;
|
|
|
|
int mutationBytesBuffered;
|
2021-09-14 23:19:15 +08:00
|
|
|
int activeReadRequests;
|
2021-09-03 22:10:15 +08:00
|
|
|
|
|
|
|
Future<Void> logger;
|
|
|
|
|
|
|
|
// Current stats maintained for a given blob worker process
|
|
|
|
explicit BlobWorkerStats(UID id, double interval)
|
|
|
|
: cc("BlobWorkerStats", id.toString()),
|
|
|
|
|
2021-09-14 23:19:15 +08:00
|
|
|
s3PutReqs("S3PutReqs", cc), s3GetReqs("S3GetReqs", cc), s3DeleteReqs("S3DeleteReqs", cc),
|
|
|
|
deltaFilesWritten("DeltaFilesWritten", cc), snapshotFilesWritten("SnapshotFilesWritten", cc),
|
|
|
|
deltaBytesWritten("DeltaBytesWritten", cc), snapshotBytesWritten("SnapshotBytesWritten", cc),
|
|
|
|
bytesReadFromFDBForInitialSnapshot("BytesReadFromFDBForInitialSnapshot", cc),
|
|
|
|
bytesReadFromS3ForCompaction("BytesReadFromS3ForCompaction", cc),
|
|
|
|
rangeAssignmentRequests("RangeAssignmentRequests", cc), readRequests("ReadRequests", cc),
|
|
|
|
wrongShardServer("WrongShardServer", cc), changeFeedInputBytes("RangeFeedInputBytes", cc),
|
|
|
|
readReqTotalFilesReturned("ReadReqTotalFilesReturned", cc),
|
2021-09-23 01:46:20 +08:00
|
|
|
readReqDeltaBytesReturned("ReadReqDeltaBytesReturned", cc), commitVersionChecks("CommitVersionChecks", cc),
|
2022-02-10 05:35:49 +08:00
|
|
|
granuleUpdateErrors("GranuleUpdateErrors", cc), granuleRequestTimeouts("GranuleRequestTimeouts", cc),
|
2022-03-03 08:10:37 +08:00
|
|
|
numRangesAssigned(0), mutationBytesBuffered(0), activeReadRequests(0) {
|
2021-09-03 22:10:15 +08:00
|
|
|
specialCounter(cc, "NumRangesAssigned", [this]() { return this->numRangesAssigned; });
|
|
|
|
specialCounter(cc, "MutationBytesBuffered", [this]() { return this->mutationBytesBuffered; });
|
2021-09-14 23:19:15 +08:00
|
|
|
specialCounter(cc, "ActiveReadRequests", [this]() { return this->activeReadRequests; });
|
2021-09-03 22:10:15 +08:00
|
|
|
|
|
|
|
logger = traceCounters("BlobWorkerMetrics", id, interval, &cc, "BlobWorkerMetrics");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|