github-advanced-security[bot] commented on code in PR #3502:
URL: https://github.com/apache/dubbo-go/pull/3502#discussion_r3636350167


##########
tools/benchmark/client/main.go:
##########
@@ -0,0 +1,229 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 main
+
+import (
+       "context"
+       "encoding/json"
+       "flag"
+       "fmt"
+       "log"
+       "os"
+       "path/filepath"
+       "time"
+
+       "dubbo.apache.org/dubbo-go/v3/tools/benchmark/client/clients"
+       "dubbo.apache.org/dubbo-go/v3/tools/benchmark/client/engine"
+       "dubbo.apache.org/dubbo-go/v3/tools/benchmark/client/monitor"
+       "dubbo.apache.org/dubbo-go/v3/tools/benchmark/client/payload"
+)
+
+var (
+       framework      = flag.String("framework", "dubbo-go", "测试框架: dubbo-go / 
dubbo-java / grpc")
+       payloadSize    = flag.Int("payload", 1024, "报文大小(字节)")
+       serialization  = flag.String("serialization", "protobuf", "序列化协议: 
hessian2 / protobuf / msgpack")
+       compression    = flag.String("compression", "none", "压缩策略: none / 
default / fastest")
+       concurrency    = flag.Int("concurrency", 100, "并发数")
+       callMode       = flag.String("mode", "unary", "调用模式: unary / streaming")
+       testDuration   = flag.String("duration", "60s", "测试时长")
+       warmupDuration = flag.String("warmup", "10s", "预热时长")
+       serverAddr     = flag.String("addr", "", "服务端地址")
+       serverPID      = flag.Int("pid", 0, "服务端进程PID(用于系统监控)")
+)
+
+type Caller interface {
+       Call(ctx context.Context) error
+       Close() error
+       String() string
+}
+
+type BenchmarkResult struct {
+       Framework       string  `json:"framework"`
+       PayloadSize     int     `json:"payload_size"`
+       Serialization   string  `json:"serialization"`
+       Compression     string  `json:"compression"`
+       Concurrency     int     `json:"concurrency"`
+       CallMode        string  `json:"call_mode"`
+       Timestamp       string  `json:"timestamp"`
+       QPS             float64 `json:"qps"`
+       SuccessRate     float64 `json:"success_rate"`
+       TotalRequests   int64   `json:"total_requests"`
+       SuccessRequests int64   `json:"success_requests"`
+       FailureRequests int64   `json:"failure_requests"`
+       LatencyP50      float64 `json:"latency_p50_ms"`
+       LatencyP90      float64 `json:"latency_p90_ms"`
+       LatencyP95      float64 `json:"latency_p95_ms"`
+       LatencyP99      float64 `json:"latency_p99_ms"`
+       LatencyMin      float64 `json:"latency_min_ms"`
+       LatencyMax      float64 `json:"latency_max_ms"`
+       LatencyAvg      float64 `json:"latency_avg_ms"`
+       CPUAvg          float64 `json:"cpu_avg_percent"`
+       MemoryPeak      float64 `json:"memory_peak_mb"`
+}
+
+func main() {
+       flag.Parse()
+
+       fmt.Println("========================================")
+       fmt.Println("       Dubbo-Go Benchmark Client")
+       fmt.Println("========================================")
+       fmt.Printf("框架:         %s\n", *framework)
+       fmt.Printf("报文大小:     %d bytes\n", *payloadSize)
+       fmt.Printf("序列化:       %s\n", *serialization)
+       fmt.Printf("压缩:         %s\n", *compression)
+       fmt.Printf("并发数:       %d\n", *concurrency)
+       fmt.Printf("调用模式:     %s\n", *callMode)
+       fmt.Printf("预热时长:     %s\n", *warmupDuration)
+       fmt.Printf("测试时长:     %s\n", *testDuration)
+       if *serverAddr != "" {
+               fmt.Printf("服务端地址:   %s\n", *serverAddr)
+       }
+       if *serverPID != 0 {
+               fmt.Printf("服务端PID:    %d\n", *serverPID)
+       }
+       fmt.Println("========================================")
+
+       testDur, err := time.ParseDuration(*testDuration)
+       if err != nil {
+               log.Fatalf("无效的测试时长: %v", err)
+       }
+
+       warmupDur, err := time.ParseDuration(*warmupDuration)
+       if err != nil {
+               log.Fatalf("无效的预热时长: %v", err)
+       }
+
+       pg := payload.NewPayloadGenerator()
+       data := pg.Generate(*payloadSize)
+       fmt.Printf("[INFO] 报文数据已生成,大小: %d bytes\n", len(data))
+
+       caller, err := createCaller(data)
+       if err != nil {
+               log.Fatalf("创建客户端失败: %v", err)
+       }
+       defer caller.Close()
+
+       fmt.Printf("[INFO] 客户端已创建: %s\n", caller)

Review Comment:
   ## CodeQL / Clear-text logging of sensitive information
   
   [Sensitive data returned by an access to Password](1) flows to a logging 
call.
   [Sensitive data returned by an access to Password](2) flows to a logging 
call.
   
   [Show more 
details](https://github.com/apache/dubbo-go/security/code-scanning/72)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to