Skip to content

Commit

Permalink
curvefs/metaserver: statistic arrival request for copyset per second
Browse files Browse the repository at this point in the history
  • Loading branch information
ilixiaocui committed Jun 15, 2022
1 parent 855e523 commit a086308
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 49 deletions.
2 changes: 1 addition & 1 deletion curvefs/src/metaserver/copyset/copyset_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ CopysetNode::CopysetNode(PoolId poolId, CopysetId copysetId,
latestLoadSnapshotIndex_(0),
confChangeMtx_(),
ongoingConfChange_(),
metric_(absl::make_unique<OperatorApplyMetric>(poolId_, copysetId_)),
metric_(absl::make_unique<OperatorMetric>(poolId_, copysetId_)),
isLoading_(false) {}

CopysetNode::~CopysetNode() {
Expand Down
6 changes: 3 additions & 3 deletions curvefs/src/metaserver/copyset/copyset_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class CopysetNode : public braft::StateMachine {

ApplyQueue* GetApplyQueue() const;

OperatorApplyMetric* GetMetric() const;
OperatorMetric* GetMetric() const;

const std::string& Name() const;

Expand Down Expand Up @@ -230,7 +230,7 @@ class CopysetNode : public braft::StateMachine {

OngoingConfChange ongoingConfChange_;

std::unique_ptr<OperatorApplyMetric> metric_;
std::unique_ptr<OperatorMetric> metric_;

std::atomic<bool> isLoading_;
};
Expand Down Expand Up @@ -278,7 +278,7 @@ inline ApplyQueue* CopysetNode::GetApplyQueue() const {
return applyQueue_.get();
}

inline OperatorApplyMetric* CopysetNode::GetMetric() const {
inline OperatorMetric* CopysetNode::GetMetric() const {
return metric_.get();
}

Expand Down
72 changes: 36 additions & 36 deletions curvefs/src/metaserver/copyset/meta_operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ class GetDentryOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

bool CanBypassPropose() const override;

OperatorType GetOperatorType() const override;
};

class ListDentryOperator : public MetaOperator {
Expand All @@ -194,14 +194,14 @@ class ListDentryOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

bool CanBypassPropose() const override;

OperatorType GetOperatorType() const override;
};

class CreateDentryOperator : public MetaOperator {
Expand All @@ -215,12 +215,12 @@ class CreateDentryOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

OperatorType GetOperatorType() const override;
};

class DeleteDentryOperator : public MetaOperator {
Expand All @@ -234,12 +234,12 @@ class DeleteDentryOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

OperatorType GetOperatorType() const override;
};

class GetInodeOperator : public MetaOperator {
Expand All @@ -253,14 +253,14 @@ class GetInodeOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

bool CanBypassPropose() const override;

OperatorType GetOperatorType() const override;
};

class BatchGetInodeAttrOperator : public MetaOperator {
Expand All @@ -274,14 +274,14 @@ class BatchGetInodeAttrOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

bool CanBypassPropose() const override;

OperatorType GetOperatorType() const override;
};

class BatchGetXAttrOperator : public MetaOperator {
Expand All @@ -295,14 +295,14 @@ class BatchGetXAttrOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

bool CanBypassPropose() const override;

OperatorType GetOperatorType() const override;
};

class CreateInodeOperator : public MetaOperator {
Expand All @@ -316,12 +316,12 @@ class CreateInodeOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

OperatorType GetOperatorType() const override;
};

class UpdateInodeOperator : public MetaOperator {
Expand All @@ -335,12 +335,12 @@ class UpdateInodeOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

OperatorType GetOperatorType() const override;
};

class GetOrModifyS3ChunkInfoOperator : public MetaOperator {
Expand All @@ -354,12 +354,12 @@ class GetOrModifyS3ChunkInfoOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

OperatorType GetOperatorType() const override;
};

class DeleteInodeOperator : public MetaOperator {
Expand All @@ -373,12 +373,12 @@ class DeleteInodeOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

OperatorType GetOperatorType() const override;
};

class CreateRootInodeOperator : public MetaOperator {
Expand All @@ -392,12 +392,12 @@ class CreateRootInodeOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

OperatorType GetOperatorType() const override;
};

class UpdateInodeS3VersionOperator : public MetaOperator {
Expand All @@ -411,12 +411,12 @@ class UpdateInodeS3VersionOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

OperatorType GetOperatorType() const override;
};

class CreatePartitionOperator : public MetaOperator {
Expand All @@ -430,12 +430,12 @@ class CreatePartitionOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

OperatorType GetOperatorType() const override;
};

class DeletePartitionOperator : public MetaOperator {
Expand All @@ -449,12 +449,12 @@ class DeletePartitionOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

OperatorType GetOperatorType() const override;
};

class PrepareRenameTxOperator : public MetaOperator {
Expand All @@ -468,12 +468,12 @@ class PrepareRenameTxOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

OperatorType GetOperatorType() const override;
};

class GetVolumeExtentOperator : public MetaOperator {
Expand All @@ -488,14 +488,14 @@ class GetVolumeExtentOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

bool CanBypassPropose() const override;

OperatorType GetOperatorType() const override;
};

class UpdateVolumeExtentOperator : public MetaOperator {
Expand All @@ -510,12 +510,12 @@ class UpdateVolumeExtentOperator : public MetaOperator {

uint64_t HashCode() const override;

OperatorType GetOperatorType() const override;

private:
void Redirect() override;

void OnFailed(MetaStatusCode code) override;

OperatorType GetOperatorType() const override;
};

} // namespace copyset
Expand Down
18 changes: 13 additions & 5 deletions curvefs/src/metaserver/copyset/metric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace curvefs {
namespace metaserver {
namespace copyset {

OperatorApplyMetric::OperatorApplyMetric(PoolId poolId, CopysetId copysetId) {
OperatorMetric::OperatorMetric(PoolId poolId, CopysetId copysetId) {
std::string prefix = "op_apply_pool_" + std::to_string(poolId) +
"_copyset_" + std::to_string(copysetId);
std::string fromLogPrefix = "op_apply_from_log_pool_" +
Expand All @@ -42,7 +42,7 @@ OperatorApplyMetric::OperatorApplyMetric(PoolId poolId, CopysetId copysetId) {
}
}

void OperatorApplyMetric::OnOperatorComplete(OperatorType type,
void OperatorMetric::OnOperatorComplete(OperatorType type,
uint64_t latencyUs, bool success) {
auto index = static_cast<uint32_t>(type);
if (index < kTotalOperatorNum) {
Expand All @@ -54,7 +54,7 @@ void OperatorApplyMetric::OnOperatorComplete(OperatorType type,
}
}

void OperatorApplyMetric::OnOperatorCompleteFromLog(OperatorType type,
void OperatorMetric::OnOperatorCompleteFromLog(OperatorType type,
uint64_t latencyUs, bool success) {
auto index = static_cast<uint32_t>(type);
if (index < kTotalOperatorNum) {
Expand All @@ -66,21 +66,29 @@ void OperatorApplyMetric::OnOperatorCompleteFromLog(OperatorType type,
}
}

void OperatorApplyMetric::WaitInQueueLantancy(OperatorType type,
void OperatorMetric::WaitInQueueLantancy(OperatorType type,
uint64_t latencyUs) {
auto index = static_cast<uint32_t>(type);
if (index < kTotalOperatorNum) {
opMetrics_[index]->waitInQueueLatency << latencyUs;
}
}

void OperatorApplyMetric::ExecuteLantancy(OperatorType type,
void OperatorMetric::ExecuteLantancy(OperatorType type,
uint64_t latencyUs) {
auto index = static_cast<uint32_t>(type);
if (index < kTotalOperatorNum) {
opMetrics_[index]->executeLatency << latencyUs;
}
}

void OperatorMetric::NewArrival(OperatorType type) {
auto index = static_cast<uint32_t>(type);
if (index < kTotalOperatorNum) {
opMetrics_[index]->rcount << 1;
}
}

} // namespace copyset
} // namespace metaserver
} // namespace curvefs
Loading

0 comments on commit a086308

Please sign in to comment.