Skip to content

Commit

Permalink
allow disabling summary label for resourcegraph
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Blaschke <[email protected]>
  • Loading branch information
mblaschke committed Sep 18, 2022
1 parent a3c79d5 commit c3daab1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Application Options:
--scrape.time.graph= Scrape time for Graph metrics (time.duration) [$SCRAPE_TIME_GRAPH]
--scrape.time.costs= Scrape time for costs/consumtion metrics (time.duration; BETA) (default: 0)
[$SCRAPE_TIME_COSTS]
--resourcehealth.summary.maxlength= Max length of ResourceHealth summary label (default: 80)
--resourcehealth.summary.maxlength= Max length of ResourceHealth summary label (0 = disable summary label) (default: 80)
[$RESOURCEHEALTH_SUMMARY_MAXLENGTH]
--graph.application.filter= MS Graph application $filter query eg: startswith(displayName,'A')
[$GRAPH_APPLICATION_FILTER]
Expand Down
2 changes: 1 addition & 1 deletion config/opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type (
}

ResourceHealth struct {
SummaryMaxLength int `long:"resourcehealth.summary.maxlength" env:"RESOURCEHEALTH_SUMMARY_MAXLENGTH" description:"Max length of ResourceHealth summary label" default:"80"`
SummaryMaxLength int `long:"resourcehealth.summary.maxlength" env:"RESOURCEHEALTH_SUMMARY_MAXLENGTH" description:"Max length of ResourceHealth summary label (0 = disable summary label)" default:"80"`
}

// graph settings
Expand Down
2 changes: 1 addition & 1 deletion metrics_azurerm_health.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (m *MetricsCollectorAzureRmHealth) collectSubscription(subscription *armsub
"resourceHealth": resourceHealthLogObject,
}).Info("unhealthy resource detected")

if opts.ResourceHealth.SummaryMaxLength >= 0 {
if opts.ResourceHealth.SummaryMaxLength > 0 {
summary = truncateStrings(to.String(resourceHealth.Properties.Summary), opts.ResourceHealth.SummaryMaxLength, "...")
}
}
Expand Down

0 comments on commit c3daab1

Please sign in to comment.