-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error handling while running the Gluster commands
A new metric is added to capture the metrics collection errors `glusterfs_error_count` with label "name" to identify the failed metrics collector. Example: ```prometheus glusterfs_error_count{name="list_volumes"} 1.0 glusterfs_error_count{name="list_peers"} 1.0 ``` On error, volume and peer metrics will not be collected. Once Glusterd comes back online or after the issue is fixed, then these metrics will start appearing. DW_FORM_data16 exception is fixed with the latest version of the Crystal (Ref: crystal-lang/crystal#12744) Fixes: #38 Signed-off-by: Aravinda Vishwanathapura <[email protected]>
- Loading branch information
1 parent
910492f
commit b84f710
Showing
4 changed files
with
48 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module GlusterMetricsExporter | ||
Crometheus.alias ErrorGauge = Crometheus::Gauge[:name] | ||
|
||
@@error_count = ErrorGauge.new(:error_count, "Metrics collection errors") | ||
|
||
def self.clear_error_metrics | ||
@@error_count.clear | ||
end | ||
|
||
handle_metrics(["error"]) do |metrics_data| | ||
# Reset all Metrics to avoid stale data. Careful if | ||
# counter type is used | ||
clear_error_metrics | ||
|
||
metrics_data.errors.each do |err| | ||
@@error_count[name: err.name].set(1) | ||
end | ||
end | ||
end |
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