mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-19 14:30:43 +00:00
refactor: bring metrics to http output (#3247)
* refactor: bring metrics to http output * chore: remove unwrap * chore: make walk plan accumulate * chore: change field name and comment * chore: add metrics to http resp header * chore: move PrometheusJsonResponse to a separate file and impl IntoResponse * chore: put metrics in prometheus resp header too
This commit is contained in:
@@ -69,7 +69,7 @@ async fn run_compiled(script: &PyScript) {
|
||||
.await
|
||||
.unwrap();
|
||||
let _res = match output {
|
||||
Output::Stream(s) => common_recordbatch::util::collect_batches(s).await.unwrap(),
|
||||
Output::Stream(s, _) => common_recordbatch::util::collect_batches(s).await.unwrap(),
|
||||
Output::RecordBatches(rbs) => rbs,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
@@ -312,7 +312,7 @@ impl Script for PyScript {
|
||||
.context(DatabaseQuerySnafu)?;
|
||||
let copr = self.copr.clone();
|
||||
match res {
|
||||
Output::Stream(stream) => Ok(Output::Stream(Box::pin(CoprStream::try_new(
|
||||
Output::Stream(stream, _) => Ok(Output::new_stream(Box::pin(CoprStream::try_new(
|
||||
stream, copr, params, ctx,
|
||||
)?))),
|
||||
_ => unreachable!(),
|
||||
@@ -411,7 +411,7 @@ def test(number) -> vector[u32]:
|
||||
.await
|
||||
.unwrap();
|
||||
let res = common_recordbatch::util::collect_batches(match output {
|
||||
Output::Stream(s) => s,
|
||||
Output::Stream(s, _) => s,
|
||||
_ => unreachable!(),
|
||||
})
|
||||
.await
|
||||
@@ -472,7 +472,7 @@ def test(number) -> vector[u32]:
|
||||
.await
|
||||
.unwrap();
|
||||
let res = common_recordbatch::util::collect_batches(match _output {
|
||||
Output::Stream(s) => s,
|
||||
Output::Stream(s, _) => s,
|
||||
_ => todo!(),
|
||||
})
|
||||
.await
|
||||
@@ -504,7 +504,7 @@ def test(a, b, c) -> vector[f64]:
|
||||
.await
|
||||
.unwrap();
|
||||
match output {
|
||||
Output::Stream(stream) => {
|
||||
Output::Stream(stream, _) => {
|
||||
let numbers = util::collect(stream).await.unwrap();
|
||||
|
||||
assert_eq!(1, numbers.len());
|
||||
@@ -542,7 +542,7 @@ def test(a) -> vector[i64]:
|
||||
.await
|
||||
.unwrap();
|
||||
match output {
|
||||
Output::Stream(stream) => {
|
||||
Output::Stream(stream, _) => {
|
||||
let numbers = util::collect(stream).await.unwrap();
|
||||
|
||||
assert_eq!(1, numbers.len());
|
||||
|
||||
@@ -403,7 +403,7 @@ impl PyQueryEngine {
|
||||
Ok(Either::AffectedRows(cnt))
|
||||
}
|
||||
Ok(common_query::Output::RecordBatches(rbs)) => Ok(Either::Rb(rbs)),
|
||||
Ok(common_query::Output::Stream(s)) => Ok(Either::Rb(
|
||||
Ok(common_query::Output::Stream(s, _)) => Ok(Either::Rb(
|
||||
common_recordbatch::util::collect_batches(s).await.unwrap(),
|
||||
)),
|
||||
Err(e) => Err(e),
|
||||
|
||||
@@ -88,7 +88,7 @@ async fn integrated_py_copr_test() {
|
||||
.await
|
||||
.unwrap();
|
||||
let res = match output {
|
||||
Output::Stream(s) => common_recordbatch::util::collect_batches(s).await.unwrap(),
|
||||
Output::Stream(s, _) => common_recordbatch::util::collect_batches(s).await.unwrap(),
|
||||
Output::RecordBatches(rbs) => rbs,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
@@ -231,7 +231,7 @@ impl<E: ErrorExt + Send + Sync + 'static> ScriptsTable<E> {
|
||||
.await
|
||||
.context(ExecuteInternalStatementSnafu)?;
|
||||
let stream = match output {
|
||||
Output::Stream(stream) => stream,
|
||||
Output::Stream(stream, _) => stream,
|
||||
Output::RecordBatches(record_batches) => record_batches.as_stream(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
@@ -286,7 +286,7 @@ impl<E: ErrorExt + Send + Sync + 'static> ScriptsTable<E> {
|
||||
.await
|
||||
.context(ExecuteInternalStatementSnafu)?;
|
||||
let stream = match output {
|
||||
Output::Stream(stream) => stream,
|
||||
Output::Stream(stream, _) => stream,
|
||||
Output::RecordBatches(record_batches) => record_batches.as_stream(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user