-
Notifications
You must be signed in to change notification settings - Fork 10
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
Avoid flapping metrics. #70
Merged
Merged
Conversation
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
For metrics: * pgbackrest_backup_repo_size_bytes * pgbackrest_backup_repo_size_map_bytes * pgbackrest_backup_repo_delta_map_bytes * pgbackrest_backup_last_repo_size_bytes * pgbackrest_backup_last_repo_size_map_bytes * pgbackrest_backup_last_repo_delta_map_bytes If value is absent, metric will be set to 0. It's necessary to avoid flapping time series. It is much more reasonable to pass the value 0 than to handle the event of the absence metrics. It's necessary to avoid flapping time series. This is especially important for *_last_* metrics.
For metrics: * pgbackrest_backup_error_status * pgbackrest_backup_annotations * pgbackrest_backup_databases * pgbackrest_backup_last_error_status * pgbackrest_backup_last_annotations * pgbackrest_backup_last_databases If value is absent, metric will be set to 0. It's necessary to avoid flapping time series. Add label "block_incr" to all *_backup_* and *_backup_last_* metrics.
…cific backup. This situation may occur on old pgBackRest versions or on some errors with pgBackRest.
Before pgBackRest v2.38 information about LSN in backup is absent. To avoid empty values for labels "lsn_start" and "lsn_stop" in "pgbackrest_backup_info" metric the label values "-" are used.
Update tests taking into account the default values for metrics. Deleted unused mocks. Add a custom function to compare the LastBackups structure. reflect.deepEqual() is not suitable because the structure may contain nil values. Previously, some tests could work incorrectly.
woblerr
changed the title
Add default value for
Draft: Add default value for Oct 22, 2023
_repo_*_bytes
metrics when them are absent._repo_*_bytes
metrics when them are absent.
woblerr
changed the title
Draft: Add default value for
Add default value for Oct 22, 2023
_repo_*_bytes
metrics when them are absent._repo_*_bytes
metrics when them are absent.
Cleanup code.
For pgBackRest < v2.32 repo info is not available. To avoid flapping this metric, set up the metric with value 0 (ok status) and the labels repo_key="0" and cipher="none".
woblerr
changed the title
Add default value for
Avoid flapping metrics.
Oct 24, 2023
_repo_*_bytes
metrics when them are absent.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Some metrics might not have a value.
This can happen in the case of older pgBackRest versions or in the absence of some parameters when calling the pgBackRest command during backup. Previously, such metrics were missing. This leads to the disappearance of metrics on the dashboards.
It is much more reasonable to pass the default value than to handle the event of the absence metrics. It's necessary to avoid flapping time series.
This PR allows to create metrics with default values in the absence of the necessary information.
If value is absent, the following metrics will be set to
0
:The label
block_incr
was added to all*_backup_*
and*_backup_last_*
metrics with default value"n"
.If information about LSN in backup is absent, the label values
"-"
are used for labelslsn_start
andlsn_stop
forpgbackrest_backup_info
metric.If information about repo is absent, the
pgbackrest_repo_status
metric will be set to0
with labelsrepo_key="0"
andcipher="none"