diff --git a/internal/sqlquery/db_client_test.go b/internal/sqlquery/db_client_test.go index 4546886b0ec0..9b149979a943 100644 --- a/internal/sqlquery/db_client_test.go +++ b/internal/sqlquery/db_client_test.go @@ -70,7 +70,7 @@ func TestDBSQLClient_Nulls(t *testing.T) { } rows, err := cl.QueryRows(context.Background()) assert.Error(t, err) - assert.True(t, errors.Is(err, errNullValueWarning)) + assert.True(t, errors.Is(err, ErrNullValueWarning)) assert.Len(t, rows, 1) assert.EqualValues(t, map[string]string{ "col_0": "42", @@ -96,7 +96,7 @@ func TestDBSQLClient_Nulls_MultiRow(t *testing.T) { assert.Len(t, uw, 2) for _, err := range uw { - assert.True(t, errors.Is(err, errNullValueWarning)) + assert.True(t, errors.Is(err, ErrNullValueWarning)) } } assert.Len(t, rows, 2) diff --git a/internal/sqlquery/row_scanner.go b/internal/sqlquery/row_scanner.go index 9ed0711dc97e..bfda8aab270e 100644 --- a/internal/sqlquery/row_scanner.go +++ b/internal/sqlquery/row_scanner.go @@ -12,7 +12,7 @@ import ( "go.uber.org/multierr" ) -var errNullValueWarning = errors.New("NULL value") +var ErrNullValueWarning = errors.New("NULL value") type rowScanner struct { cols map[string]func() (string, error) @@ -28,7 +28,7 @@ func newRowScanner(colTypes []colType) *rowScanner { var v any rs.cols[colName] = func() (string, error) { if v == nil { - return "", errNullValueWarning + return "", ErrNullValueWarning } format := "%v" if t, isTime := v.(time.Time); isTime { diff --git a/internal/sqlquery/scraper.go b/internal/sqlquery/scraper.go index 9db99d6ea198..31eafbef2161 100644 --- a/internal/sqlquery/scraper.go +++ b/internal/sqlquery/scraper.go @@ -71,7 +71,7 @@ func (s *Scraper) Scrape(ctx context.Context) (pmetric.Metrics, error) { out := pmetric.NewMetrics() rows, err := s.Client.QueryRows(ctx) if err != nil { - if errors.Is(err, errNullValueWarning) { + if errors.Is(err, ErrNullValueWarning) { s.Logger.Warn("problems encountered getting metric rows", zap.Error(err)) } else { return out, fmt.Errorf("Scraper: %w", err)