PromQLEngine { public Query newInstantQuery(String qs, Instant time) { Expr expr = Parser.parseExpr(qs); Query qry = newQuery(expr, time, time, Duration.ZERO); qry.setQ(qs); return qry; } PromQLEngine(Storage storage);  PromQLEngine(Storage storage, EngineOptions options); Query newInstantQuery(String qs, Instant time); Query newRangeQuery(String qs, Instant start, Instant end, Duration interval); Value exec(Query query); Storage getStorage();  }
@Test public void newInstantQuery() { String promql = "sum_over_time(jvm.gc.young.count{app=\"lookout-gateway\"}[60s])"; Query query = engine.newInstantQuery(promql, Instant.parse("2019-05-29T10:29:30Z")); Assert.assertNotNull(query); String q = query.getQ(); Assert.assertEquals(promql, q); Statement statement = query.getStmt(); Assert.assertNotNull(statement); Assert.assertTrue(statement instanceof EvalStmt); EvalStmt evalStmt = (EvalStmt) statement; Assert.assertEquals(0, evalStmt.getInterval().getSeconds()); }