Skip to content

Commit

Permalink
chore(log_store): remove redundant metrics (#4570)
Browse files Browse the repository at this point in the history
chore(log_store): remove unused metrics
  • Loading branch information
WenyXu authored Aug 16, 2024
1 parent 93be81c commit d147278
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 47 deletions.
4 changes: 1 addition & 3 deletions src/log-store/src/kafka/log_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ impl LogStore for KafkaLogStore {
/// Appends a batch of entries and returns a response containing a map where the key is a region id
/// while the value is the id of the last successfully written entry of the region.
async fn append_batch(&self, entries: Vec<Entry>) -> Result<AppendBatchResponse> {
metrics::METRIC_KAFKA_APPEND_BATCH_CALLS_TOTAL.inc();
metrics::METRIC_KAFKA_APPEND_BATCH_BYTES_TOTAL.inc_by(
entries
.iter()
Expand Down Expand Up @@ -209,7 +208,6 @@ impl LogStore for KafkaLogStore {
actual: provider.type_name(),
})?;

metrics::METRIC_KAFKA_READ_CALLS_TOTAL.inc();
let _timer = metrics::METRIC_KAFKA_READ_ELAPSED.start_timer();

// Gets the client associated with the topic.
Expand Down Expand Up @@ -273,7 +271,7 @@ impl LogStore for KafkaLogStore {
})?;
let (kafka_record, offset) = (record_and_offset.record, record_and_offset.offset);

metrics::METRIC_KAFKA_READ_RECORD_BYTES_TOTAL
metrics::METRIC_KAFKA_READ_BYTES_TOTAL
.inc_by(kafka_record.approximate_size() as u64);

debug!(
Expand Down
42 changes: 0 additions & 42 deletions src/log-store/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,48 +45,6 @@ lazy_static! {
&["raft-engine", "read"],
);

/// Counter of bytes of the records read by the kafka logstore.
pub static ref METRIC_KAFKA_READ_RECORD_BYTES_TOTAL: IntCounter = register_int_counter!(
"greptime_kafka_read_record_bytes_total",
"kafka read record bytes total"
).unwrap();

/// Counter of the numbers of the records produced by the kafka logstore.
pub static ref METRIC_KAFKA_PRODUCE_RECORD_COUNTS: IntCounter = register_int_counter!(
"greptime_kafka_produce_record_counts",
"kafka produce record counts",
).unwrap();

/// Counter of bytes of the records produced by the kafka logstore.
pub static ref METRIC_KAFKA_PRODUCE_RECORD_BYTES_TOTAL: IntCounter = register_int_counter!(
"greptime_kafka_produce_record_bytes_total",
"kafka produce record bytes total"
).unwrap();

/// Counters of calls of each operation on a logstore.
pub static ref METRIC_LOGSTORE_OP_CALLS_TOTAL: IntCounterVec = register_int_counter_vec!(
"greptime_logstore_op_calls_total",
"logstore operation calls total",
&[LOGSTORE_LABEL, OPTYPE_LABEL],
)
.unwrap();
/// Counter of calls of the append_batch operation on the kafka logstore.
pub static ref METRIC_KAFKA_APPEND_BATCH_CALLS_TOTAL: IntCounter = METRIC_LOGSTORE_OP_CALLS_TOTAL.with_label_values(
&["kafka", "append_batch"],
);
/// Counter of calls of the read operation on the kafka logstore.
pub static ref METRIC_KAFKA_READ_CALLS_TOTAL: IntCounter = METRIC_LOGSTORE_OP_CALLS_TOTAL.with_label_values(
&["kafka", "read"],
);
/// Counter of calls of the append_batch operation on the raft-engine logstore.
pub static ref METRIC_RAFT_ENGINE_APPEND_BATCH_CALLS_TOTAL: IntCounter = METRIC_LOGSTORE_OP_CALLS_TOTAL.with_label_values(
&["raft-engine", "append_batch"],
);
/// Counter of calls of the read operation on the raft-engine logstore.
pub static ref METRIC_RAFT_ENGINE_READ_CALLS_TOTAL: IntCounter = METRIC_LOGSTORE_OP_CALLS_TOTAL.with_label_values(
&["raft-engine", "read"],
);

/// Timer of operations on a logstore.
pub static ref METRIC_LOGSTORE_OP_ELAPSED: HistogramVec = register_histogram_vec!(
"greptime_logstore_op_elapsed",
Expand Down
2 changes: 0 additions & 2 deletions src/log-store/src/raft_engine/log_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ impl LogStore for RaftEngineLogStore {
/// Appends a batch of entries to logstore. `RaftEngineLogStore` assures the atomicity of
/// batch append.
async fn append_batch(&self, entries: Vec<Entry>) -> Result<AppendBatchResponse> {
metrics::METRIC_RAFT_ENGINE_APPEND_BATCH_CALLS_TOTAL.inc();
metrics::METRIC_RAFT_ENGINE_APPEND_BATCH_BYTES_TOTAL.inc_by(
entries
.iter()
Expand Down Expand Up @@ -261,7 +260,6 @@ impl LogStore for RaftEngineLogStore {
actual: provider.type_name(),
})?;
let namespace_id = ns.id;
metrics::METRIC_RAFT_ENGINE_READ_CALLS_TOTAL.inc();
let _timer = metrics::METRIC_RAFT_ENGINE_READ_ELAPSED.start_timer();

ensure!(self.started(), IllegalStateSnafu);
Expand Down

0 comments on commit d147278

Please sign in to comment.