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

feat: add keyperf metric docs #3240

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
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
42 changes: 35 additions & 7 deletions cmd/tools/generate/counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ var (
"security_ssh": "cluster_ssh_server",
"namespace": "nvme_namespace",
"fcp": "fc_port",
"svm_cifs": "cifs_service",
"svm_nfs": "nfs_service",
"lif": "ip_interface",
}
swaggerBytes []byte
excludePerfTemplates = map[string]struct{}{
Expand Down Expand Up @@ -278,12 +281,30 @@ func processRestCounters(dir string, client *rest.Client) map[string]Counter {
})

restCounters := visitRestTemplates(filepath.Join(dir, "conf", "rest"), client, func(path string, client *rest.Client) map[string]Counter { // revive:disable-line:unused-parameter
return processRestConfigCounters(path)
return processRestConfigCounters(path, "REST")
})

keyPerfCounters := visitRestTemplates(filepath.Join(dir, "conf", "keyperf"), client, func(path string, client *rest.Client) map[string]Counter { // revive:disable-line:unused-parameter
return processRestConfigCounters(path, "KeyPerf")
})

for k, v := range restPerfCounters {
restCounters[k] = v
}

keyPerfKeys := slices.Sorted(maps.Keys(keyPerfCounters))
for _, k := range keyPerfKeys {
if strings.Contains(k, "timestamp") || strings.Contains(k, "labels") {
continue
}
v := keyPerfCounters[k]
if v1, ok := restCounters[k]; !ok {
restCounters[k] = v
} else {
v1.APIs = append(v1.APIs, v.APIs...)
restCounters[k] = v1
}
}
return restCounters
}

Expand Down Expand Up @@ -358,7 +379,7 @@ func handleZapiCounter(path []string, content string, object string) (string, st
}

// processRestConfigCounters process Rest config templates
func processRestConfigCounters(path string) map[string]Counter {
func processRestConfigCounters(path string, api string) map[string]Counter {
var (
counters = make(map[string]Counter)
)
Expand All @@ -383,7 +404,7 @@ func processRestConfigCounters(path string) map[string]Counter {

if templateCounters != nil {
metricLabels, labels = getAllExportedLabels(t, templateCounters.GetAllChildContentS())
processCounters(templateCounters.GetAllChildContentS(), &model, path, model.Query, counters, metricLabels)
processCounters(templateCounters.GetAllChildContentS(), &model, path, model.Query, counters, metricLabels, api)
// This is for object_labels metrics
harvestName := model.Object + "_" + "labels"
counters[harvestName] = Counter{Name: harvestName, Labels: labels}
Expand All @@ -398,7 +419,7 @@ func processRestConfigCounters(path string) map[string]Counter {
query = line.GetContentS()
}
if line.GetNameS() == "counters" {
processCounters(line.GetAllChildContentS(), &model, path, query, counters, metricLabels)
processCounters(line.GetAllChildContentS(), &model, path, query, counters, metricLabels, api)
}
}
}
Expand All @@ -411,7 +432,7 @@ func processRestConfigCounters(path string) map[string]Counter {
Name: model.Object + "_" + metric.Name,
APIs: []MetricDef{
{
API: "REST",
API: api,
Endpoint: model.Query,
Template: path,
ONTAPCounter: metric.Source,
Expand All @@ -423,10 +444,17 @@ func processRestConfigCounters(path string) map[string]Counter {
}
}

if api == "KeyPerf" {
// handling for templates with common object names
if specialPerfObjects[model.Object] {
return specialHandlingPerfCounters(counters, model)
}
}

return counters
}

func processCounters(counterContents []string, model *template2.Model, path, query string, counters map[string]Counter, metricLabels []string) {
func processCounters(counterContents []string, model *template2.Model, path, query string, counters map[string]Counter, metricLabels []string, api string) {
for _, c := range counterContents {
if c == "" {
continue
Expand All @@ -444,7 +472,7 @@ func processCounters(counterContents []string, model *template2.Model, path, que
Description: description,
APIs: []MetricDef{
{
API: "REST",
API: api,
Endpoint: query,
Template: path,
ONTAPCounter: name,
Expand Down
1 change: 0 additions & 1 deletion conf/keyperf/9.15.0/cifs_vserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ counters:
- statistics.latency_raw.read => read_latency
- statistics.latency_raw.total => total_latency
- statistics.latency_raw.write => write_latency
- statistics.throughput_raw.other => other_data
- statistics.throughput_raw.read => read_data
- statistics.throughput_raw.write => write_data
- statistics.timestamp(timestamp) => timestamp
Expand Down
39 changes: 0 additions & 39 deletions conf/keyperf/9.15.0/lun.yaml

This file was deleted.

38 changes: 0 additions & 38 deletions conf/keyperf/9.15.0/namespace.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions conf/keyperf/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ objects:
CIFSvserver: cifs_vserver.yaml
Cluster: cluster.yaml
LIF: lif.yaml
Lun: lun.yaml
Namespace: namespace.yaml
NFSv3: nfsv3.yaml
NFSv41: nfsv4_1.yaml
NFSv4: nfsv4.yaml
Expand Down
Loading