mirror of
https://github.com/zhufuyi/sponge.git
synced 2025-10-16 22:00:54 +08:00
update README
This commit is contained in:
2
.github/RELEASE.md
vendored
2
.github/RELEASE.md
vendored
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
1. Modify the returned ID type, it will affect the ID types of GetByID and List for `⓵Create web service based on sql`, which are consistent with the ID types in the database.
|
1. Modify the returned ID type, it will affect the ID types of GetByID and List for `⓵Create web service based on sql`, which are consistent with the ID types in the database.
|
||||||
|
|
||||||
> If you are using code for `⓵Create web service based on sql` before v1.8.6, do not modify the sponge version under go.mod and upgrade to v1.8.6 or above. Otherwise, the List interface will return empty data because the original `size` field has become invalid (replaced by `limit` field).
|
> Warning: If you are using code for `⓵Create web service based on sql` before v1.8.6, do not modify the sponge version under go.mod and upgrade to v1.8.6 or above. Otherwise, the List interface will return empty data because the original `size` field has become invalid (replaced by `limit` field).
|
||||||
|
@@ -49,12 +49,15 @@ func InitApp() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
logger.Debug(config.Show())
|
logger.Debug(config.Show())
|
||||||
logger.Info("init logger succeeded")
|
logger.Info("[logger] was initialized")
|
||||||
|
|
||||||
// initializing database
|
// initializing database
|
||||||
model.InitDB()
|
model.InitDB()
|
||||||
logger.Infof("init %s succeeded", cfg.Database.Driver)
|
logger.Infof("[%s] was initialized", cfg.Database.Driver)
|
||||||
model.InitCache(cfg.App.CacheType)
|
model.InitCache(cfg.App.CacheType)
|
||||||
|
if cfg.App.CacheType != "" {
|
||||||
|
logger.Infof("[%s] was initialized", cfg.App.CacheType)
|
||||||
|
}
|
||||||
|
|
||||||
// initializing tracing
|
// initializing tracing
|
||||||
if cfg.App.EnableTrace {
|
if cfg.App.EnableTrace {
|
||||||
@@ -66,7 +69,7 @@ func InitApp() {
|
|||||||
strconv.Itoa(cfg.Jaeger.AgentPort),
|
strconv.Itoa(cfg.Jaeger.AgentPort),
|
||||||
cfg.App.TracingSamplingRate,
|
cfg.App.TracingSamplingRate,
|
||||||
)
|
)
|
||||||
logger.Info("init tracer succeeded")
|
logger.Info("[tracer] was initialized")
|
||||||
}
|
}
|
||||||
|
|
||||||
// initializing the print system and process resources
|
// initializing the print system and process resources
|
||||||
@@ -75,7 +78,7 @@ func InitApp() {
|
|||||||
stat.WithLog(logger.Get()),
|
stat.WithLog(logger.Get()),
|
||||||
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
||||||
)
|
)
|
||||||
logger.Info("init statistics succeeded")
|
logger.Info("[resource statistics] was initialized")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ func InitApp() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
logger.Debug(config.Show())
|
logger.Debug(config.Show())
|
||||||
logger.Info("init logger succeeded")
|
logger.Info("[logger] was initialized")
|
||||||
|
|
||||||
// initializing tracing
|
// initializing tracing
|
||||||
if cfg.App.EnableTrace {
|
if cfg.App.EnableTrace {
|
||||||
@@ -61,7 +61,7 @@ func InitApp() {
|
|||||||
strconv.Itoa(cfg.Jaeger.AgentPort),
|
strconv.Itoa(cfg.Jaeger.AgentPort),
|
||||||
cfg.App.TracingSamplingRate,
|
cfg.App.TracingSamplingRate,
|
||||||
)
|
)
|
||||||
logger.Info("init tracer succeeded")
|
logger.Info("[tracer] was initialized")
|
||||||
}
|
}
|
||||||
|
|
||||||
// initializing the rpc server connection
|
// initializing the rpc server connection
|
||||||
@@ -74,7 +74,7 @@ func InitApp() {
|
|||||||
stat.WithLog(logger.Get()),
|
stat.WithLog(logger.Get()),
|
||||||
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
||||||
)
|
)
|
||||||
logger.Info("init statistics succeeded")
|
logger.Info("[resource statistics] was initialized")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,12 +49,15 @@ func InitApp() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
logger.Debug(config.Show())
|
logger.Debug(config.Show())
|
||||||
logger.Info("init logger succeeded")
|
logger.Info("[logger] was initialized")
|
||||||
|
|
||||||
// initializing database
|
// initializing database
|
||||||
//model.InitDB()
|
//model.InitDB()
|
||||||
//logger.Infof("init %s succeeded", cfg.Database.Driver)
|
//logger.Infof("[%s] was initialized", cfg.Database.Driver)
|
||||||
//model.InitCache(cfg.App.CacheType)
|
//model.InitCache(cfg.App.CacheType)
|
||||||
|
//if cfg.App.CacheType != "" {
|
||||||
|
// logger.Infof("[%s] was initialized", cfg.App.CacheType)
|
||||||
|
//}
|
||||||
|
|
||||||
// initializing tracing
|
// initializing tracing
|
||||||
if cfg.App.EnableTrace {
|
if cfg.App.EnableTrace {
|
||||||
@@ -66,7 +69,7 @@ func InitApp() {
|
|||||||
strconv.Itoa(cfg.Jaeger.AgentPort),
|
strconv.Itoa(cfg.Jaeger.AgentPort),
|
||||||
cfg.App.TracingSamplingRate,
|
cfg.App.TracingSamplingRate,
|
||||||
)
|
)
|
||||||
logger.Info("init tracer succeeded")
|
logger.Info("[tracer] was initialized")
|
||||||
}
|
}
|
||||||
|
|
||||||
// initializing the print system and process resources
|
// initializing the print system and process resources
|
||||||
@@ -75,7 +78,7 @@ func InitApp() {
|
|||||||
stat.WithLog(logger.Get()),
|
stat.WithLog(logger.Get()),
|
||||||
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
||||||
)
|
)
|
||||||
logger.Info("init statistics succeeded")
|
logger.Info("[resource statistics] was initialized")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,12 +49,15 @@ func InitApp() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
logger.Debug(config.Show())
|
logger.Debug(config.Show())
|
||||||
logger.Info("init logger succeeded")
|
logger.Info("[logger] was initialized")
|
||||||
|
|
||||||
// initializing database
|
// initializing database
|
||||||
//model.InitDB()
|
//model.InitDB()
|
||||||
//logger.Infof("init %s succeeded", cfg.Database.Driver)
|
//logger.Infof("[%s] was initialized", cfg.Database.Driver)
|
||||||
//model.InitCache(cfg.App.CacheType)
|
//model.InitCache(cfg.App.CacheType)
|
||||||
|
//if cfg.App.CacheType != "" {
|
||||||
|
// logger.Infof("[%s] was initialized", cfg.App.CacheType)
|
||||||
|
//}
|
||||||
|
|
||||||
// initializing tracing
|
// initializing tracing
|
||||||
if cfg.App.EnableTrace {
|
if cfg.App.EnableTrace {
|
||||||
@@ -66,7 +69,7 @@ func InitApp() {
|
|||||||
strconv.Itoa(cfg.Jaeger.AgentPort),
|
strconv.Itoa(cfg.Jaeger.AgentPort),
|
||||||
cfg.App.TracingSamplingRate,
|
cfg.App.TracingSamplingRate,
|
||||||
)
|
)
|
||||||
logger.Info("init tracer succeeded")
|
logger.Info("[tracer] was initialized")
|
||||||
}
|
}
|
||||||
|
|
||||||
// initializing the print system and process resources
|
// initializing the print system and process resources
|
||||||
@@ -75,7 +78,7 @@ func InitApp() {
|
|||||||
stat.WithLog(logger.Get()),
|
stat.WithLog(logger.Get()),
|
||||||
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
||||||
)
|
)
|
||||||
logger.Info("init statistics succeeded")
|
logger.Info("[resource statistics] was initialized")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,12 +49,15 @@ func InitApp() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
logger.Debug(config.Show())
|
logger.Debug(config.Show())
|
||||||
logger.Info("init logger succeeded")
|
logger.Info("[logger] was initialized")
|
||||||
|
|
||||||
// initializing database
|
// initializing database
|
||||||
model.InitDB()
|
model.InitDB()
|
||||||
logger.Infof("init %s succeeded", cfg.Database.Driver)
|
logger.Infof("[%s] was initialized", cfg.Database.Driver)
|
||||||
model.InitCache(cfg.App.CacheType)
|
model.InitCache(cfg.App.CacheType)
|
||||||
|
if cfg.App.CacheType != "" {
|
||||||
|
logger.Infof("[%s] was initialized", cfg.App.CacheType)
|
||||||
|
}
|
||||||
|
|
||||||
// initializing tracing
|
// initializing tracing
|
||||||
if cfg.App.EnableTrace {
|
if cfg.App.EnableTrace {
|
||||||
@@ -66,7 +69,7 @@ func InitApp() {
|
|||||||
strconv.Itoa(cfg.Jaeger.AgentPort),
|
strconv.Itoa(cfg.Jaeger.AgentPort),
|
||||||
cfg.App.TracingSamplingRate,
|
cfg.App.TracingSamplingRate,
|
||||||
)
|
)
|
||||||
logger.Info("init tracer succeeded")
|
logger.Info("[tracer] was initialized")
|
||||||
}
|
}
|
||||||
|
|
||||||
// initializing the print system and process resources
|
// initializing the print system and process resources
|
||||||
@@ -75,7 +78,7 @@ func InitApp() {
|
|||||||
stat.WithLog(logger.Get()),
|
stat.WithLog(logger.Get()),
|
||||||
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
||||||
)
|
)
|
||||||
logger.Info("init statistics succeeded")
|
logger.Info("[resource statistics] was initialized")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,12 +49,15 @@ func InitApp() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
logger.Debug(config.Show())
|
logger.Debug(config.Show())
|
||||||
logger.Info("init logger succeeded")
|
logger.Info("[logger] was initialized")
|
||||||
|
|
||||||
// initializing database
|
// initializing database
|
||||||
//model.InitDB()
|
//model.InitDB()
|
||||||
//logger.Infof("init %s succeeded", cfg.Database.Driver)
|
//logger.Infof("[%s] was initialized", cfg.Database.Driver)
|
||||||
//model.InitCache(cfg.App.CacheType)
|
//model.InitCache(cfg.App.CacheType)
|
||||||
|
//if cfg.App.CacheType != "" {
|
||||||
|
// logger.Infof("[%s] was initialized", cfg.App.CacheType)
|
||||||
|
//}
|
||||||
|
|
||||||
// initializing tracing
|
// initializing tracing
|
||||||
if cfg.App.EnableTrace {
|
if cfg.App.EnableTrace {
|
||||||
@@ -66,7 +69,7 @@ func InitApp() {
|
|||||||
strconv.Itoa(cfg.Jaeger.AgentPort),
|
strconv.Itoa(cfg.Jaeger.AgentPort),
|
||||||
cfg.App.TracingSamplingRate,
|
cfg.App.TracingSamplingRate,
|
||||||
)
|
)
|
||||||
logger.Info("init tracer succeeded")
|
logger.Info("[tracer] was initialized")
|
||||||
}
|
}
|
||||||
|
|
||||||
// initializing the print system and process resources
|
// initializing the print system and process resources
|
||||||
@@ -75,7 +78,7 @@ func InitApp() {
|
|||||||
stat.WithLog(logger.Get()),
|
stat.WithLog(logger.Get()),
|
||||||
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
||||||
)
|
)
|
||||||
logger.Info("init statistics succeeded")
|
logger.Info("[resource statistics] was initialized")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,12 +49,15 @@ func InitApp() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
logger.Debug(config.Show())
|
logger.Debug(config.Show())
|
||||||
logger.Info("init logger succeeded")
|
logger.Info("[logger] was initialized")
|
||||||
|
|
||||||
// initializing database
|
// initializing database
|
||||||
model.InitDB()
|
model.InitDB()
|
||||||
logger.Infof("init %s succeeded", cfg.Database.Driver)
|
logger.Infof("[%s] was initialized", cfg.Database.Driver)
|
||||||
model.InitCache(cfg.App.CacheType)
|
model.InitCache(cfg.App.CacheType)
|
||||||
|
if cfg.App.CacheType != "" {
|
||||||
|
logger.Infof("[%s] was initialized", cfg.App.CacheType)
|
||||||
|
}
|
||||||
|
|
||||||
// initializing tracing
|
// initializing tracing
|
||||||
if cfg.App.EnableTrace {
|
if cfg.App.EnableTrace {
|
||||||
@@ -66,7 +69,7 @@ func InitApp() {
|
|||||||
strconv.Itoa(cfg.Jaeger.AgentPort),
|
strconv.Itoa(cfg.Jaeger.AgentPort),
|
||||||
cfg.App.TracingSamplingRate,
|
cfg.App.TracingSamplingRate,
|
||||||
)
|
)
|
||||||
logger.Info("init tracer succeeded")
|
logger.Info("[tracer] was initialized")
|
||||||
}
|
}
|
||||||
|
|
||||||
// initializing the print system and process resources
|
// initializing the print system and process resources
|
||||||
@@ -75,7 +78,7 @@ func InitApp() {
|
|||||||
stat.WithLog(logger.Get()),
|
stat.WithLog(logger.Get()),
|
||||||
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
|
||||||
)
|
)
|
||||||
logger.Info("init statistics succeeded")
|
logger.Info("[resource statistics] was initialized")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -67,7 +67,7 @@ wrk -t2 -c10 -d10s http://192.168.3.27:8080/api/v1/course/1
|
|||||||
|
|
||||||
监控界面如下图所示:
|
监控界面如下图所示:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ wrk -t2 -c10 -d10s http://192.168.3.27:8080/api/v1/course/1
|
|||||||
使用`Goland` IDE打开`internal/service/teacher_client_test.go`文件,对**Test_teacherService_methods** 或 **Test_teacherService_benchmark** 下各个方法进行测试。
|
使用`Goland` IDE打开`internal/service/teacher_client_test.go`文件,对**Test_teacherService_methods** 或 **Test_teacherService_benchmark** 下各个方法进行测试。
|
||||||
|
|
||||||
监控界面如下图所示。
|
监控界面如下图所示。
|
||||||

