Skip to content

Commit c6ed86b

Browse files
committed
adds tracing to vulndb ImportRC
1 parent 873bc2a commit c6ed86b

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

vulndb/vulndb_service.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"github.com/l3montree-dev/devguard/shared"
3131
"github.com/sigstore/sigstore/pkg/signature"
3232
"github.com/sigstore/sigstore/pkg/signature/options"
33+
"go.opentelemetry.io/otel/codes"
3334
"golang.org/x/sync/errgroup"
3435
"oras.land/oras-go/v2"
3536
"oras.land/oras-go/v2/content/file"
@@ -318,7 +319,16 @@ func (s *VulnDBService) ExportRC(ctx context.Context) error {
318319
// all data sources (OSV, CISA KEV, exploits, malicious packages) to the database.
319320
// If the integrity check fails after an incremental import, it alerts and retries
320321
// as a full import (ignoring the last-import watermark).
321-
func (s *VulnDBService) ImportRC(ctx context.Context) error {
322+
func (s *VulnDBService) ImportRC(ctx context.Context) (err error) {
323+
ctx, span := vulndbTracer.Start(ctx, "VulnDBService.ImportRC")
324+
defer func() {
325+
if err != nil {
326+
span.RecordError(err)
327+
span.SetStatus(codes.Error, err.Error())
328+
}
329+
span.End()
330+
}()
331+
322332
slog.Info("start vulndb import")
323333
start := time.Now()
324334

0 commit comments

Comments
 (0)