Skip to content

Commit

Permalink
remove chatty spans
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
  • Loading branch information
matthyx committed Mar 24, 2023
1 parent ca23485 commit 910328f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
10 changes: 2 additions & 8 deletions adapters/v1/grype.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ func NewGrypeAdapter() *GrypeAdapter {

// DBVersion returns the vulnerabilities DB checksum which is used to tag CVE manifests
func (g *GrypeAdapter) DBVersion(ctx context.Context) string {
_, span := otel.Tracer("").Start(ctx, "GrypeAdapter.DBVersion")
defer span.End()

g.mu.RLock()
defer g.mu.RUnlock()

Expand All @@ -67,9 +64,6 @@ func (g *GrypeAdapter) DBVersion(ctx context.Context) string {

// Ready returns the status of the vulnerabilities DB
func (g *GrypeAdapter) Ready(ctx context.Context) bool {
ctx, span := otel.Tracer("").Start(ctx, "GrypeAdapter.Ready")
defer span.End()

// DB update is in progress
if !g.mu.TryRLock() {
return false
Expand All @@ -80,6 +74,8 @@ func (g *GrypeAdapter) Ready(ctx context.Context) bool {
if g.dbStatus == nil || now.Sub(g.lastDbUpdate) > 24*time.Hour {
g.mu.Lock()
defer g.mu.Unlock()
ctx, span := otel.Tracer("").Start(ctx, "GrypeAdapter.UpdateDB")
defer span.End()
logger.L().Info("updating grype DB")
var err error
g.store, g.dbStatus, g.dbCloser, err = grype.LoadVulnerabilityDB(g.dbConfig, true)
Expand Down Expand Up @@ -176,7 +172,5 @@ func getMatchers() []matcher.Matcher {

// Version returns Grype's version which is used to tag CVE manifests
func (g *GrypeAdapter) Version(ctx context.Context) string {
_, span := otel.Tracer("").Start(ctx, "GrypeAdapter.Ready")
defer span.End()
return tools.PackageVersion("github.com/anchore/grype")
}
2 changes: 0 additions & 2 deletions adapters/v1/syft.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,5 @@ func (s *SyftAdapter) CreateSBOM(ctx context.Context, imageID string, options do

// Version returns Syft's version which is used to tag SBOMs
func (s *SyftAdapter) Version(ctx context.Context) string {
_, span := otel.Tracer("").Start(ctx, "SyftAdapter.Version")
defer span.End()
return tools.PackageVersion("github.com/anchore/syft")
}
2 changes: 0 additions & 2 deletions core/services/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ func (s *ScanService) GenerateSBOM(ctx context.Context) error {

// Ready proxies the cveScanner's readiness
func (s *ScanService) Ready(ctx context.Context) bool {
ctx, span := otel.Tracer("").Start(ctx, "ScanService.Ready")
defer span.End()
return s.cveScanner.Ready(ctx)
}

Expand Down

0 comments on commit 910328f

Please sign in to comment.