@@ -12,6 +12,8 @@ import (
1212 "github.com/jackc/pgx/v5/log/testingadapter"
1313 "github.com/jackc/pgx/v5/pgxpool"
1414 "github.com/jackc/pgx/v5/tracelog"
15+ "go.opentelemetry.io/otel/attribute"
16+ "go.opentelemetry.io/otel/trace"
1517
1618 "github.com/quay/claircore/datastore/postgres/migrations"
1719 "github.com/quay/claircore/datastore/postgres/types"
@@ -23,6 +25,8 @@ import (
2325//
2426// If any errors are encountered, the test is failed and exited.
2527func TestMatcherDB (ctx context.Context , t testing.TB ) * pgxpool.Pool {
28+ ctx , span := tracer .Start (ctx , "TestMatcherDB" )
29+ defer span .End ()
2630 return testDB (ctx , t , dbMatcher )
2731}
2832
@@ -31,6 +35,8 @@ func TestMatcherDB(ctx context.Context, t testing.TB) *pgxpool.Pool {
3135//
3236// If any errors are encountered, the test is failed and exited.
3337func TestIndexerDB (ctx context.Context , t testing.TB ) * pgxpool.Pool {
38+ ctx , span := tracer .Start (ctx , "TestIndexerDB" )
39+ defer span .End ()
3440 return testDB (ctx , t , dbIndexer )
3541}
3642
@@ -93,6 +99,7 @@ var extraSQL embed.FS
9399// The "flavor" argument selects which prefix is added onto the file glob.
94100func loadHelpers (ctx context.Context , t testing.TB , pool * pgxpool.Pool , flavor dbFlavor ) {
95101 t .Helper ()
102+ span := trace .SpanFromContext (ctx )
96103 logprefix := [... ]string {"global" , "local" }
97104 var look []fs.FS
98105 if sys , err := fs .Sub (extraSQL , "sql" ); err != nil {
@@ -104,6 +111,7 @@ func loadHelpers(ctx context.Context, t testing.TB, pool *pgxpool.Pool, flavor d
104111 // is a helper library, this is different than you may expect.
105112 if sys , err := fs .Sub (os .DirFS ("." ), "testdata" ); err != nil {
106113 t .Log ("no testdata directory, skipping local loading" )
114+ span .AddEvent (`skip_local` )
107115 } else {
108116 look = append (look , sys )
109117 }
@@ -126,6 +134,7 @@ func loadHelpers(ctx context.Context, t testing.TB, pool *pgxpool.Pool, flavor d
126134 if err != nil {
127135 panic (fmt .Sprintf ("programmer error: %v" , err ))
128136 }
137+ span .AddEvent (`load_sql` , trace .WithAttributes (attribute .StringSlice (`files` , ms )))
129138 for _ , f := range ms {
130139 b , err := fs .ReadFile (sys , f )
131140 if err != nil {
0 commit comments