MCPcopy
hub / github.com/elastic/go-elasticsearch / NewRunner

Function NewRunner

_benchmarks/benchmarks/runner/runner.go:56–82  ·  view source on GitHub ↗

NewRunner returns new benchmarking runner.

(cfg Config)

Source from the content-addressed store, hash-verified

54
55// NewRunner returns new benchmarking runner.
56func NewRunner(cfg Config) (*Runner, error) {
57 if err := validateConfig(cfg); err != nil {
58 return nil, err
59 }
60
61 if cfg.NumOperations == 0 {
62 cfg.NumOperations = 1
63 }
64
65 indexer, err := esutil.NewBulkIndexer(
66 esutil.BulkIndexerConfig{
67 Client: cfg.ReportClient,
68 Index: statsIndex,
69 FlushBytes: 2e+6,
70 FlushInterval: 15 * time.Second,
71 OnError: func(ctx context.Context, err error) { errs = append(errs, err) },
72 },
73 )
74 if err != nil {
75 return nil, fmt.Errorf("cannot create bulk indexer: %w", err)
76 }
77
78 return &Runner{
79 config: cfg,
80 indexer: indexer,
81 }, nil
82}
83
84// Runner represents the benchmarking runner.
85type Runner struct {

Callers

nothing calls this directly

Calls 2

NewBulkIndexerFunction · 0.92
validateConfigFunction · 0.85

Tested by

no test coverage detected