-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Wine93 <[email protected]>
- Loading branch information
Showing
11 changed files
with
279 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2023 NetEase Inc. | ||
* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* Project: Curve | ||
* Created Date: 2023-11-20 | ||
* Author: Jingli Chen (Wine93) | ||
*/ | ||
|
||
namespace curvefs { | ||
namespace client { | ||
namespace base { | ||
|
||
} // namespace base | ||
} // namespace client | ||
} // namespace curvefs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2023 NetEase Inc. | ||
* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* Project: Curve | ||
* Created Date: 2023-11-20 | ||
* Author: Jingli Chen (Wine93) | ||
*/ | ||
|
||
// 配置管理器: | ||
// (1) 动态配置需要支持所有配置项,足够灵活 | ||
// (2) 目前该模块主要用来控制日志采集器 | ||
|
||
#ifndef CURVEFS_SRC_CLIENT_BASE_CONFIGURE_H_ | ||
#define CURVEFS_SRC_CLIENT_BASE_CONFIGURE_H_ | ||
|
||
namespace curvefs { | ||
namespace client { | ||
namespace base { | ||
|
||
} // namespace base | ||
} // namespace client | ||
} // namespace curvefs | ||
|
||
#endif // CURVEFS_SRC_CLIENT_BASE_CONFIGURE_H_ |
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2023 NetEase Inc. | ||
* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* Project: Curve | ||
* Created Date: 2023-11-20 | ||
* Author: Jingli Chen (Wine93) | ||
*/ | ||
|
||
// 日志的采集器: | ||
// (1) 需要支持 buffer | ||
// (2) 配置可以指定多个后端地址,采用轮询进行负载 | ||
// (3) 并且发送需要有 retry 机制 | ||
// (4) 需要采集比例的可配置,如 4/100、100/100 | ||
// (5) 由于采集器的逻辑经常变更,可以考虑以插件的形式实现,以 so 加载或者 lua | ||
// (6) 需要和 access log 和 perf_context 结合起来,日志要同时发送到文件与 TCP | ||
// 实现不允许有冗余代码, 所以 log 的输出逻辑需要足够灵活,考虑采用 multi-sender | ||
|
||
#ifndef CURVEFS_SRC_CLIENT_BASE_LOG_SENDER_H_ | ||
#define CURVEFS_SRC_CLIENT_BASE_LOG_SENDER_H_ | ||
|
||
namespace curvefs { | ||
namespace client { | ||
namespace base { | ||
|
||
} // namespace base | ||
} // namespace client | ||
} // namespace curvefs | ||
|
||
#endif // CURVEFS_SRC_CLIENT_BASE_LOG_SENDER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/* | ||
* Copyright (c) 2023 NetEase Inc. | ||
* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* Project: Curve | ||
* Created Date: 2023-11-20 | ||
* Author: Jingli Chen (Wine93) | ||
*/ | ||
|
||
#ifndef CURVEFS_SRC_CLIENT_BASE_METRIC_H_ | ||
#define CURVEFS_SRC_CLIENT_BASE_METRIC_H_ | ||
|
||
#include <string> | ||
|
||
#include "curvefs/src/common/metric_utils.h" | ||
|
||
namespace curvefs { | ||
namespace client { | ||
namespace base { | ||
|
||
#define DEFINE_METRICS(seq) END(A seq) | ||
#define BODY(x) OpMetric x = OpMetric(#x); | ||
#define A(x) BODY(x) B | ||
#define B(x) BODY(x) A | ||
#define A_END | ||
#define B_END | ||
#define END(...) END_(__VA_ARGS__) | ||
#define END_(...) __VA_ARGS__##_END | ||
|
||
struct OpMetric { | ||
static const std::string prefix = "fuse_ll_" | ||
|
||
explicit OpMetric(const std::string& name) | ||
ninflight(prefix, name + "_ninflight"), | ||
nerror(prefix, name + "_nerror"), | ||
latency(prefix, name + "_latency") {} | ||
|
||
bvar::Adder<int64_t> ninflight; | ||
bvar::Adder<uint64_t> nerror; | ||
bvar::LatencyRecorder latency; | ||
}; | ||
|
||
// OpMetric lookup = OpMetric("lookup"); | ||
// OpMetric getattr = OpMetric("getattr"); | ||
// ... | ||
struct FuseLLOpMetric { | ||
DEFINE_METRICS( | ||
(lookup) | ||
(getattr) | ||
(setattr) | ||
(readlink) | ||
(mknod) | ||
(mkdir) | ||
(unlink) | ||
(rmdir) | ||
(symlink) | ||
(rename) | ||
(link) | ||
(open) | ||
(read) | ||
(write) | ||
(flush) | ||
(release) | ||
(fsync) | ||
(opendir) | ||
(readdir) | ||
(readdirplus) | ||
(releasedir) | ||
(statfs) | ||
(setxattr) | ||
(getxattr) | ||
(listxattr) | ||
(create) | ||
(bmap) | ||
) | ||
|
||
FuseLLOpMetric GetInstance() { | ||
static FuseLLOpMetric instance; | ||
return instance; | ||
} | ||
}; | ||
|
||
struct CodeGuard { | ||
CodeGuard(bvar::Adder<uint64_t>* nerror, CURVEFS_ERROR* code) | ||
: nerror(nerror), code(code) {} | ||
|
||
~CodeGuard() { | ||
if (*code != CURVEFS_ERROR::OK) { | ||
(*nerror) << 1; | ||
} | ||
} | ||
|
||
bvar::Adder<uint64_t>* nerror; | ||
CURVEFS_ERROR* code; | ||
}; | ||
|
||
struct MetricGuards { | ||
explicit MetricGuards(OpMetric* metric, CURVEFS_ERROR* code) | ||
: iGuard(&metric->ninflight), | ||
cGuard(&metric->nerror, code), | ||
lGuard(&metric->latency) {} | ||
|
||
~MetricGuards() = default; | ||
|
||
InflightGuard iGuard; | ||
CodeGuard cGuard; | ||
LatencyUpdater lGuard; | ||
}; | ||
|
||
// NOTE: param rc is implicit | ||
#define MetricGuard(OP) MetricGuards(&FuseLLOpMetric::GetInstance().OP, &rc); | ||
|
||
} // namespace base | ||
} // namespace client | ||
} // namespace curvefs | ||
|
||
#endif // CURVEFS_SRC_CLIENT_BASE_METRIC_H_ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2023 NetEase Inc. | ||
* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* Project: Curve | ||
* Created Date: 2023-11-20 | ||
* Author: Jingli Chen (Wine93) | ||
*/ | ||
|
||
// perf context | ||
// (1) 整体设计参考 rocksdb,需要更灵活 | ||
// (2) IO 链路上的请求需要尽可能细的拆分: memory, diskcache, s3, memcache | ||
// (3) 元数据操作主要是 rpc(如果可以拆分网络和磁盘等更好) | ||
|
||
#ifndef CURVEFS_SRC_CLIENT_BASE_PERF_CONTEXT_H_ | ||
#define CURVEFS_SRC_CLIENT_BASE_PERF_CONTEXT_H_ | ||
|
||
namespace curvefs { | ||
namespace client { | ||
namespace base { | ||
|
||
} // namespace base | ||
} // namespace client | ||
} // namespace curvefs | ||
|
||
#endif // CURVEFS_SRC_CLIENT_BASE_PERF_CONTEXT_H_ |