Skip to content

Commit

Permalink
refactor: replace perf-counters with new metrics in some names and co…
Browse files Browse the repository at this point in the history
…mments (apache#1925)
  • Loading branch information
empiredan authored Mar 1, 2024
1 parent 4a05fae commit dfd4f0d
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/meta/meta_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void proposal_actions::track_current_learner(const dsn::rpc_address &node, const
current_learner.last_committed_decree > info.last_committed_decree ||
current_learner.last_prepared_decree > info.last_prepared_decree) {

// TODO: need to add a perf counter here
// TODO: need to add a metric here.
LOG_WARNING("{}: learner({})'s progress step back, please trace this carefully",
info.pid,
node);
Expand Down
3 changes: 2 additions & 1 deletion src/replica/bulk_load/replica_bulk_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ class replica_bulk_loader : replica_base
std::map<std::string, task_ptr> _download_files_task;
// download metadata and create download file tasks
task_ptr _download_task;
// Used for perf-counter

// Used for metrics.
uint64_t _bulk_load_start_time_ms{0};

METRIC_VAR_DECLARE_counter(bulk_load_downloading_count);
Expand Down
2 changes: 1 addition & 1 deletion src/replica/duplication/mutation_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void mutation_buffer::commit(decree d, commit_type ct)
// n+m(m>1) n+k(k>=m)
//
// just LOG_ERROR but not CHECK if mutation loss or other problem, it's different from
// base class implement. And from the error and perf-counter, we can choose restart
// base class implement. And based on the error and metric, we can choose to restart
// duplication or ignore the loss.
if (next_committed_mutation == nullptr || !next_committed_mutation->is_logged()) {
LOG_ERROR_PREFIX("mutation[{}] is lost in prepare_list: "
Expand Down
1 change: 0 additions & 1 deletion src/replica/replica.h
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,6 @@ class replica : public serverlet<replica>, public ref_counter, public replica_ba

std::unique_ptr<replica_follower> _replica_follower;

// perf counters
METRIC_VAR_DECLARE_gauge_int64(private_log_size_mb);
METRIC_VAR_DECLARE_counter(throttling_delayed_write_requests);
METRIC_VAR_DECLARE_counter(throttling_rejected_write_requests);
Expand Down
2 changes: 1 addition & 1 deletion src/replica/replica_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class partition_split_context
// see more in function `child_check_split_context` and `parent_check_states`
task_ptr check_state_task;

// Used for split related perf-counter
// Used for split-related metrics.
uint64_t splitting_start_ts_ns{0};
uint64_t splitting_start_async_learn_ts_ns{0};
uint64_t splitting_copy_file_count{0};
Expand Down
2 changes: 1 addition & 1 deletion src/replica/split/replica_split_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class replica_split_manager : replica_base
uint64_t total_file_size,
decree last_committed_decree);

// TODO(heyuchen): total_file_size is used for split perf-counter in further pull request
// TODO(heyuchen): total_file_size is used for split-related metrics in further pull request.
// Applies mutation logs that were learned from the parent of this child.
// This stage follows after that child applies the checkpoint of parent, and begins to apply the
// mutations.
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
Profiler toollet
This toollet collects many performance counter values for the specified tasks,
as configed below.
This toollet collects many performance metrics for the specified tasks,
as configured below.
<PRE>
Expand Down
2 changes: 1 addition & 1 deletion src/server/pegasus_write_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class pegasus_write_service : dsn::replication::replica_base
uint32_t _put_batch_size;
uint32_t _remove_batch_size;

// TODO(wutao1): add perf counters for failed rpc.
// TODO(wutao1): add metrics for failed rpc.
};

} // namespace server
Expand Down
8 changes: 4 additions & 4 deletions src/server/test/pegasus_server_impl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ class pegasus_server_impl_test : public pegasus_server_test_base

void test_table_level_slow_query()
{
// the on_get function will sleep 10ms for unit test,
// so when we set slow_query_threshold <= 10ms, the perf counter will be incr by 1
// The function `on_get` will sleep 10ms for the unit test. Thus when we set
// slow_query_threshold <= 10ms, the metric `abnormal_read_requests` will increment by 1.
struct test_case
{
bool is_multi_get; // false-on_get, true-on_multi_get
uint64_t slow_query_threshold_ms;
uint8_t expect_perf_counter_incr;
uint8_t expected_incr;
} tests[] = {{false, 10, 1}, {false, 300, 0}, {true, 10, 1}, {true, 300, 0}};

// test key
Expand Down Expand Up @@ -93,7 +93,7 @@ class pegasus_server_impl_test : public pegasus_server_test_base
}
auto after_count = _server->METRIC_VAR_VALUE(abnormal_read_requests);

ASSERT_EQ(before_count + test.expect_perf_counter_incr, after_count);
ASSERT_EQ(before_count + test.expected_incr, after_count);
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/utils/api_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
* THE SOFTWARE.
*/

// some useful utility functions provided by rDSN,
// such as logging, performance counter, checksum,
// command line interface registration and invocation,
// etc.
// Some useful utility functions for logging and mocking provided by rDSN.

#pragma once

Expand Down

0 comments on commit dfd4f0d

Please sign in to comment.