Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Hardikl
Copy link
Contributor

@Hardikl Hardikl commented Feb 27, 2025

No description provided.

@Hardikl Hardikl changed the title docs: handled plugin custom prefix name for metrics doc: handled plugin custom prefix name for metrics Feb 27, 2025
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 {
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

customName := r.object != ""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants