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

feat: add trpc protocol support #254

Merged
merged 5 commits into from
Oct 29, 2023
Merged

feat: add trpc protocol support #254

merged 5 commits into from
Oct 29, 2023

Conversation

LinuxSuRen
Copy link
Owner

@LinuxSuRen LinuxSuRen commented Oct 27, 2023

see also trpc-group/trpc-go#100

Below is the test process:

run in the server side:

~/ws/trpc-group/trpc-go/examples/helloworld/server# go run .
2023-10-27 14:23:07.225 INFO    client/client_linux.go:35       client  is empowered with tnet! 🤩 
2023-10-27 14:23:07.226 DEBUG   maxprocs/maxprocs.go:47 maxprocs: Leaving GOMAXPROCS=8: CPU quota undefined
2023-10-27 14:23:07.226 INFO    server/service_linux.go:21      service trpc.helloworld with network tcp and protocol trpc is empowered with tnet! 🤩 you can set 'transport: go-net' in your trpc_go.yaml's service configuration to switch to the golang net framework
2023-10-27 14:23:07.227 INFO    tnet/server_transport.go:66     service:trpc.helloworld is using tnet transport, current number of pollers: 1
2023-10-27 14:23:07.227 INFO    server/service.go:167   process:270321, trpc service:trpc.helloworld launch success, tcp:127.0.0.1:8000, serving ...
2023-10-27T14:23:07+08:00       INFO    tnet@v1.0.0/tcpservice.go:90    tnet tcp service started, current number of pollers: 1, use tnet.SetNumPollers to change it

2023-10-27 14:23:21.263 INFO    server/main.go:23       got hello request: atest
atest

run the client side:

~/ws/LinuxSuRen/api-testing# go run . run -p .github/testing/trpc.yaml 
.github/testing/trpc.yaml pattern 1
found suites: 1
2023-10-27 14:23:21.261 INFO    client/client_linux.go:35       client  is empowered with tnet! 🤩 
map[data:map[msg:Hello atest!]] == data.msg == "Hello atest!"
routing end with 16.382783ms
API Average Max Min QPS Count Error
gRPC Hello 13.851997ms 13.851997ms 13.851997ms 0 1 0
consume: 16.71615m

The binary file (in Linux) will increase 9M size once this PR merged. The old size is 30M. I belive that it's necessary to move the tRPC into an extension instead of the core.

See the screenshots:

image
image
image

@LinuxSuRen LinuxSuRen added enhancement New feature or request backend labels Oct 27, 2023
@codacy-production
Copy link

codacy-production bot commented Oct 27, 2023

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.12% 86.23%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (7228009) 5809 5120 88.14%
Head commit (928f881) 6006 (+197) 5301 (+181) 88.26% (+0.12%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#254) 305 263 86.23%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

rr.EndTime = time.Now()
rr.Error = err
rr.API = testcase.Request.API
rr.Method = "gRPC"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here may be tRPC?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Good catch.

Repository owner deleted a comment from github-actions bot Oct 27, 2023
Repository owner deleted a comment from github-actions bot Oct 27, 2023
@LinuxSuRen
Copy link
Owner Author

hi @Ink-33 , I made some changes related to the gRPC. Please take a look at it. Thanks.

Repository owner deleted a comment from github-actions bot Oct 28, 2023
Repository owner deleted a comment from github-actions bot Oct 28, 2023
@github-actions
Copy link

github-actions bot commented Oct 28, 2023

There are 21 test cases:

API Average Max Min Count Error
POST http://localhost:8080/server.Runner/FunctionsQuery 5.485578ms 5.485578ms 5.485578ms 1 0
POST http://localhost:8080/server.Runner/GenerateCode 3.378849ms 3.378849ms 3.378849ms 1 0
POST http://localhost:8080/server.Runner/CreateTestSuite 3.319947ms 3.319947ms 3.319947ms 1 0
gRPC 127.0.0.1:7070/server.Runner/FunctionsQueryStream 3.199879ms 4.614866ms 1.484621ms 3 0
gRPC 127.0.0.1:7070/server.Runner/FunctionsQuery 3.098677ms 3.774453ms 2.350534ms 3 0
gRPC 127.0.0.1:7070/server.Runner/GetVersion 2.83824ms 4.077259ms 1.526721ms 3 0
POST http://localhost:8080/server.Runner/ListTestCase 2.387134ms 3.315148ms 1.459121ms 2 0
POST http://localhost:8080/server.Runner/ConvertTestSuite 1.595423ms 1.595423ms 1.595423ms 1 0
POST http://localhost:8080/server.Runner/GetTestCase 1.42872ms 1.42872ms 1.42872ms 1 0
POST http://localhost:8080/server.Runner/GetStores 1.305718ms 1.305718ms 1.305718ms 1 0
POST http://localhost:8080/server.Runner/GetSuites 1.238118ms 1.238118ms 1.238118ms 1 0
POST http://localhost:8080/server.Runner/GetSuggestedAPIs 1.227817ms 1.227817ms 1.227817ms 1 0
POST http://localhost:8080/server.Runner/PopularHeaders 1.005314ms 1.005314ms 1.005314ms 1 0
POST http://localhost:8080/server.Runner/ListCodeGenerator 1.003114ms 1.003114ms 1.003114ms 1 0
POST http://localhost:8080/server.Runner/ListConverter 915.413µs 915.413µs 915.413µs 1 0
POST http://localhost:8080/server.Runner/DeleteTestSuite 881.012µs 1.070515ms 691.51µs 2 0
POST http://localhost:8080/server.Runner/GetSecrets 787.311µs 787.311µs 787.311µs 1 0
POST http://localhost:8080/server.Runner/GetVersion 732.311µs 732.311µs 732.311µs 1 0
POST http://localhost:8080/server.Runner/UpdateTestSuite 710.21µs 710.21µs 710.21µs 1 0
POST http://localhost:8080/server.Runner/GetTestSuite 640.409µs 640.409µs 640.409µs 1 0
tRPC Hello 468.606µs 468.606µs 468.606µs 1 1

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
3.9% 3.9% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@LinuxSuRen LinuxSuRen merged commit dd7cd46 into master Oct 29, 2023
@LinuxSuRen LinuxSuRen deleted the feat/trpc branch October 29, 2023 11:45
LinuxSuRen pushed a commit that referenced this pull request Jun 17, 2024
* chore(deps): update sonatype/nexus3 docker tag to v3.58.1

* Update app version

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-action update-app-version <githubaction@githubaction.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants