Repository navigation
Conversation
74a8251 to
df43ab8
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #6304 +/- ##
==========================================
+ Coverage 56.99% 57.16% +0.16%
==========================================
Files 225 225
Lines 23494 23668 +174
==========================================
+ Hits 13391 13530 +139
- Misses 10100 10135 +35
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| GCS clients.CloudStorage | ||
| GCSProvider clients.CloudStorageProvider |
There was a problem hiding this comment.
I feel like having both of these is a little odd.
Either have, like VulnBucket and CVEConversionBucket as both clients.CloudStorage, or just have the one GCSProvider
| } | ||
|
|
||
| func (c *Collector) sourcePrefixesAndLastUpdated(ctx context.Context) ([]sourcePrefixes, map[string]time.Time) { | ||
| func (c *Collector) sourcePrefixesAndLastUpdated(ctx context.Context) ([]sourcePrefixes, map[string]time.Time, string) { |
There was a problem hiding this comment.
maybe combine these return values into a struct so we don't have this mysterious string being returned
(or at least add a comment)
There was a problem hiding this comment.
Actually, tbh since it's only used as a fallback when OSV_CVE_CONVERSION_BUCKET isn't set (and there's a default value if that also fails), I'm not sure how much value grabbing the bucket name like this is
| if bucketName == "" { | ||
| bucketName = "osv-test-cve-osv-conversion" | ||
| } |
There was a problem hiding this comment.
IMO, we should fall back to not collecting data (e.g. the private instance wouldn't have a CVE conversion pipeline)
| for _, conv := range converters { | ||
| summaryPath := conv.outcomesPrefix + "/conversion-summary.json" | ||
| data, err := bkt.ReadObject(ctx, summaryPath) | ||
| if err == nil { |
There was a problem hiding this comment.
I would refactor this so the expected path isn't within the if block:
if errors.Is(err, clients.ErrNotFound) {
// Fallback to latest outcomes CSV if conversion-summary.json has not been generated yet.
c.collectCVEOutcomesFromLatestCSV(ctx, bkt, conv.name, conv.outcomesPrefix)
continue
}
if err != nil {
// ...
continue
}
var summary conversionSummaryPayload
// ...
Overview
Implements Dashboard 4 (
4. CVE & Feed Conversions) for Plutonov7.5.52(schemaVersion: 27), completing the 4-dashboard MVP observability suite described in the monitoring design:conversion-summary.jsonandcna-scorecards.jsonreports fromvulnfeeds/(cve5andnvd).osv_cve_*Prometheus gauges ingo/cmd/custommetrics.deployment/clouddeploy/gke-workers/base/monitoring/dashboards/cve-feed-conversions.jsonand wires it intohome.jsonandbase/monitoring/kustomization.yaml.Details
vulnfeeds/Telemetry:ConductAnalysisAndUpload(vulnfeeds/conversion/common.go),nvdconverter (vulnfeeds/conversion/nvd/converter.go,vulnfeeds/cmd/converters/cve/nvd-cve-osv/main.go), andvulnfeeds/models/metrics.go(CNAScorecard,ConversionSummaryReport) to track conversion outcomes, range extraction sources, OSV reference types, resolved/unresolved range counts, and top Assigner CNA scorecards.custommetrics& GMP Metrics (go/):osv_cve_conversion_outcomes,osv_cve_range_sources,osv_cve_reference_types,osv_cve_resolved_ranges, andosv_cve_cna_outcomesingo/internal/metrics/metrics.go.go/cmd/custommetricsto pollconversion-summary.json(with CSV fallback and stale label cleanup) fromOSV_CVE_CONVERSION_BUCKET(osv-test-cve-osv-conversioninoss-vdb-test,cve-osv-conversioninoss-vdb).v7.5.52Dashboard (base/monitoring/):cve-feed-conversions.jsontoschemaVersion: 27(stat,gauge,bargauge,graph, andmerge+organizetable), deduplicated singleton gauges (max without (instance, pod)) and KSM job metrics (max by (cronjob, job_name)), added$gmp_datasource(Environment) +$convertervariables, and enabled the Dashboard 4 card & directory link inhome.json.Testing
go/cmd/custommetrics/collector_test.goandvulnfeeds/conversion/common_test.go(go test -count=1 ./cmd/custommetrics/... ./internal/metrics/...,go test -count=1 -run TestConductAnalysisAndUpload ./conversion/..., andgolangci-lintacross both modules:0issues).kubectl kustomizeacrossoss-vdb-test,oss-vdb/monitoring, andprivate.