|

|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
@@ -67,7 +67,7 @@ wrk -t2 -c10 -d10s http://192.168.3.27:8080/api/v1/course/1
|
|||||||
|
|
||||||
The monitoring interface will look like the following image:
|
The monitoring interface will look like the following image:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ Open the `internal/service/teacher_client_test.go` file using the `Goland` IDE a
|
|||||||
|
|
||||||
The monitoring interface will look like the following image:
|
The monitoring interface will look like the following image:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@ make run
|
|||||||
|
|
||||||
复制 [http://localhost:8080/swagger/index.html](http://localhost:8080/apis/swagger/index.html) 到浏览器访问swagger主页,以请求get查询为例,连续请求同一个id两次,链路跟踪如下图所示。
|
复制 [http://localhost:8080/swagger/index.html](http://localhost:8080/apis/swagger/index.html) 到浏览器访问swagger主页,以请求get查询为例,连续请求同一个id两次,链路跟踪如下图所示。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ defer span.End()
|
|||||||
|
|
||||||
启动 **shopgw**、**product**、**inventory**、**comment** 四个服务,在浏览器访问 [http://localhost:8080/apis/swagger/index.html](http://localhost:8080/apis/swagger/index.html) ,执行get请求,链路跟踪界面如下图所示。
|
启动 **shopgw**、**product**、**inventory**、**comment** 四个服务,在浏览器访问 [http://localhost:8080/apis/swagger/index.html](http://localhost:8080/apis/swagger/index.html) ,执行get请求,链路跟踪界面如下图所示。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ make run
|
|||||||
|
|
||||||
Copy [http://localhost:8080/swagger/index.html](http://localhost:8080/apis/swagger/index.html) into your browser to access the Swagger homepage. As an example, for a GET request, make two consecutive requests with the same ID. The distributed tracing results are shown in the following image:
|
Copy [http://localhost:8080/swagger/index.html](http://localhost:8080/apis/swagger/index.html) into your browser to access the Swagger homepage. As an example, for a GET request, make two consecutive requests with the same ID. The distributed tracing results are shown in the following image:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
From the image, you can see that the first request consists of 4 spans:
|
From the image, you can see that the first request consists of 4 spans:
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ In the **product**, **inventory**, and **comment** services, locate the template
|
|||||||
|
|
||||||
Start the **shopgw**, **product**, **inventory**, and **comment** services. Access [http://localhost:8080/apis/swagger/index.html](http://localhost:8080/apis/swagger/index.html) in your browser and execute a GET request. The distributed tracing interface will look like the image below:
|
Start the **shopgw**, **product**, **inventory**, and **comment** services. Access [http://localhost:8080/apis/swagger/index.html](http://localhost:8080/apis/swagger/index.html) in your browser and execute a GET request. The distributed tracing interface will look like the image below:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
From the image, you can see a total of 10 spans in the primary trace:
|
From the image, you can see a total of 10 spans in the primary trace:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user