Skip to content

Commit a1af23f

Browse files
committed
update README
1 parent c781fc9 commit a1af23f

File tree

12 files changed

+54
-36
lines changed

12 files changed

+54
-36
lines changed

.github/RELEASE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
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.
44

5-
> 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).
5+
> 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).

cmd/serverNameExample_grpcExample/initial/initApp.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,15 @@ func InitApp() {
4949
panic(err)
5050
}
5151
logger.Debug(config.Show())
52-
logger.Info("init logger succeeded")
52+
logger.Info("[logger] was initialized")
5353

5454
// initializing database
5555
model.InitDB()
56-
logger.Infof("init %s succeeded", cfg.Database.Driver)
56+
logger.Infof("[%s] was initialized", cfg.Database.Driver)
5757
model.InitCache(cfg.App.CacheType)
58+
if cfg.App.CacheType != "" {
59+
logger.Infof("[%s] was initialized", cfg.App.CacheType)
60+
}
5861

5962
// initializing tracing
6063
if cfg.App.EnableTrace {
@@ -66,7 +69,7 @@ func InitApp() {
6669
strconv.Itoa(cfg.Jaeger.AgentPort),
6770
cfg.App.TracingSamplingRate,
6871
)
69-
logger.Info("init tracer succeeded")
72+
logger.Info("[tracer] was initialized")
7073
}
7174

7275
// initializing the print system and process resources
@@ -75,7 +78,7 @@ func InitApp() {
7578
stat.WithLog(logger.Get()),
7679
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
7780
)
78-
logger.Info("init statistics succeeded")
81+
logger.Info("[resource statistics] was initialized")
7982
}
8083
}
8184

cmd/serverNameExample_grpcGwPbExample/initial/initApp.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func InitApp() {
4949
panic(err)
5050
}
5151
logger.Debug(config.Show())
52-
logger.Info("init logger succeeded")
52+
logger.Info("[logger] was initialized")
5353

5454
// initializing tracing
5555
if cfg.App.EnableTrace {
@@ -61,7 +61,7 @@ func InitApp() {
6161
strconv.Itoa(cfg.Jaeger.AgentPort),
6262
cfg.App.TracingSamplingRate,
6363
)
64-
logger.Info("init tracer succeeded")
64+
logger.Info("[tracer] was initialized")
6565
}
6666

6767
// initializing the rpc server connection
@@ -74,7 +74,7 @@ func InitApp() {
7474
stat.WithLog(logger.Get()),
7575
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
7676
)
77-
logger.Info("init statistics succeeded")
77+
logger.Info("[resource statistics] was initialized")
7878
}
7979
}
8080

cmd/serverNameExample_grpcHttpPbExample/initial/initApp.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,15 @@ func InitApp() {
4949
panic(err)
5050
}
5151
logger.Debug(config.Show())
52-
logger.Info("init logger succeeded")
52+
logger.Info("[logger] was initialized")
5353

5454
// initializing database
5555
//model.InitDB()
56-
//logger.Infof("init %s succeeded", cfg.Database.Driver)
56+
//logger.Infof("[%s] was initialized", cfg.Database.Driver)
5757
//model.InitCache(cfg.App.CacheType)
58+
//if cfg.App.CacheType != "" {
59+
// logger.Infof("[%s] was initialized", cfg.App.CacheType)
60+
//}
5861

5962
// initializing tracing
6063
if cfg.App.EnableTrace {
@@ -66,7 +69,7 @@ func InitApp() {
6669
strconv.Itoa(cfg.Jaeger.AgentPort),
6770
cfg.App.TracingSamplingRate,
6871
)
69-
logger.Info("init tracer succeeded")
72+
logger.Info("[tracer] was initialized")
7073
}
7174

7275
// initializing the print system and process resources
@@ -75,7 +78,7 @@ func InitApp() {
7578
stat.WithLog(logger.Get()),
7679
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
7780
)
78-
logger.Info("init statistics succeeded")
81+
logger.Info("[resource statistics] was initialized")
7982
}
8083
}
8184

cmd/serverNameExample_grpcPbExample/initial/initApp.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,15 @@ func InitApp() {
4949
panic(err)
5050
}
5151
logger.Debug(config.Show())
52-
logger.Info("init logger succeeded")
52+
logger.Info("[logger] was initialized")
5353

