Documentation
¶
Overview ¶
Package search provides a k6 extension for benchmarking search backends.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backends ¶
type Backends struct {
Metrics *metrics.Collector `js:"metrics"`
// contains filtered or unexported fields
}
Backends holds all configured backend clients.
func (*Backends) AddDockerMetricsCollector ¶
func (b *Backends) AddDockerMetricsCollector(call sobek.FunctionCall) sobek.Value
AddDockerMetricsCollector adds a metrics_collector scenario to the given scenarios object. Pass a Timer or a duration string (e.g. "500s"). Returns a function that the script should export as collectMetrics:
export const collectMetrics = backends.addDockerMetricsCollector(scenarios, timer);
func (*Backends) Close ¶
func (b *Backends) Close()
Close closes all backend connections. Use this at the end of a test or between groups to clean up connections.
func (*Backends) Collect ¶
Collect collects metrics from all enabled containers. Includes a 500ms sleep to avoid polling too frequently.
func (*Backends) SetTimeout ¶
SetTimeout sets the query timeout for all backends in seconds. Use 0 to disable timeout (default).
type ModuleInstance ¶
type ModuleInstance struct {
// contains filtered or unexported fields
}
ModuleInstance represents an instance of the module for a single VU.
func (*ModuleInstance) Exports ¶
func (m *ModuleInstance) Exports() modules.Exports
Exports returns the exports of the module.
type RootModule ¶
type RootModule struct{}
RootModule is the global module instance that will create client instances for each VU.
func (*RootModule) NewModuleInstance ¶
func (*RootModule) NewModuleInstance(vu modules.VU) modules.Instance
NewModuleInstance creates a new instance of the module for each VU.
type Terms ¶
type Terms struct {
// contains filtered or unexported fields
}
Terms provides sequential and random access to a list of search terms.
db.terms(JSON.parse(open("./terms.json")))
db.terms(allTerms.filter(t => !t.includes(" ")))
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer manages scenario timing for sequential benchmark phases. Create with search.timer({ duration: "30s", gap: "2s" }).
func (*Timer) AdvanceAndGet ¶
AdvanceAndGet advances to the next phase and returns the startTime string.
func (*Timer) Get ¶
Get returns the current phase startTime without advancing. Use for parallel scenarios that share a phase with the preceding advanceAndGet. Auto-advances on first call if no phase has been started.
func (*Timer) TotalDuration ¶
TotalDuration returns the total covering duration as a string (e.g. "70s").
Directories
¶
| Path | Synopsis |
|---|---|
|
Package backends provides the driver interface and shared infrastructure for search backends.
|
Package backends provides the driver interface and shared infrastructure for search backends. |
|
clickhouse
Package clickhouse provides the ClickHouse driver implementation.
|
Package clickhouse provides the ClickHouse driver implementation. |
|
elasticsearch
Package elasticsearch registers the Elasticsearch backend.
|
Package elasticsearch registers the Elasticsearch backend. |
|
mongodb
Package mongodb provides the MongoDB driver implementation.
|
Package mongodb provides the MongoDB driver implementation. |
|
opensearch
Package opensearch registers the OpenSearch backend.
|
Package opensearch registers the OpenSearch backend. |
|
paradedb
Package paradedb registers the ParadeDB backend.
|
Package paradedb registers the ParadeDB backend. |
|
postgres
Package postgres registers the PostgreSQL backend.
|
Package postgres registers the PostgreSQL backend. |
|
shared/elasticsearch
Package elasticsearch provides the shared Elasticsearch/OpenSearch driver implementation.
|
Package elasticsearch provides the shared Elasticsearch/OpenSearch driver implementation. |
|
shared/postgres
Package postgres provides the shared PostgreSQL driver implementation.
|
Package postgres provides the shared PostgreSQL driver implementation. |
|
cmd
|
|
|
dashboard-viewer
command
Command dashboard-viewer serves saved k6-search dashboard JSON files.
|
Command dashboard-viewer serves saved k6-search dashboard JSON files. |
|
loader
command
Loader CLI for bulk loading data into search backends.
|
Loader CLI for bulk loading data into search backends. |
|
Package dashboard provides a web-based dashboard for k6 search benchmarks.
|
Package dashboard provides a web-based dashboard for k6 search benchmarks. |
|
Package loader provides data loading functionality for k6 benchmarks.
|
Package loader provides data loading functionality for k6 benchmarks. |
|
Package metrics provides container metrics collection via Docker API.
|
Package metrics provides container metrics collection via Docker API. |
