Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add grpc query nums metrics #1090

Merged
merged 2 commits into from
Jul 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions proxy/src/grpc/sql_query.rs
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ const STREAM_QUERY_CHANNEL_LEN: usize = 20;

impl<Q: QueryExecutor + 'static> Proxy<Q> {
pub async fn handle_sql_query(&self, ctx: Context, req: SqlQueryRequest) -> SqlQueryResponse {
GRPC_HANDLER_COUNTER_VEC.query.inc();
self.hotspot_recorder.inc_sql_query_reqs(&req).await;
match self.handle_sql_query_internal(ctx, req).await {
Err(e) => {
@@ -80,6 +81,7 @@ impl<Q: QueryExecutor + 'static> Proxy<Q> {
ctx: Context,
req: SqlQueryRequest,
) -> BoxStream<'static, SqlQueryResponse> {
GRPC_HANDLER_COUNTER_VEC.stream_query.inc();
self.hotspot_recorder.inc_sql_query_reqs(&req).await;
match self.clone().handle_stream_query_internal(ctx, req).await {
Err(e) => stream::once(async {
2 changes: 2 additions & 0 deletions proxy/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -12,8 +12,10 @@ make_auto_flush_static_metric! {
write_failed,
query_succeeded,
query_failed,
query,
stream_query_succeeded,
stream_query_failed,
stream_query,
write_succeeded_row,
write_failed_row,
query_succeeded_row,
3 changes: 1 addition & 2 deletions server/src/grpc/metrics.rs
Original file line number Diff line number Diff line change
@@ -38,8 +38,7 @@ make_auto_flush_static_metric! {
pub label_enum RemoteEngineGrpcTypeKind {
write_succeeded,
write_failed,
query_succeeded,
query_failed,
stream_query,
stream_query_succeeded,
stream_query_failed,
write_succeeded_row,
1 change: 1 addition & 0 deletions server/src/grpc/remote_engine_service/mod.rs
Original file line number Diff line number Diff line change
@@ -235,6 +235,7 @@ impl<Q: QueryExecutor + 'static> RemoteEngineService for RemoteEngineServiceImpl
&self,
request: Request<ReadRequest>,
) -> std::result::Result<Response<Self::ReadStream>, Status> {
REMOTE_ENGINE_GRPC_HANDLER_COUNTER_VEC.stream_query.inc();
match self.stream_read_internal(request).await {
Ok(stream) => {
let new_stream: Self::ReadStream = Box::pin(stream.map(|res| match res {