forked from redpanda-data/redpanda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request redpanda-data#24007 from nvartolomei/nv/log-manage…
…r-probe storage: housekeeping metrics
- Loading branch information
Showing
7 changed files
with
165 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
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
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,50 @@ | ||
// Copyright 2024 Redpanda Data, Inc. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.md | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0 | ||
|
||
#include "storage/log_manager_probe.h" | ||
|
||
#include "config/configuration.h" | ||
#include "metrics/prometheus_sanitize.h" | ||
|
||
#include <seastar/core/metrics.hh> | ||
|
||
namespace storage { | ||
|
||
void log_manager_probe::setup_metrics() { | ||
if (config::shard_local_cfg().disable_metrics()) { | ||
return; | ||
} | ||
|
||
namespace sm = ss::metrics; | ||
|
||
auto group_name = prometheus_sanitize::metrics_name("storage:manager"); | ||
|
||
_metrics.add_group( | ||
group_name, | ||
{ | ||
sm::make_gauge( | ||
"logs", | ||
[this] { return _log_count; }, | ||
sm::description("Number of logs managed")), | ||
sm::make_counter( | ||
"urgent_gc_runs", | ||
[this] { return _urgent_gc_runs; }, | ||
sm::description("Number of urgent GC runs")), | ||
sm::make_counter( | ||
"housekeeping_log_processed", | ||
[this] { return _housekeeping_log_processed; }, | ||
sm::description("Number of logs processed by housekeeping")), | ||
}, | ||
{}, | ||
{}); | ||
} | ||
|
||
void log_manager_probe::clear_metrics() { _metrics.clear(); } | ||
|
||
} // namespace storage |
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,45 @@ | ||
// Copyright 2024 Redpanda Data, Inc. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.md | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0 | ||
|
||
#pragma once | ||
|
||
#include "metrics/metrics.h" | ||
|
||
#include <cstdint> | ||
|
||
namespace storage { | ||
|
||
/// Log manager per-shard storage probe. | ||
class log_manager_probe { | ||
public: | ||
log_manager_probe() = default; | ||
log_manager_probe(const log_manager_probe&) = delete; | ||
log_manager_probe& operator=(const log_manager_probe&) = delete; | ||
log_manager_probe(log_manager_probe&&) = delete; | ||
log_manager_probe& operator=(log_manager_probe&&) = delete; | ||
~log_manager_probe() = default; | ||
|
||
public: | ||
void setup_metrics(); | ||
void clear_metrics(); | ||
|
||
public: | ||
void set_log_count(uint32_t log_count) { _log_count = log_count; } | ||
void housekeeping_log_processed() { ++_housekeeping_log_processed; } | ||
void urgent_gc_run() { ++_urgent_gc_runs; } | ||
|
||
private: | ||
uint32_t _log_count = 0; | ||
uint64_t _urgent_gc_runs = 0; | ||
uint64_t _housekeeping_log_processed = 0; | ||
|
||
metrics::internal_metric_groups _metrics; | ||
}; | ||
|
||
}; // namespace storage |
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