tencent cloud

문서Performance Testing Service

Use the Protocol File

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2025-03-10 17:35:06

Use Protocol Files In GRPC Scenarios

Protocols such as gRPC require users to upload protocol files, and the performance testing engine depends on protocol files to complete request serialization. Users can upload files or directories. File names need to be unique. Files with the same name will be overwritten by newly uploaded files.
If the user uploads a zip file, PTS will decompress the file and display the decompressed file structure.
If the directory or zip package contains non-Protocol Files, PTS will ignore these files.



If the main .proto file depends on other .proto files, they also need to be uploaded together (the standard .proto files provided by Google, namely, google/protobuf/*.proto, do not need to be uploaded separately because PTS will load them automatically).
The user only needs to load the primary pb. Other pb files that the primary pb depends on will be automatically loaded recursively according to the import path in the primary pb file.
import grpc from 'pts/grpc';

const client = new grpc.Client();
client.load([],'addsvc/addsvc.proto');

export default () => {
client.connect('grpcb.in:9000', {insecure: true});

const rsp = client.invoke('addsvc.Add/Sum', {
a: 1,
b: 2,
});
console.log(JSON.stringify(rsp));
console.log(rsp.data.v); // 3

client.close();
};


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백