File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed
src/query/service/src/interpreters Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change 1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- use std:: time:: Duration ;
1615use std:: time:: SystemTime ;
17- use std:: time:: UNIX_EPOCH ;
1816
1917use databend_common_config:: GlobalConfig ;
2018use databend_common_exception:: ErrorCode ;
@@ -47,9 +45,10 @@ impl InterpreterMetrics {
4745 }
4846
4947 fn record_query_detail ( ctx : & QueryContext , labels : & Vec < ( & ' static str , String ) > ) {
50- let event_time = convert_query_timestamp ( SystemTime :: now ( ) ) ;
51- let query_start_time = convert_query_timestamp ( ctx. get_created_time ( ) ) ;
52- let query_duration_ms = ( event_time - query_start_time) as f64 / 1_000.0 ;
48+ let query_duration_ms = SystemTime :: now ( )
49+ . duration_since ( ctx. get_created_time ( ) )
50+ . map ( |d| d. as_micros ( ) as f64 / 1000.0 )
51+ . unwrap_or ( 0.0 ) ;
5352
5453 let data_metrics = ctx. get_data_metrics ( ) ;
5554
@@ -129,9 +128,3 @@ impl InterpreterMetrics {
129128 } ;
130129 }
131130}
132-
133- fn convert_query_timestamp ( time : SystemTime ) -> u128 {
134- time. duration_since ( UNIX_EPOCH )
135- . unwrap_or ( Duration :: new ( 0 , 0 ) )
136- . as_micros ( )
137- }
You can’t perform that action at this time.
0 commit comments