-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publish runtime metric in seconds #5893
Merged
BenPope
merged 7 commits into
redpanda-data:dev
from
VladLazar:public-metrics-uptime-seconds
Aug 11, 2022
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
14b45a4
cpu_scheduling: expose all scheduling groups
1c3bbb4
cpu_scheduling: add scheduling_groups probe
1be0e7c
redpanda/main: use scheduling groups probe
a092bab
application: add up and busy time public metrics
1c87686
application: remove scheduler_runtime_ms metric
30ce207
ssx: add metric_groups wrapper to use as service
5c94d72
application: public metrics as a sharded service
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,24 @@ class scheduling_groups final { | |
} | ||
ss::scheduling_group archival_upload() { return _archival_upload; } | ||
|
||
std::vector<std::reference_wrapper<const ss::scheduling_group>> | ||
BenPope marked this conversation as resolved.
Show resolved
Hide resolved
|
||
all_scheduling_groups() const { | ||
return { | ||
std::cref(_default), | ||
std::cref(_admin), | ||
std::cref(_raft), | ||
std::cref(_kafka), | ||
std::cref(_cluster), | ||
std::cref(_coproc), | ||
std::cref(_cache_background_reclaim), | ||
std::cref(_compaction), | ||
std::cref(_raft_learner_recovery), | ||
std::cref(_archival_upload)}; | ||
} | ||
|
||
private: | ||
ss::scheduling_group _default{ | ||
seastar::default_scheduling_group()}; // created and managed by seastar | ||
Comment on lines
+84
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! |
||
ss::scheduling_group _admin; | ||
ss::scheduling_group _raft; | ||
ss::scheduling_group _kafka; | ||
|
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,52 @@ | ||
/* | ||
* Copyright 2022 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 "cluster/partition_leaders_table.h" | ||
#include "config/configuration.h" | ||
#include "prometheus/prometheus_sanitize.h" | ||
#include "resource_mgmt/cpu_scheduling.h" | ||
#include "ssx/metrics.h" | ||
|
||
#include <seastar/core/metrics.hh> | ||
|
||
class scheduling_groups_probe { | ||
public: | ||
void wire_up(const scheduling_groups& scheduling_groups) { | ||
if (config::shard_local_cfg().disable_public_metrics()) { | ||
return; | ||
} | ||
|
||
auto groups = scheduling_groups.all_scheduling_groups(); | ||
for (const auto& group_ref : groups) { | ||
_public_metrics.add_group( | ||
prometheus_sanitize::metrics_name("scheduler"), | ||
{seastar::metrics::make_counter( | ||
"runtime_seconds_total", | ||
[group_ref] { | ||
auto runtime_duration = group_ref.get().get_stats().runtime; | ||
return std::chrono::duration<double>(runtime_duration).count(); | ||
}, | ||
seastar::metrics::description( | ||
"Accumulated runtime of task queue associated with this " | ||
"scheduling group"), | ||
{ssx::metrics::make_namespaced_label("scheduling_group")( | ||
group_ref.get().name())})}); | ||
} | ||
} | ||
|
||
void clear() { _public_metrics.clear(); } | ||
|
||
private: | ||
seastar::metrics::metric_groups _public_metrics{ | ||
ssx::metrics::public_metrics_handle}; | ||
}; |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VladLazar just curious about using
invoke_on(this_shard_id, ...
as opposed to_public_metrics.local(). ..
is there something special about using invoke on that i'm missing here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're not missing anything. I just slightly misused the api (unintentionally). Should have used
local()
. I don't think there is any difference in behaviour though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
me neither, looks fine. thx