Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Remove Prometheus metrics prefix #9543

Merged
merged 14 commits into from
Dec 9, 2021
Merged

Remove Prometheus metrics prefix #9543

merged 14 commits into from
Dec 9, 2021

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Aug 11, 2021

The situation right now is that, at initialization, we call Registry::new_custom(Some("substrate"), None), which automatically adds a substrate_ prefix in front of every single metric that we register.
Polkadot, however, overwrites this Registry by doing Registry::new_custom(Some("polkadot"), None), meaning that, in Polkadot, all metrics, even the ones defined in Substrate, have the polkadot_ prefix.

This causes a big issue: Grafana dashboards and alerts need to be created once for Polkadot nodes and once for all-Substrate-chains-except-Polkadot.

This PR modifies this system by removing the automatic metrics prefixing. Instead, I've manually added substrate_ in front of all the metrics registered in Substrate and polkadot_ in front of all the metrics registered in Polkadot. This matches the Prometheus good practices, which mention that libraries (Substrate is a library) can have their own prefix different from the binary.

However, in order to make things easier for devops, this PR also adds an automatic {chain="chain_id"} parameter behind every metric, where chain_id is the chain id found in the chain spec (e.g. "polkadot" or "ksmcc3").

polkadot companion: paritytech/polkadot#3623

@tomaka tomaka added A0-please_review Pull request needs code review. B5-clientnoteworthy C1-low PR touches the given topic and has a low impact on builders. labels Aug 11, 2021
@stale
Copy link

stale bot commented Sep 11, 2021

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Sep 11, 2021
@stale stale bot closed this Sep 25, 2021
@gabreal
Copy link
Member

gabreal commented Oct 19, 2021

would this be ready for merging and rolling out?

@gabreal gabreal reopened this Oct 19, 2021
@stale stale bot removed the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Oct 19, 2021
@stale
Copy link

stale bot commented Nov 18, 2021

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Nov 18, 2021
@tomaka
Copy link
Contributor Author

tomaka commented Nov 18, 2021

Beep

@stale stale bot removed the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Nov 18, 2021
@tomaka tomaka requested a review from adoerr as a code owner November 18, 2021 17:01
Copy link
Contributor

@adoerr adoerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BEEFY LGTM

@bkchr
Copy link
Member

bkchr commented Nov 19, 2021

@tomaka this doesn't compile, otherwise we should be good to merge this.

@bkchr
Copy link
Member

bkchr commented Nov 25, 2021

@tomaka does not compile 😬

@bkchr
Copy link
Member

bkchr commented Nov 25, 2021

(cargo fmt 🙈 )

@bkchr
Copy link
Member

bkchr commented Dec 9, 2021

bot merge

@paritytech-processbot
Copy link

Error: It's not possible to meet the minimal approval count of 1 in paritytech/polkadot#3623

@bkchr bkchr merged commit 1a30fa2 into master Dec 9, 2021
@bkchr bkchr deleted the tka-change-prometheus branch December 9, 2021 10:21
seunlanlege pushed a commit to seunlanlege/substrate that referenced this pull request Dec 17, 2021
* Remove Prometheus metrics prefix

* Fix line widths

* Missed some metrics

* Fix CLI

* Run rustfmt on modified files

* Missing prefixes

* Hopefully fix compilation

* Rustfmt protocol.rs

* Should compile now I guess

* Rustfmt

Co-authored-by: Bastian Köcher <info@kchr.de>
PierreBesson added a commit to PierreBesson/substrate that referenced this pull request Jan 10, 2022
* match the `substrate_` metrics prefix instead of `polkadot_`, following changes in paritytech#9543
PierreBesson added a commit to PierreBesson/substrate that referenced this pull request Jan 10, 2022
* match the `substrate_` metrics prefix in alerts instead of `polkadot_`, following changes in paritytech#9543
* remove the filtering on polkadot|kusama domain for NumberOfFileDescriptorsHigh alert
PierreBesson added a commit to PierreBesson/substrate that referenced this pull request Jan 10, 2022
* match the `substrate_` metrics prefix instead of `polkadot_` in dashboards, following changes in paritytech#9543
bkchr pushed a commit that referenced this pull request Feb 2, 2022
* .maintain/monitoring: Update substrate prometheus alert rules

