You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: provider.go
    path of file: ./repos/erda/internal/apps/msp/apm/service/components/service-list
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package service_list

import (
	"context"
	"fmt"
	"sort"
	"strconv"

	"google.golang.org/protobuf/types/known/structpb"

	"github.com/erda-project
    
func (p *provider) rpsMaxTop5(interval int64, tenantId interface{}, start int64, end int64, ctx context.Context) ([]topn.Item, error) {

	statement := fmt.Sprintf("SELECT target_service_id::tag,target_service_name::tag,sum(count_sum::field)/%v "+
		"FROM application_http_service,application_rpc_service "+
		"WHERE (target_terminus_key::tag=$terminus_key OR source_terminus_key::tag=$terminus_key) and target_service_id::tag != '' "+
		"GROUP BY target_service_id::tag "+
		"ORDER BY sum(count_sum::field) DESC "+
		"LIMIT 5", interval)
	queryParams := map[string]*structpb.Value{
		"terminus_key": structpb.NewStringValue(tenantId.(string)),
	}

	request := &metricpb.QueryWithInfluxFormatRequest{
		Start:     strconv.FormatInt(start, 10),
		End:       strconv.FormatInt(end, 10),
		Statement: statement,
		Params:    queryParams,
	}
	ctx = apis.GetContext(ctx, func(header *transport.Header) {
		header.Set("terminus_key", tenantId.(string))
	})

	response, err := p.Metric.QueryWithInfluxFormat(ctx, request)
	if err != nil {
		return nil, err
	}
	var items []topn.Item
	rows := response.Results[0].Series[0].Rows
	if rows == nil || len(rows) == 0 {
		return items, nil
	}
	total := math.DecimalPlacesWithDigitsNumber(rows[0].Values[2].GetNumberValue(), 2)
	for _, row := range rows {
		var item topn.Item
		item.ID = row.Values[0].GetStringValue()
		item.Name = row.Values[1].GetStringValue()
		item.Value = math.DecimalPlacesWithDigitsNumber(row.Values[2].GetNumberValue(), 2)
		if item.Value == 0 {
			continue
		}
		item.Percent = math.DecimalPlacesWithDigitsNumber(item.Value/total*1e2, 2)
		item.Unit = "reqs/s"
		items = append(items, item)
	}

	return items, err
}