-
Notifications
You must be signed in to change notification settings - Fork 40
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
doc: handled plugin custom prefix name for metrics #3493
base: main
Are you sure you want to change the base?
Conversation
66228a3
to
064fa81
Compare
c.Name = metric.Name + "_" + c.Name | ||
c.Description = fmt.Sprintf("%s %s is [%s](#%s) aggregated by `%s`.", | ||
c.Description, c.Name, withPrefix, withPrefix, metric.Name) | ||
if metric.CustomName { |
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.
Could be simplified to
c.Name = metric.Name + "_" + c.Name
if metric.CustomName {
c.Name = metric.Source + "_" + noPrefix
}
c.Description = fmt.Sprintf("%s %s is [%s](#%s) aggregated by `%s`.",
c.Description, c.Name, withPrefix, withPrefix, metric.Name)
Name string | ||
Source string | ||
IsMax bool | ||
CustomName bool |
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.
Would HasCustomName
or HasCustom
be clearer?
@@ -314,7 +314,11 @@ func (a *Aggregator) NewLabels() []string { | |||
func (a *Aggregator) NewMetrics() []plugin.DerivedMetric { | |||
derivedMetrics := make([]plugin.DerivedMetric, 0, len(a.rules)) | |||
for _, r := range a.rules { | |||
derivedMetrics = append(derivedMetrics, plugin.DerivedMetric{Name: r.label, Source: r.object}) | |||
customName := false |
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.
customName := r.object != ""
No description provided.