diff --git a/wasm_parts/main.go b/wasm_parts/main.go index 0a62032e..1c2bd9ca 100644 --- a/wasm_parts/main.go +++ b/wasm_parts/main.go @@ -18,6 +18,8 @@ import ( "wasm_parts/types" ) +var maxSamples = 5000000 + type ctx struct { onDataLoad func(c *ctx) request []byte @@ -115,7 +117,7 @@ func getEng() *promql.Engine { if eng == nil || engC > 5 { eng = promql.NewEngine(promql.EngineOpts{ Logger: TestLogger{}, - MaxSamples: 100000, + MaxSamples: maxSamples, Timeout: time.Second * 30, ActiveQueryTracker: nil, LookbackDelta: 0, @@ -129,6 +131,11 @@ func getEng() *promql.Engine { return eng } +//export setMaxSamples +func setMaxSamples(maxSpl int) { + maxSamples = maxSpl +} + //export stats func stats() { fmt.Printf("Allocated data: %d\n", len(data)) diff --git a/wasm_parts/main.js b/wasm_parts/main.js index 8901bf31..c4cf46d8 100644 --- a/wasm_parts/main.js +++ b/wasm_parts/main.js @@ -22,6 +22,7 @@ const getWasm = (() => { gunzipSync(fs.readFileSync(WASM_URL)), go.importObject) go.run(_wasm.instance) wasm = _wasm.instance + wasm.exports.setMaxSamples(process.env.ADVANCED_PROMETHEUS_MAX_SAMPLES || 5000000) cnt = 0 run = false } diff --git a/wasm_parts/main.wasm.gz b/wasm_parts/main.wasm.gz index cf02a026..300d4ed7 100644 Binary files a/wasm_parts/main.wasm.gz and b/wasm_parts/main.wasm.gz differ