Remove Repo CPU runtime stat logging (#1186)

Co-authored-by: Azeem Shaikh <azeems@google.com>
This commit is contained in:
Azeem Shaikh 2021-10-29 00:37:44 -04:00 committed by GitHub
parent 1db0f9745f
commit 138552848d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 0 additions and 47 deletions

View File

@ -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)

View File

@ -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, "")

View File

@ -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)
)

View File

@ -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")
)

View File

@ -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",