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

ci: add metric generate docs to CI #3150

Merged
merged 4 commits into from
Sep 16, 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
58 changes: 55 additions & 3 deletions cmd/tools/generate/counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,48 @@ var (
"svm_nfs": true,
"node_nfs": true,
}

knownDescriptionGaps = map[string]struct{}{
"ontaps3_object_count": {},
"security_certificate_expiry_time": {},
"volume_capacity_tier_footprint": {},
"volume_capacity_tier_footprint_percent": {},
"volume_num_compress_attempts": {},
"volume_num_compress_fail": {},
"volume_performance_tier_footprint": {},
"volume_performance_tier_footprint_percent": {},
}

knownMappingGaps = map[string]struct{}{
"aggr_snapshot_inode_used_percent": {},
"aggr_space_reserved": {},
"flexcache_blocks_requested_from_client": {},
"flexcache_blocks_retrieved_from_origin": {},
"flexcache_evict_rw_cache_skipped_reason_disconnected": {},
"flexcache_evict_skipped_reason_config_noent": {},
"flexcache_evict_skipped_reason_disconnected": {},
"flexcache_evict_skipped_reason_offline": {},
"flexcache_invalidate_skipped_reason_config_noent": {},
"flexcache_invalidate_skipped_reason_disconnected": {},
"flexcache_invalidate_skipped_reason_offline": {},
"flexcache_miss_percent": {},
"flexcache_nix_retry_skipped_reason_initiator_retrieve": {},
"flexcache_nix_skipped_reason_config_noent": {},
"flexcache_nix_skipped_reason_disconnected": {},
"flexcache_nix_skipped_reason_in_progress": {},
"flexcache_nix_skipped_reason_offline": {},
"flexcache_reconciled_data_entries": {},
"flexcache_reconciled_lock_entries": {},
"quota_disk_used_pct_threshold": {},
"rw_ctx_cifs_giveups": {},
"rw_ctx_cifs_rewinds": {},
"rw_ctx_nfs_giveups": {},
"rw_ctx_nfs_rewinds": {},
"rw_ctx_qos_flowcontrol": {},
"rw_ctx_qos_rewinds": {},
"security_audit_destination_port": {},
"wafl_reads_from_pmem": {},
}
)

type Counters struct {
Expand Down Expand Up @@ -672,7 +714,9 @@ func generateCounterTemplate(counters map[string]Counter, version [3]int) {

if counter.Description == "" {
for _, def := range counter.APIs {
appendRow(table, "Description", counter, def)
if _, ok := knownDescriptionGaps[counter.Name]; !ok {
appendRow(table, "Description", counter, def)
}
}
}
values = append(values, counter)
Expand All @@ -697,7 +741,9 @@ func generateCounterTemplate(counters map[string]Counter, version [3]int) {
// missing Rest Mapping
if isPrint {
for _, def := range counter.APIs {
appendRow(table, "REST", counter, def)
if _, ok := knownMappingGaps[counter.Name]; !ok {
appendRow(table, "REST", counter, def)
}
}
}
}
Expand All @@ -706,7 +752,9 @@ func generateCounterTemplate(counters map[string]Counter, version [3]int) {
for _, def := range counter.APIs {
if def.ONTAPCounter == "" {
for _, def := range counter.APIs {
appendRow(table, "Mapping", counter, def)
if _, ok := knownMappingGaps[counter.Name]; !ok {
appendRow(table, "Mapping", counter, def)
}
}
}
}
Expand All @@ -726,6 +774,10 @@ func generateCounterTemplate(counters map[string]Counter, version [3]int) {
panic(err)
}
fmt.Printf("Harvest metric documentation generated at %s \n", targetPath)

if table.NumLines() > 0 {
log.Fatalf("Issues found: refer table above")
}
}

func appendRow(table *tw.Table, missing string, counter Counter, def MetricDef) {
Expand Down
11 changes: 11 additions & 0 deletions jenkins/artifacts/jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,17 @@ pipeline {
}
}

stage('Test and Generate Harvest Metrics') {
steps {
script {
def result = sh(script: 'bin/harvest generate metrics --poller dc1 --config /u/mpeg/harvest/harvest.yml', returnStatus: true)
if (result != 0) {
error("Generate Harvest metrics command failed.")
}
}
}
}

stage('Run Tests') {
when {
expression {
Expand Down