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

chore: print number of object and counters Harvest collects #1916

Merged
merged 1 commit into from
Apr 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cmd/tools/template/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,23 @@ func TestTemplateNamesMatchDefault(t *testing.T) {
}
}

// TestTotals prints the number of unique objects and counters that Harvest collects, excluding EMS.
func TestTotals(t *testing.T) {
totalObject := make(objectMap)
var totalCounters int

visitTemplates(t, func(path string, model TemplateModel) {
totalObject[model.Name] = path
totalCounters += len(model.metrics)

for _, ep := range model.Endpoints {
totalCounters += len(ep.metrics)
}
}, allTemplatesButEms...)

fmt.Printf("%d objects, %d counters\n", len(totalObject), totalCounters)
}

func readDefaults(dirs []string) (map[string]objectMap, error) {
defaults := make(map[string]objectMap)

Expand Down