* match the `substrate_` metrics prefix in alerts instead of `polkadot_`, following changes in #9543
* remove the filtering on polkadot|kusama domain for NumberOfFileDescriptorsHigh alert

* .maintain/monitoring: Update substrate Grafana dashboards

* match the `substrate_` metrics prefix instead of `polkadot_` in dashboards, following changes in #9543

* .maintain/monitoring:  make the NumberOfFileDescriptorsHigh alert only apply for metrics tagged with 'chain'
agryaznov pushed a commit to agryaznov/substrate that referenced this pull request Feb 4, 2022
* .maintain/monitoring: Update substrate prometheus alert rules

* match the `substrate_` metrics prefix in alerts instead of `polkadot_`, following changes in paritytech#9543
* remove the filtering on polkadot|kusama domain for NumberOfFileDescriptorsHigh alert

* .maintain/monitoring: Update substrate Grafana dashboards

* match the `substrate_` metrics prefix instead of `polkadot_` in dashboards, following changes in paritytech#9543

* .maintain/monitoring:  make the NumberOfFileDescriptorsHigh alert only apply for metrics tagged with 'chain'
Wizdave97 pushed a commit to ComposableFi/substrate that referenced this pull request Feb 4, 2022
* .maintain/monitoring: Update substrate prometheus alert rules

* match the `substrate_` metrics prefix in alerts instead of `polkadot_`, following changes in paritytech#9543
* remove the filtering on polkadot|kusama domain for NumberOfFileDescriptorsHigh alert

* .maintain/monitoring: Update substrate Grafana dashboards

* match the `substrate_` metrics prefix instead of `polkadot_` in dashboards, following changes in paritytech#9543

* .maintain/monitoring:  make the NumberOfFileDescriptorsHigh alert only apply for metrics tagged with 'chain'
grishasobol pushed a commit to gear-tech/substrate that referenced this pull request Mar 28, 2022
* Remove Prometheus metrics prefix

* Fix line widths

* Missed some metrics

* Fix CLI

* Run rustfmt on modified files

* Missing prefixes

* Hopefully fix compilation

* Rustfmt protocol.rs

* Should compile now I guess

* Rustfmt

Co-authored-by: Bastian Köcher <info@kchr.de>
grishasobol pushed a commit to gear-tech/substrate that referenced this pull request Mar 28, 2022
* .maintain/monitoring: Update substrate prometheus alert rules

* match the `substrate_` metrics prefix in alerts instead of `polkadot_`, following changes in paritytech#9543
* remove the filtering on polkadot|kusama domain for NumberOfFileDescriptorsHigh alert

* .maintain/monitoring: Update substrate Grafana dashboards

* match the `substrate_` metrics prefix instead of `polkadot_` in dashboards, following changes in paritytech#9543

* .maintain/monitoring:  make the NumberOfFileDescriptorsHigh alert only apply for metrics tagged with 'chain'
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* Remove Prometheus metrics prefix

* Fix line widths

* Missed some metrics

* Fix CLI

* Run rustfmt on modified files

* Missing prefixes

* Hopefully fix compilation

* Rustfmt protocol.rs

* Should compile now I guess

* Rustfmt

Co-authored-by: Bastian Köcher <info@kchr.de>
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* .maintain/monitoring: Update substrate prometheus alert rules

* match the `substrate_` metrics prefix in alerts instead of `polkadot_`, following changes in paritytech#9543
* remove the filtering on polkadot|kusama domain for NumberOfFileDescriptorsHigh alert

* .maintain/monitoring: Update substrate Grafana dashboards

* match the `substrate_` metrics prefix instead of `polkadot_` in dashboards, following changes in paritytech#9543

* .maintain/monitoring:  make the NumberOfFileDescriptorsHigh alert only apply for metrics tagged with 'chain'
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants