diff --git a/cron/worker/main.go b/cron/worker/main.go index d2e0063e..df085fbe 100644 --- a/cron/worker/main.go +++ b/cron/worker/main.go @@ -144,8 +144,6 @@ func startMetricsExporter() (monitoring.Exporter, error) { if err := view.Register( &stats.CheckRuntime, &stats.CheckErrorCount, - // TODO: Debug high monitoring costs for Stackdriver before re-enabling. - // &stats.RepoRuntime, &stats.OutgoingHTTPRequests, &githubstats.GithubTokens); err != nil { return nil, fmt.Errorf("error during view.Register: %w", err) diff --git a/pkg/scorecard.go b/pkg/scorecard.go index 3fc27806..c835a624 100644 --- a/pkg/scorecard.go +++ b/pkg/scorecard.go @@ -21,23 +21,14 @@ import ( "sync" "time" - opencensusstats "go.opencensus.io/stats" - "go.opencensus.io/tag" - "github.com/ossf/scorecard/v3/checker" "github.com/ossf/scorecard/v3/clients" "github.com/ossf/scorecard/v3/clients/githubrepo" "github.com/ossf/scorecard/v3/clients/localdir" sce "github.com/ossf/scorecard/v3/errors" "github.com/ossf/scorecard/v3/repos" - "github.com/ossf/scorecard/v3/stats" ) -func logStats(ctx context.Context, startTime time.Time) { - runTimeInSecs := time.Now().Unix() - startTime.Unix() - opencensusstats.Record(ctx, stats.RepoRuntimeInSec.M(runTimeInSecs)) -} - func runEnabledChecks(ctx context.Context, repo clients.Repo, checksToRun checker.CheckNameToFnMap, repoClient clients.RepoClient, resultsCh chan checker.CheckResult) { @@ -117,12 +108,6 @@ func RunScorecards(ctx context.Context, repoURI *repos.RepoURI, checksToRun checker.CheckNameToFnMap, repoClient clients.RepoClient) (ScorecardResult, error) { - ctx, err := tag.New(ctx, tag.Upsert(stats.Repo, repoURI.URL())) - if err != nil { - return ScorecardResult{}, sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("tag.New: %v", err)) - } - defer logStats(ctx, time.Now()) - repo, err := createRepo(repoURI) if err != nil { return ScorecardResult{}, sce.WithMessage(err, "") diff --git a/stats/measures.go b/stats/measures.go index d1731c5c..151772fc 100644 --- a/stats/measures.go +++ b/stats/measures.go @@ -22,9 +22,6 @@ var ( stats.UnitSeconds) // CheckErrors measures the count of errors per check. CheckErrors = stats.Int64("CheckErrors", "Measures the count of errors", stats.UnitDimensionless) - // RepoRuntimeInSec measures the CPU runtime in seconds per repo. - RepoRuntimeInSec = stats.Int64("RepoRuntimeInSec", "Measures the CPU runtime in seconds for a repo", - stats.UnitSeconds) // HTTPRequests measures the count of HTTP requests. HTTPRequests = stats.Int64("HTTPRequests", "Measures the count of HTTP requests", stats.UnitDimensionless) ) diff --git a/stats/tags.go b/stats/tags.go index 923731cf..0efb90b1 100644 --- a/stats/tags.go +++ b/stats/tags.go @@ -21,8 +21,6 @@ var ( CheckName = tag.MustNewKey("checkName") // ErrorName is the tag key for errors. ErrorName = tag.MustNewKey("errorName") - // Repo is the tag key for the repo name. - Repo = tag.MustNewKey("repo") // RequestTag is the tag key for the request type. RequestTag = tag.MustNewKey("requestTag") ) diff --git a/stats/views.go b/stats/views.go index 608c6570..ae48f036 100644 --- a/stats/views.go +++ b/stats/views.go @@ -55,31 +55,6 @@ var ( Aggregation: view.Count(), } - // RepoRuntime tracks CPU runtime stats for repos. - RepoRuntime = view.View{ - Name: "RepoRuntime", - Description: "CPU runtime stats per repo", - Measure: RepoRuntimeInSec, - TagKeys: []tag.Key{Repo}, - //nolint:gomnd - Aggregation: view.Distribution( - 0, - 1<<2, - 1<<3, - 1<<4, - 1<<5, - 1<<6, - 1<<7, - 1<<8, - 1<<9, - 1<<10, - 1<<11, - 1<<12, - 1<<13, - 1<<14, - 1<<15), - } - // OutgoingHTTPRequests tracks HTTPRequests made. OutgoingHTTPRequests = view.View{ Name: "OutgoingHTTPRequests",