-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: keyperf collector templates (#3194)
* feat: keyperf collector templates * feat: address review comments * feat: add slogx error
- Loading branch information
1 parent
d230760
commit 9d28189
Showing
19 changed files
with
464 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
objects: | ||
node: | ||
counter_definitions: | ||
- name: statistics.processor_utilization_raw | ||
type: percent | ||
base_counter: statistics.processor_utilization_base | ||
- name: statistics.processor_utilization_base | ||
type: delta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package keyperf | ||
|
||
import ( | ||
"gopkg.in/yaml.v3" | ||
"log/slog" | ||
"os" | ||
) | ||
|
||
type CounterDefinition struct { | ||
Name string `yaml:"name"` | ||
Type string `yaml:"type"` | ||
BaseCounter string `yaml:"base_counter,omitempty"` | ||
} | ||
|
||
type ObjectCounters struct { | ||
CounterDefinitions map[string]CounterDefinition `yaml:"-"` | ||
} | ||
|
||
type Object struct { | ||
CounterDefinitions []CounterDefinition `yaml:"counter_definitions"` | ||
} | ||
|
||
type StaticCounterDefinitions struct { | ||
Objects map[string]Object `yaml:"objects"` | ||
} | ||
|
||
func loadStaticCounterDefinitions(object string, filePath string, logger *slog.Logger) (ObjectCounters, error) { | ||
var staticDefinitions StaticCounterDefinitions | ||
var objectCounters ObjectCounters | ||
|
||
data, err := os.ReadFile(filePath) | ||
if err != nil { | ||
return objectCounters, err | ||
} | ||
|
||
err = yaml.Unmarshal(data, &staticDefinitions) | ||
if err != nil { | ||
return objectCounters, err | ||
} | ||
|
||
if obj, exists := staticDefinitions.Objects[object]; exists { | ||
allCounterDefs := make(map[string]CounterDefinition) | ||
for _, def := range obj.CounterDefinitions { | ||
allCounterDefs[def.Name] = def | ||
} | ||
|
||
objectCounters.CounterDefinitions = make(map[string]CounterDefinition) | ||
for _, def := range obj.CounterDefinitions { | ||
if def.Type == "" { | ||
logger.Error("Missing type in counter definition", slog.String("filePath", filePath), slog.String("counterName", def.Name)) | ||
continue | ||
} | ||
if def.BaseCounter != "" { | ||
if _, baseCounterExists := allCounterDefs[def.BaseCounter]; !baseCounterExists { | ||
logger.Error("Base counter definition not found", slog.String("filePath", filePath), slog.String("counterName", def.Name), slog.String("baseCounter", def.BaseCounter)) | ||
continue | ||
} | ||
} | ||
objectCounters.CounterDefinitions[def.Name] = def | ||
} | ||
return objectCounters, nil | ||
} | ||
|
||
return objectCounters, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Aggregate | ||
query: api/storage/aggregates | ||
object: aggr | ||
|
||
counters: | ||
- ^^uuid => uuid | ||
- ^name => aggr | ||
- ^node.name => node | ||
- ^statistics.status => status | ||
- statistics.iops_raw.other => other_ops | ||
- statistics.iops_raw.read => read_ops | ||
- statistics.iops_raw.total => total_ops | ||
- statistics.iops_raw.write => write_ops | ||
- statistics.latency_raw.other => other_latency | ||
- 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.total => total_data | ||
- statistics.throughput_raw.write => write_data | ||
- statistics.timestamp(timestamp) => timestamp | ||
- hidden_fields: | ||
- statistics | ||
|
||
|
||
export_options: | ||
instance_keys: | ||
- aggr | ||
- node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: CIFSvserver | ||
query: api/protocols/cifs/services | ||
object: svm_cifs | ||
|
||
counters: | ||
- ^^svm.uuid => uuid | ||
- ^statistics.status => status | ||
- ^svm.name => svm | ||
- statistics.iops_raw.other => other_ops | ||
- statistics.iops_raw.read => read_ops | ||
- statistics.iops_raw.total => total_ops | ||
- statistics.iops_raw.write => write_ops | ||
- statistics.latency_raw.other => other_latency | ||
- 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 | ||
- hidden_fields: | ||
- statistics | ||
|
||
|
||
export_options: | ||
instance_keys: | ||
- svm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Cluster | ||
query: api/cluster | ||
object: cluster | ||
|
||
counters: | ||
- ^^uuid => uuid | ||
- ^statistics.status => status | ||
- statistics.iops_raw.other => other_ops | ||
- statistics.iops_raw.read => read_ops | ||
- statistics.iops_raw.total => total_ops | ||
- statistics.iops_raw.write => write_ops | ||
- statistics.latency_raw.other => other_latency | ||
- 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.total => total_data | ||
- statistics.throughput_raw.write => write_data | ||
- statistics.timestamp(timestamp) => timestamp | ||
- hidden_fields: | ||
- statistics | ||
|
||
|
||
export_options: | ||
instance_keys: | ||
- uuid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: ISCSISvm | ||
query: api/protocols/san/iscsi/services | ||
object: iscsi_svm | ||
|
||
counters: | ||
- ^^svm.name => svm | ||
- ^statistics.status => status | ||
- ^target.name => target | ||
- statistics.iops_raw.other => other_ops | ||
- statistics.iops_raw.read => read_ops | ||
- statistics.iops_raw.total => total_ops | ||
- statistics.iops_raw.write => write_ops | ||
- statistics.latency_raw.other => other_latency | ||
- statistics.latency_raw.read => read_latency | ||
- statistics.latency_raw.total => total_latency | ||
- statistics.latency_raw.write => write_latency | ||
- statistics.throughput_raw.read => read_data | ||
- statistics.throughput_raw.total => total_data | ||
- statistics.throughput_raw.write => write_data | ||
- statistics.timestamp(timestamp) => timestamp | ||
- hidden_fields: | ||
- statistics | ||
|
||
export_options: | ||
instance_keys: | ||
- svm | ||
- target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: LIF | ||
query: api/network/ip/interfaces | ||
object: lif | ||
|
||
counters: | ||
- ^^uuid | ||
- ^location.node.name => node | ||
- ^location.port.name => port | ||
- ^name => lif | ||
- ^statistics.status => status | ||
- ^svm.name => svm | ||
- statistics.throughput_raw.read => sent_data | ||
- statistics.throughput_raw.total => total_data | ||
- statistics.throughput_raw.write => recv_data | ||
- statistics.timestamp(timestamp) => timestamp | ||
- hidden_fields: | ||
- statistics | ||
|
||
|
||
export_options: | ||
instance_keys: | ||
- lif | ||
- node | ||
- port | ||
- svm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Lun | ||
query: api/storage/luns | ||
object: lun | ||
|
||
counters: | ||
- ^^uuid => uuid | ||
- ^location.volume.name => volume | ||
- ^name => path | ||
- ^statistics.status => status | ||
- ^svm.name => svm | ||
- statistics.iops_raw.other => other_ops | ||
- statistics.iops_raw.read => read_ops | ||
- statistics.iops_raw.total => total_ops | ||
- statistics.iops_raw.write => write_ops | ||
- statistics.latency_raw.other => other_latency | ||
- statistics.latency_raw.read => avg_read_latency | ||
- statistics.latency_raw.total => total_latency | ||
- statistics.latency_raw.write => avg_write_latency | ||
- statistics.throughput_raw.other => other_data | ||
- statistics.throughput_raw.read => read_data | ||
- statistics.throughput_raw.total => total_data | ||
- statistics.throughput_raw.write => write_data | ||
- statistics.timestamp(timestamp) => timestamp | ||
- hidden_fields: | ||
- statistics | ||
|
||
|
||
plugins: | ||
LabelAgent: | ||
split_regex: | ||
- path `^/[^/]+/([^/]+)(?:/.*?|)/([^/]+)$` volume,lun | ||
- path `^([^/]+)$` lun | ||
|
||
export_options: | ||
instance_keys: | ||
- lun | ||
- svm | ||
- volume |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Namespace | ||
query: api/storage/namespaces | ||
object: namespace | ||
|
||
counters: | ||
- ^^uuid => uuid | ||
- ^name => path | ||
- ^statistics.status => status | ||
- ^svm.name => svm | ||
- statistics.iops_raw.other => other_ops | ||
- statistics.iops_raw.read => read_ops | ||
- statistics.iops_raw.total => total_ops | ||
- statistics.iops_raw.write => write_ops | ||
- statistics.latency_raw.other => avg_other_latency | ||
- statistics.latency_raw.read => avg_read_latency | ||
- statistics.latency_raw.total => avg_total_latency | ||
- statistics.latency_raw.write => avg_write_latency | ||
- statistics.throughput_raw.other => other_data | ||
- statistics.throughput_raw.read => read_data | ||
- statistics.throughput_raw.total => total_data | ||
- statistics.throughput_raw.write => write_data | ||
- statistics.timestamp(timestamp) => timestamp | ||
- hidden_fields: | ||
- statistics | ||
|
||
plugins: | ||
LabelAgent: | ||
split: | ||
- path `/` ,,volume,namespace | ||
|
||
export_options: | ||
instance_keys: | ||
- namespace | ||
- path | ||
- svm | ||
- volume |
Oops, something went wrong.