5454
// initializing database
5555
//model.InitDB()
56-
//logger.Infof("init %s succeeded", cfg.Database.Driver)
56+
//logger.Infof("[%s] was initialized", cfg.Database.Driver)
5757
//model.InitCache(cfg.App.CacheType)
58+
//if cfg.App.CacheType != "" {
59+
// logger.Infof("[%s] was initialized", cfg.App.CacheType)
60+
//}
5861

5962
// initializing tracing
6063
if cfg.App.EnableTrace {
@@ -66,7 +69,7 @@ func InitApp() {
6669
strconv.Itoa(cfg.Jaeger.AgentPort),
6770
cfg.App.TracingSamplingRate,
6871
)
69-
logger.Info("init tracer succeeded")
72+
logger.Info("[tracer] was initialized")
7073
}
7174

7275
// initializing the print system and process resources
@@ -75,7 +78,7 @@ func InitApp() {
7578
stat.WithLog(logger.Get()),
7679
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
7780
)
78-
logger.Info("init statistics succeeded")
81+
logger.Info("[resource statistics] was initialized")
7982
}
8083
}
8184

cmd/serverNameExample_httpExample/initial/initApp.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,15 @@ func InitApp() {
4949
panic(err)
5050
}
5151
logger.Debug(config.Show())
52-
logger.Info("init logger succeeded")
52+
logger.Info("[logger] was initialized")
5353

5454
// initializing database
5555
model.InitDB()
56-
logger.Infof("init %s succeeded", cfg.Database.Driver)
56+
logger.Infof("[%s] was initialized", cfg.Database.Driver)
5757
model.InitCache(cfg.App.CacheType)
58+
if cfg.App.CacheType != "" {
59+
logger.Infof("[%s] was initialized", cfg.App.CacheType)
60+
}
5861

5962
// initializing tracing
6063
if cfg.App.EnableTrace {
@@ -66,7 +69,7 @@ func InitApp() {
6669
strconv.Itoa(cfg.Jaeger.AgentPort),
6770
cfg.App.TracingSamplingRate,
6871
)
69-
logger.Info("init tracer succeeded")
72+
logger.Info("[tracer] was initialized")
7073
}
7174

7275
// initializing the print system and process resources
@@ -75,7 +78,7 @@ func InitApp() {
7578
stat.WithLog(logger.Get()),
7679
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
7780
)
78-
logger.Info("init statistics succeeded")
81+
logger.Info("[resource statistics] was initialized")
7982
}
8083
}
8184

cmd/serverNameExample_httpPbExample/initial/initApp.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,15 @@ func InitApp() {
4949
panic(err)
5050
}
5151
logger.Debug(config.Show())
52-
logger.Info("init logger succeeded")
52+
logger.Info("[logger] was initialized")
5353

5454
// initializing database
5555
//model.InitDB()
56-
//logger.Infof("init %s succeeded", cfg.Database.Driver)
56+
//logger.Infof("[%s] was initialized", cfg.Database.Driver)
5757
//model.InitCache(cfg.App.CacheType)
58+
//if cfg.App.CacheType != "" {
59+
// logger.Infof("[%s] was initialized", cfg.App.CacheType)
60+
//}
5861

5962
// initializing tracing
6063
if cfg.App.EnableTrace {
@@ -66,7 +69,7 @@ func InitApp() {
6669
strconv.Itoa(cfg.Jaeger.AgentPort),
6770
cfg.App.TracingSamplingRate,
6871
)
69-
logger.Info("init tracer succeeded")
72+
logger.Info("[tracer] was initialized")
7073
}
7174

7275
// initializing the print system and process resources
@@ -75,7 +78,7 @@ func InitApp() {
7578
stat.WithLog(logger.Get()),
7679
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
7780
)
78-
logger.Info("init statistics succeeded")
81+
logger.Info("[resource statistics] was initialized")
7982
}
8083
}
8184

cmd/serverNameExample_mixExample/initial/initApp.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,15 @@ func InitApp() {
4949
panic(err)
5050
}
5151
logger.Debug(config.Show())
52-
logger.Info("init logger succeeded")
52+
logger.Info("[logger] was initialized")
5353

5454
// initializing database
5555
model.InitDB()
56-
logger.Infof("init %s succeeded", cfg.Database.Driver)
56+
logger.Infof("[%s] was initialized", cfg.Database.Driver)
5757
model.InitCache(cfg.App.CacheType)
58+
if cfg.App.CacheType != "" {
59+
logger.Infof("[%s] was initialized", cfg.App.CacheType)
60+
}
5861

