Documentation
¶
Index ¶
- func QueryCustomMetrics(ctx context.Context, db RowQuerier, sqlQuery string, args ...any) ([]*scrapper.CustomMetricsRow, error)
- func QueryShape(ctx context.Context, db RowQuerier, sql string) ([]*scrapper.QueryShapeColumn, error)
- func RunRawQuery(ctx context.Context, db RowQuerier, sqlQuery string) (scrapper.RawQueryRowIterator, error)
- type RawDB
- type RowQuerier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QueryCustomMetrics ¶
func QueryCustomMetrics(ctx context.Context, db RowQuerier, sqlQuery string, args ...any) ([]*scrapper.CustomMetricsRow, error)
func QueryShape ¶ added in v0.8.3
func QueryShape(ctx context.Context, db RowQuerier, sql string) ([]*scrapper.QueryShapeColumn, error)
func RunRawQuery ¶ added in v0.13.7
func RunRawQuery(ctx context.Context, db RowQuerier, sqlQuery string) (scrapper.RawQueryRowIterator, error)
RunRawQuery executes sqlQuery and returns an iterator over typed rows. The iterator must be Close()'d by the caller; it also auto-closes on io.EOF.
Unlike QueryCustomMetrics this path preserves every column: segment* names are not sidelined, and string columns come back as StringValue rather than being re-parsed and collapsed to IgnoredValue. Unknown driver types fall back to StringValue(fmt.Sprint(v)) so nothing is silently dropped.
Types ¶
type RawDB ¶ added in v0.11.0
RawDB wraps a *sqlx.DB to satisfy RowQuerier without any enrichment. Use this only in tests; production code should pass an executor.
type RowQuerier ¶ added in v0.11.0
type RowQuerier interface {
QueryRows(ctx context.Context, q string, args ...interface{}) (*sqlx.Rows, error)
}
RowQuerier is the minimal interface for executing queries that return rows. It is satisfied by all StdSqlExecutor implementations (which add SQL comment enrichment, query tagging, and stats collection) and by RawDB for tests.