Documentation
¶
Overview ¶
Package search provides a k6 extension for benchmarking search backends.
Index ¶
- type Backends
- func (b *Backends) AddDockerMetricsCollector(call sobek.FunctionCall) sobek.Value
- func (b *Backends) AddMetricsCollector(call sobek.FunctionCall) sobek.Value
- func (b *Backends) Close()
- func (b *Backends) Collect() map[string]interface{}
- func (b *Backends) Get(alias string) *drivers.K6Client
- func (b *Backends) GetAll() []string
- func (b *Backends) SetTimeout(seconds int)
- type ModuleInstance
- type RootModule
- type Terms
- type Timer
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 is retained as a backwards-compatible alias.
func (*Backends) AddMetricsCollector ¶
func (b *Backends) AddMetricsCollector(call sobek.FunctionCall) sobek.Value
AddMetricsCollector adds one dedicated collector VU for Docker and backend-provided database telemetry. Workload scenarios opt into database telemetry with tags: { backend: "alias" }. Returns a function that the script should export as collectMetrics:
export const collectMetrics = backends.addMetricsCollector(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 Docker and backend-provided database telemetry on the dedicated metrics collector VU. Includes a 500ms sleep to avoid polling too frequently when no Docker containers are configured.
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 resolves declarative index/query strategies independently of their database drivers.
|
Package backends resolves declarative index/query strategies independently of their database drivers. |
|
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 drivers provides the driver interface and shared infrastructure for search backends.
|
Package drivers 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 driver.
|
Package elasticsearch registers the Elasticsearch driver. |
|
mongodb
Package mongodb provides the MongoDB driver implementation.
|
Package mongodb provides the MongoDB driver implementation. |
|
opensearch
Package opensearch registers the OpenSearch driver.
|
Package opensearch registers the OpenSearch driver. |
|
postgres
Package postgres registers the PostgreSQL driver.
|
Package postgres registers the PostgreSQL driver. |
|
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. |
|
turbopuffer
Package turbopuffer implements the cloud-only Turbopuffer HTTP backend.
|
Package turbopuffer implements the cloud-only Turbopuffer HTTP backend. |
|
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. |