5962
// initializing tracing
6063
if cfg.App.EnableTrace {
@@ -66,7 +69,7 @@ func InitApp() {
6669
strconv.Itoa(cfg.Jaeger.AgentPort),
6770
cfg.App.TracingSamplingRate,
6871
)
69-
logger.Info("init tracer succeeded")
72+
logger.Info("[tracer] was initialized")
7073
}
7174

7275
// initializing the print system and process resources
@@ -75,7 +78,7 @@ func InitApp() {
7578
stat.WithLog(logger.Get()),
7679
stat.WithAlarm(), // invalid if it is windows, the default threshold for cpu and memory is 0.8, you can modify them
7780
)
78-
logger.Info("init statistics succeeded")
81+
logger.Info("[resource statistics] was initialized")
7982
}
8083
}
8184

pkg/grpc/metrics/monitor-example-cn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ wrk -t2 -c10 -d10s http://192.168.3.27:8080/api/v1/course/1
6767

6868
监控界面如下图所示:
6969

70-
![http-grafana](https://go-sponge.com/assets/images/http-grafana.jpg)
70+
![http-grafana](https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/http-grafana.jpg)
7171

7272
<br>
7373

@@ -103,7 +103,7 @@ wrk -t2 -c10 -d10s http://192.168.3.27:8080/api/v1/course/1
103103
使用`Goland` IDE打开`internal/service/teacher_client_test.go`文件,对**Test_teacherService_methods** 或 **Test_teacherService_benchmark** 下各个方法进行测试。
104104

105105
监控界面如下图所示。
106-
![rpc-grafana](https://go-sponge.com/assets/images/rpc-grafana.jpg)
106+
![rpc-grafana](https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/rpc-grafana.jpg)
107107

108108
<br>
109109

pkg/grpc/metrics/monitor-example-en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ wrk -t2 -c10 -d10s http://192.168.3.27:8080/api/v1/course/1
6767

6868
The monitoring interface will look like the following image:
6969

70-
![http-grafana](https://go-sponge.com/assets/images/http-grafana.jpg)
70+
![http-grafana](https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/http-grafana.jpg)
7171

7272
<br>
7373

@@ -104,7 +104,7 @@ Open the `internal/service/teacher_client_test.go` file using the `Goland` IDE a
104104

105105
The monitoring interface will look like the following image:
106106

107-
![rpc-grafana](https://go-sponge.com/assets/images/rpc-grafana.jpg)
107+
![rpc-grafana](https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/rpc-grafana.jpg)
108108

109109
<br>
110110

pkg/tracer/example-cn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ make run
3636

3737
复制 [http://localhost:8080/swagger/index.html](http://localhost:8080/apis/swagger/index.html) 到浏览器访问swagger主页,以请求get查询为例,连续请求同一个id两次,链路跟踪如下图所示。
3838

39-
![one-server-trace](https://go-sponge.com/assets/images/one-server-trace.jpg)
39+
![one-server-trace](https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/one-server-trace.jpg)
4040

4141
<br>
4242

@@ -76,7 +76,7 @@ defer span.End()
7676

7777
启动 **shopgw****product****inventory****comment** 四个服务,在浏览器访问 [http://localhost:8080/apis/swagger/index.html](http://localhost:8080/apis/swagger/index.html) ,执行get请求,链路跟踪界面如下图所示。
7878

79-
![multi-servers-trace](https://go-sponge.com/assets/images/multi-servers-trace.jpg)
79+
![multi-servers-trace](https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/multi-servers-trace.jpg)
8080

8181
<br>
8282

pkg/tracer/example-en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ make run
3535

3636
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:
3737

38-
![one-server-trace](https://go-sponge.com/assets/images/one-server-trace.jpg)
38+
![one-server-trace](https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/one-server-trace.jpg)
3939

4040
From the image, you can see that the first request consists of 4 spans:
4141

@@ -73,7 +73,7 @@ In the **product**, **inventory**, and **comment** services, locate the template
7373

7474
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:
7575

76-
![multi-servers-trace](https://go-sponge.com/assets/images/multi-servers-trace.jpg)
76+
![multi-servers-trace](https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/multi-servers-trace.jpg)
7777

7878
From the image, you can see a total of 10 spans in the primary trace:
7979

0 commit comments

Comments
 (0)