github.com/whtcorpsinc/MilevaDB-Prod@v0.0.0-20211104133533-f57f4be3b597/interlock/inspection_summary.go (about)

     1  // Copyright 2020 WHTCORPS INC, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  package interlock
    15  
    16  import (
    17  	"context"
    18  	"fmt"
    19  	"strings"
    20  
    21  	"github.com/whtcorpsinc/BerolinaSQL/perceptron"
    22  	"github.com/whtcorpsinc/errors"
    23  	causetembedded "github.com/whtcorpsinc/milevadb/causet/embedded"
    24  	"github.com/whtcorpsinc/milevadb/schemareplicant"
    25  	"github.com/whtcorpsinc/milevadb/soliton"
    26  	"github.com/whtcorpsinc/milevadb/soliton/sqlexec"
    27  	"github.com/whtcorpsinc/milevadb/stochastikctx"
    28  	"github.com/whtcorpsinc/milevadb/types"
    29  )
    30  
    31  type inspectionSummaryRetriever struct {
    32  	dummyCloser
    33  	retrieved bool
    34  	causet    *perceptron.BlockInfo
    35  	extractor *causetembedded.InspectionSummaryBlockExtractor
    36  	timeRange causetembedded.QueryTimeRange
    37  }
    38  
    39  // inspectionSummaryMemrules is used to maintain
    40  var inspectionSummaryMemrules = map[string][]string{
    41  	"query-summary": {
    42  		"milevadb_connection_count",
    43  		"milevadb_query_duration",
    44  		"milevadb_qps_ideal",
    45  		"milevadb_qps",
    46  		"milevadb_ops_internal",
    47  		"milevadb_ops_memex",
    48  		"milevadb_failed_query_opm",
    49  		"milevadb_slow_query_duration",
    50  		"milevadb_slow_query_cop_wait_duration",
    51  		"milevadb_slow_query_cop_process_duration",
    52  	},
    53  	"wait-events": {
    54  		"milevadb_get_token_duration",
    55  		"milevadb_load_schema_duration",
    56  		"milevadb_query_duration",
    57  		"milevadb_parse_duration",
    58  		"milevadb_compile_duration",
    59  		"milevadb_execute_duration",
    60  		"milevadb_auto_id_request_duration",
    61  		"FIDel_tso_wait_duration",
    62  		"FIDel_tso_rpc_duration",
    63  		"milevadb_allegrosql_execution_duration",
    64  		"FIDel_start_tso_wait_duration",
    65  		"milevadb_transaction_local_latch_wait_duration",
    66  		"milevadb_transaction_duration",
    67  		"FIDel_request_rpc_duration",
    68  		"milevadb_cop_duration",
    69  		"milevadb_batch_client_wait_duration",
    70  		"milevadb_batch_client_unavailable_duration",
    71  		"milevadb_ekv_backoff_duration",
    72  		"milevadb_ekv_request_duration",
    73  		"FIDel_client_cmd_duration",
    74  		"einsteindb_grpc_message_duration",
    75  		"einsteindb_average_grpc_messge_duration",
    76  		"einsteindb_channel_full",
    77  		"einsteindb_scheduler_is_busy",
    78  		"einsteindb_coprocessor_is_busy",
    79  		"einsteindb_engine_write_stall",
    80  		"einsteindb_raftstore_apply_log_avg_duration",
    81  		"einsteindb_raftstore_apply_log_duration",
    82  		"einsteindb_raftstore_append_log_avg_duration",
    83  		"einsteindb_raftstore_append_log_duration",
    84  		"einsteindb_raftstore_commit_log_avg_duration",
    85  		"einsteindb_raftstore_commit_log_duration",
    86  		"einsteindb_raftstore_process_duration",
    87  		"einsteindb_raftstore_propose_wait_duration",
    88  		"einsteindb_propose_avg_wait_duration",
    89  		"einsteindb_raftstore_apply_wait_duration",
    90  		"einsteindb_apply_avg_wait_duration",
    91  		"einsteindb_check_split_duration",
    92  		"einsteindb_storage_async_request_duration",
    93  		"einsteindb_storage_async_request_avg_duration",
    94  		"einsteindb_scheduler_command_duration",
    95  		"einsteindb_scheduler_command_avg_duration",
    96  		"einsteindb_scheduler_latch_wait_duration",
    97  		"einsteindb_scheduler_latch_wait_avg_duration",
    98  		"einsteindb_send_snapshot_duration",
    99  		"einsteindb_handle_snapshot_duration",
   100  		"einsteindb_cop_request_durations",
   101  		"einsteindb_cop_request_duration",
   102  		"einsteindb_cop_handle_duration",
   103  		"einsteindb_cop_wait_duration",
   104  		"einsteindb_engine_max_get_duration",
   105  		"einsteindb_engine_avg_get_duration",
   106  		"einsteindb_engine_avg_seek_duration",
   107  		"einsteindb_engine_write_duration",
   108  		"einsteindb_wal_sync_max_duration",
   109  		"einsteindb_wal_sync_duration",
   110  		"einsteindb_compaction_max_duration",
   111  		"einsteindb_compaction_duration",
   112  		"einsteindb_sst_read_max_duration",
   113  		"einsteindb_sst_read_duration",
   114  		"einsteindb_write_stall_max_duration",
   115  		"einsteindb_write_stall_avg_duration",
   116  		"einsteindb_oldest_snapshots_duration",
   117  		"einsteindb_ingest_sst_duration",
   118  		"einsteindb_ingest_sst_avg_duration",
   119  		"einsteindb_engine_blob_seek_duration",
   120  		"einsteindb_engine_blob_get_duration",
   121  		"einsteindb_engine_blob_file_read_duration",
   122  		"einsteindb_engine_blob_file_write_duration",
   123  		"einsteindb_engine_blob_file_sync_duration",
   124  		"einsteindb_lock_manager_waiter_lifetime_avg_duration",
   125  		"einsteindb_lock_manager_deadlock_detect_duration",
   126  		"einsteindb_lock_manager_deadlock_detect_avg_duration",
   127  	},
   128  	"read-link": {
   129  		"milevadb_get_token_duration",
   130  		"milevadb_parse_duration",
   131  		"milevadb_compile_duration",
   132  		"FIDel_tso_rpc_duration",
   133  		"FIDel_tso_wait_duration",
   134  		"milevadb_execute_duration",
   135  		"milevadb_expensive_interlocks_ops",
   136  		"milevadb_query_using_plan_cache_ops",
   137  		"milevadb_allegrosql_execution_duration",
   138  		"milevadb_allegrosql_partial_num",
   139  		"milevadb_allegrosql_partial_qps",
   140  		"milevadb_allegrosql_partial_scan_key_num",
   141  		"milevadb_allegrosql_qps",
   142  		"milevadb_allegrosql_scan_key_num",
   143  		"milevadb_region_cache_ops",
   144  		"milevadb_batch_client_pending_req_count",
   145  		"milevadb_batch_client_unavailable_duration",
   146  		"milevadb_batch_client_wait_duration",
   147  		"milevadb_ekv_backoff_duration",
   148  		"milevadb_ekv_backoff_ops",
   149  		"milevadb_ekv_region_error_ops",
   150  		"milevadb_ekv_request_duration",
   151  		"milevadb_ekv_request_ops",
   152  		"milevadb_ekv_snapshot_ops",
   153  		"milevadb_ekv_txn_ops",
   154  		"einsteindb_average_grpc_messge_duration",
   155  		"einsteindb_grpc_avg_req_batch_size",
   156  		"einsteindb_grpc_avg_resp_batch_size",
   157  		"einsteindb_grpc_errors",
   158  		"einsteindb_grpc_message_duration",
   159  		"einsteindb_grpc_qps",
   160  		"einsteindb_grpc_req_batch_size",
   161  		"einsteindb_grpc_resp_batch_size",
   162  		"milevadb_cop_duration",
   163  		"einsteindb_cop_wait_duration",
   164  		"einsteindb_coprocessor_is_busy",
   165  		"einsteindb_coprocessor_request_error",
   166  		"einsteindb_cop_handle_duration",
   167  		"einsteindb_cop_ekv_cursor_operations",
   168  		"einsteindb_cop_request_duration",
   169  		"einsteindb_cop_request_durations",
   170  		"einsteindb_cop_scan_details",
   171  		"einsteindb_cop_posetPosetDag_interlocks_ops",
   172  		"einsteindb_cop_posetPosetDag_requests_ops",
   173  		"einsteindb_cop_scan_keys_num",
   174  		"einsteindb_cop_requests_ops",
   175  		"einsteindb_cop_total_response_size_per_seconds",
   176  		"einsteindb_cop_total_lmdb_perf_statistics",
   177  		"einsteindb_channel_full",
   178  		"einsteindb_engine_avg_get_duration",
   179  		"einsteindb_engine_avg_seek_duration",
   180  		"einsteindb_handle_snapshot_duration",
   181  		"einsteindb_block_all_cache_hit",
   182  		"einsteindb_block_bloom_prefix_cache_hit",
   183  		"einsteindb_block_cache_size",
   184  		"einsteindb_block_data_cache_hit",
   185  		"einsteindb_block_filter_cache_hit",
   186  		"einsteindb_block_index_cache_hit",
   187  		"einsteindb_engine_get_block_cache_operations",
   188  		"einsteindb_engine_get_cpu_cache_operations",
   189  		"einsteindb_engine_get_memblock_operations",
   190  		"einsteindb_per_read_avg_bytes",
   191  		"einsteindb_per_read_max_bytes",
   192  	},
   193  	"write-link": {
   194  		"milevadb_get_token_duration",
   195  		"milevadb_parse_duration",
   196  		"milevadb_compile_duration",
   197  		"FIDel_tso_rpc_duration",
   198  		"FIDel_tso_wait_duration",
   199  		"milevadb_execute_duration",
   200  		"milevadb_transaction_duration",
   201  		"milevadb_transaction_local_latch_wait_duration",
   202  		"milevadb_transaction_ops",
   203  		"milevadb_transaction_retry_error_ops",
   204  		"milevadb_transaction_retry_num",
   205  		"milevadb_transaction_memex_num",
   206  		"milevadb_auto_id_qps",
   207  		"milevadb_auto_id_request_duration",
   208  		"milevadb_region_cache_ops",
   209  		"milevadb_ekv_backoff_duration",
   210  		"milevadb_ekv_backoff_ops",
   211  		"milevadb_ekv_region_error_ops",
   212  		"milevadb_ekv_request_duration",
   213  		"milevadb_ekv_request_ops",
   214  		"milevadb_ekv_snapshot_ops",
   215  		"milevadb_ekv_txn_ops",
   216  		"milevadb_ekv_write_num",
   217  		"milevadb_ekv_write_size",
   218  		"einsteindb_average_grpc_messge_duration",
   219  		"einsteindb_grpc_avg_req_batch_size",
   220  		"einsteindb_grpc_avg_resp_batch_size",
   221  		"einsteindb_grpc_errors",
   222  		"einsteindb_grpc_message_duration",
   223  		"einsteindb_grpc_qps",
   224  		"einsteindb_grpc_req_batch_size",
   225  		"einsteindb_grpc_resp_batch_size",
   226  		"einsteindb_scheduler_command_avg_duration",
   227  		"einsteindb_scheduler_command_duration",
   228  		"einsteindb_scheduler_is_busy",
   229  		"einsteindb_scheduler_keys_read_avg",
   230  		"einsteindb_scheduler_keys_read",
   231  		"einsteindb_scheduler_keys_written_avg",
   232  		"einsteindb_scheduler_keys_written",
   233  		"einsteindb_scheduler_latch_wait_avg_duration",
   234  		"einsteindb_scheduler_latch_wait_duration",
   235  		"einsteindb_scheduler_pending_commands",
   236  		"einsteindb_scheduler_priority_commands",
   237  		"einsteindb_scheduler_scan_details",
   238  		"einsteindb_scheduler_stage",
   239  		"einsteindb_scheduler_writing_bytes",
   240  		"einsteindb_propose_avg_wait_duration",
   241  		"einsteindb_raftstore_propose_wait_duration",
   242  		"einsteindb_raftstore_append_log_avg_duration",
   243  		"einsteindb_raftstore_append_log_duration",
   244  		"einsteindb_raftstore_commit_log_avg_duration",
   245  		"einsteindb_raftstore_commit_log_duration",
   246  		"einsteindb_apply_avg_wait_duration",
   247  		"einsteindb_raftstore_apply_log_avg_duration",
   248  		"einsteindb_raftstore_apply_log_duration",
   249  		"einsteindb_raftstore_apply_wait_duration",
   250  		"einsteindb_engine_wal_sync_operations",
   251  		"einsteindb_engine_write_duration",
   252  		"einsteindb_engine_write_operations",
   253  		"einsteindb_engine_write_stall",
   254  		"einsteindb_write_stall_avg_duration",
   255  		"einsteindb_write_stall_max_duration",
   256  		"einsteindb_write_stall_reason",
   257  	},
   258  	"dbs": {
   259  		"milevadb_dbs_add_index_speed",
   260  		"milevadb_dbs_batch_add_index_duration",
   261  		"milevadb_dbs_deploy_syncer_duration",
   262  		"milevadb_dbs_duration",
   263  		"milevadb_dbs_spacetime_opm",
   264  		"milevadb_dbs_opm",
   265  		"milevadb_dbs_uFIDelate_self_version_duration",
   266  		"milevadb_dbs_waiting_jobs_num",
   267  		"milevadb_dbs_worker_duration",
   268  	},
   269  	"stats": {
   270  		"milevadb_statistics_auto_analyze_duration",
   271  		"milevadb_statistics_auto_analyze_ops",
   272  		"milevadb_statistics_dump_feedback_ops",
   273  		"milevadb_statistics_fast_analyze_status",
   274  		"milevadb_statistics_pseudo_estimation_ops",
   275  		"milevadb_statistics_significant_feedback",
   276  		"milevadb_statistics_stats_inaccuracy_rate",
   277  		"milevadb_statistics_store_query_feedback_qps",
   278  		"milevadb_statistics_uFIDelate_stats_ops",
   279  	},
   280  	"gc": {
   281  		"milevadb_gc_action_result_opm",
   282  		"milevadb_gc_config",
   283  		"milevadb_gc_delete_range_fail_opm",
   284  		"milevadb_gc_delete_range_task_status",
   285  		"milevadb_gc_duration",
   286  		"milevadb_gc_fail_opm",
   287  		"milevadb_gc_push_task_duration",
   288  		"milevadb_gc_too_many_locks_opm",
   289  		"milevadb_gc_worker_action_opm",
   290  		"einsteindb_engine_blob_gc_duration",
   291  		"einsteindb_auto_gc_progress",
   292  		"einsteindb_auto_gc_safepoint",
   293  		"einsteindb_auto_gc_working",
   294  		"einsteindb_gc_fail_tasks",
   295  		"einsteindb_gc_keys",
   296  		"einsteindb_gc_skipped_tasks",
   297  		"einsteindb_gc_speed",
   298  		"einsteindb_gc_tasks_avg_duration",
   299  		"einsteindb_gc_tasks_duration",
   300  		"einsteindb_gc_too_busy",
   301  		"einsteindb_gc_tasks_ops",
   302  	},
   303  	"lmdb": {
   304  		"einsteindb_compaction_duration",
   305  		"einsteindb_compaction_max_duration",
   306  		"einsteindb_compaction_operations",
   307  		"einsteindb_compaction_pending_bytes",
   308  		"einsteindb_compaction_reason",
   309  		"einsteindb_write_stall_avg_duration",
   310  		"einsteindb_write_stall_max_duration",
   311  		"einsteindb_write_stall_reason",
   312  		"store_available_ratio",
   313  		"store_size_amplification",
   314  		"einsteindb_engine_avg_get_duration",
   315  		"einsteindb_engine_avg_seek_duration",
   316  		"einsteindb_engine_blob_bytes_flow",
   317  		"einsteindb_engine_blob_file_count",
   318  		"einsteindb_engine_blob_file_read_duration",
   319  		"einsteindb_engine_blob_file_size",
   320  		"einsteindb_engine_blob_file_sync_duration",
   321  		"einsteindb_engine_blob_file_sync_operations",
   322  		"einsteindb_engine_blob_file_write_duration",
   323  		"einsteindb_engine_blob_gc_bytes_flow",
   324  		"einsteindb_engine_blob_gc_duration",
   325  		"einsteindb_engine_blob_gc_file",
   326  		"einsteindb_engine_blob_gc_keys_flow",
   327  		"einsteindb_engine_blob_get_duration",
   328  		"einsteindb_engine_blob_key_avg_size",
   329  		"einsteindb_engine_blob_key_max_size",
   330  		"einsteindb_engine_blob_seek_duration",
   331  		"einsteindb_engine_blob_seek_operations",
   332  		"einsteindb_engine_blob_value_avg_size",
   333  		"einsteindb_engine_blob_value_max_size",
   334  		"einsteindb_engine_compaction_flow_bytes",
   335  		"einsteindb_engine_get_block_cache_operations",
   336  		"einsteindb_engine_get_cpu_cache_operations",
   337  		"einsteindb_engine_get_memblock_operations",
   338  		"einsteindb_engine_live_blob_size",
   339  		"einsteindb_engine_max_get_duration",
   340  		"einsteindb_engine_max_seek_duration",
   341  		"einsteindb_engine_seek_operations",
   342  		"einsteindb_engine_size",
   343  		"einsteindb_engine_wal_sync_operations",
   344  		"einsteindb_engine_write_duration",
   345  		"einsteindb_engine_write_operations",
   346  		"einsteindb_engine_write_stall",
   347  	},
   348  	"fidel": {
   349  		"FIDel_scheduler_balance_region",
   350  		"FIDel_balance_scheduler_status",
   351  		"FIDel_checker_event_count",
   352  		"FIDel_client_cmd_duration",
   353  		"FIDel_client_cmd_ops",
   354  		"FIDel_cluster_spacetimedata",
   355  		"FIDel_cluster_status",
   356  		"FIDel_grpc_completed_commands_duration",
   357  		"FIDel_grpc_completed_commands_rate",
   358  		"FIDel_request_rpc_duration",
   359  		"FIDel_request_rpc_ops",
   360  		"FIDel_request_rpc_duration_avg",
   361  		"FIDel_handle_transactions_duration",
   362  		"FIDel_handle_transactions_rate",
   363  		"FIDel_hotspot_status",
   364  		"FIDel_label_distribution",
   365  		"FIDel_operator_finish_duration",
   366  		"FIDel_operator_step_finish_duration",
   367  		"FIDel_peer_round_trip_duration",
   368  		"FIDel_region_health",
   369  		"FIDel_region_heartbeat_duration",
   370  		"FIDel_region_label_isolation_level",
   371  		"FIDel_region_syncer_status",
   372  		"FIDel_role",
   373  		"FIDel_schedule_filter",
   374  		"FIDel_schedule_operator",
   375  		"FIDel_schedule_store_limit",
   376  		"FIDel_scheduler_balance_direction",
   377  		"FIDel_scheduler_balance_leader",
   378  		"FIDel_scheduler_config",
   379  		"FIDel_scheduler_op_influence",
   380  		"FIDel_scheduler_region_heartbeat",
   381  		"FIDel_scheduler_status",
   382  		"FIDel_scheduler_store_status",
   383  		"FIDel_scheduler_tolerant_resource",
   384  		"FIDel_server_etcd_state",
   385  		"FIDel_start_tso_wait_duration",
   386  	},
   387  	"raftstore": {
   388  		"einsteindb_approximate_avg_region_size",
   389  		"einsteindb_approximate_region_size_histogram",
   390  		"einsteindb_approximate_region_size",
   391  		"einsteindb_raftstore_append_log_avg_duration",
   392  		"einsteindb_raftstore_append_log_duration",
   393  		"einsteindb_raftstore_commit_log_avg_duration",
   394  		"einsteindb_raftstore_commit_log_duration",
   395  		"einsteindb_apply_avg_wait_duration",
   396  		"einsteindb_raftstore_apply_log_avg_duration",
   397  		"einsteindb_raftstore_apply_log_duration",
   398  		"einsteindb_raftstore_apply_wait_duration",
   399  		"einsteindb_raftstore_process_duration",
   400  		"einsteindb_raftstore_process_handled",
   401  		"einsteindb_propose_avg_wait_duration",
   402  		"einsteindb_raftstore_propose_wait_duration",
   403  		"einsteindb_raft_dropped_messages",
   404  		"einsteindb_raft_log_speed",
   405  		"einsteindb_raft_message_avg_batch_size",
   406  		"einsteindb_raft_message_batch_size",
   407  		"einsteindb_raft_proposals_per_ready",
   408  		"einsteindb_raft_proposals",
   409  		"einsteindb_raft_sent_messages",
   410  	},
   411  }
   412  
   413  func (e *inspectionSummaryRetriever) retrieve(ctx context.Context, sctx stochastikctx.Context) ([][]types.Causet, error) {
   414  	if e.retrieved || e.extractor.SkipInspection {
   415  		return nil, nil
   416  	}
   417  	e.retrieved = true
   418  
   419  	rules := inspectionFilter{set: e.extractor.Memrules}
   420  	names := inspectionFilter{set: e.extractor.MetricNames}
   421  
   422  	condition := e.timeRange.Condition()
   423  	var finalEvents [][]types.Causet
   424  	for rule, blocks := range inspectionSummaryMemrules {
   425  		if len(rules.set) != 0 && !rules.set.Exist(rule) {
   426  			continue
   427  		}
   428  		for _, name := range blocks {
   429  			if !names.enable(name) {
   430  				continue
   431  			}
   432  			def, found := schemareplicant.MetricBlockMap[name]
   433  			if !found {
   434  				sctx.GetStochastikVars().StmtCtx.AppendWarning(fmt.Errorf("metrics causet: %s not found", name))
   435  				continue
   436  			}
   437  			defcaus := def.Labels
   438  			comment := def.Comment
   439  			cond := condition
   440  			if def.Quantile > 0 {
   441  				defcaus = append(defcaus, "quantile")
   442  				if len(e.extractor.Quantiles) > 0 {
   443  					qs := make([]string, len(e.extractor.Quantiles))
   444  					for i, q := range e.extractor.Quantiles {
   445  						qs[i] = fmt.Sprintf("%f", q)
   446  					}
   447  					cond += " and quantile in (" + strings.Join(qs, ",") + ")"
   448  				} else {
   449  					cond += " and quantile=0.99"
   450  				}
   451  			}
   452  			var allegrosql string
   453  			if len(defcaus) > 0 {
   454  				allegrosql = fmt.Sprintf("select avg(value),min(value),max(value),`%s` from `%s`.`%s` %s group by `%[1]s` order by `%[1]s`",
   455  					strings.Join(defcaus, "`,`"), soliton.MetricSchemaName.L, name, cond)
   456  			} else {
   457  				allegrosql = fmt.Sprintf("select avg(value),min(value),max(value) from `%s`.`%s` %s",
   458  					soliton.MetricSchemaName.L, name, cond)
   459  			}
   460  			rows, _, err := sctx.(sqlexec.RestrictedALLEGROSQLInterlockingDirectorate).InterDircRestrictedALLEGROSQLWithContext(ctx, allegrosql)
   461  			if err != nil {
   462  				return nil, errors.Errorf("execute '%s' failed: %v", allegrosql, err)
   463  			}
   464  			nonInstanceLabelIndex := 0
   465  			if len(def.Labels) > 0 && def.Labels[0] == "instance" {
   466  				nonInstanceLabelIndex = 1
   467  			}
   468  			// skip min/max/avg
   469  			const skipDefCauss = 3
   470  			for _, event := range rows {
   471  				instance := ""
   472  				if nonInstanceLabelIndex > 0 {
   473  					instance = event.GetString(skipDefCauss) // skip min/max/avg
   474  				}
   475  				var labels []string
   476  				for i, label := range def.Labels[nonInstanceLabelIndex:] {
   477  					// skip min/max/avg/instance
   478  					val := event.GetString(skipDefCauss + nonInstanceLabelIndex + i)
   479  					if label == "causetstore" || label == "store_id" {
   480  						val = fmt.Sprintf("store_id:%s", val)
   481  					}
   482  					labels = append(labels, val)
   483  				}
   484  				var quantile interface{}
   485  				if def.Quantile > 0 {
   486  					quantile = event.GetFloat64(event.Len() - 1) // quantile will be the last defCausumn
   487  				}
   488  				finalEvents = append(finalEvents, types.MakeCausets(
   489  					rule,
   490  					instance,
   491  					name,
   492  					strings.Join(labels, ", "),
   493  					quantile,
   494  					event.GetFloat64(0), // avg
   495  					event.GetFloat64(1), // min
   496  					event.GetFloat64(2), // max
   497  					comment,
   498  				))
   499  			}
   500  		}
   501  	}
   502  	return finalEvents, nil
   503  }