Skip to content

Commit e9ea46e

Browse files
committed
update README
1 parent 952ba56 commit e9ea46e

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

reporter_jobs.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
/** Package traceandtrace-go go 语言 tracing lib, 可以集成不同的 tracer 如: jeagerzipkinskywalking
2-
reporter_job 可以对 tracing 数据上报,做了性能优化,做到业务侵入小, 高性能等。
1+
/** Package traceandtrace-go is the go language tracing lib, which can integrate different tracers such as: jeager, zipkin, skywalking, etc.
2+
reporter_job can report tracing data and optimize performance to achieve low business intrusion and high performance.
33
4-
// 快速上手
4+
// quick start
55
import (
66
tracing "github.com/codeandcode0x/traceandtrace-go"
77
)
88
9-
// func 中 或者 middleware 中添加
9+
// Add in func or middleware
1010
_, cancel := tracing.AddHttpTracing("HttpTracingTest", [your http Header], map[string]string{"version": "v1"})
1111
defer cancel()
1212
1313
...
1414
15-
reporter_job 对上报 tracing 数据进行了优化 (采用携程任务处理),对业务侵入小,高性能上报,job 结束后, 可以对资源进行释放。
15+
reporter_job optimizes the reported tracing data (using goroutine processing), has little business intrusion, and reports with high performance.
16+
After the job ends, resources can be released.
1617
*/
1718
package traceandtracego
1819

@@ -28,15 +29,15 @@ import (
2829

2930
//generate trace jobs (goroutine), use context and chan to control jobs and release goroutine .
3031
func GenerateTracingJobs(pch chan<- context.Context, parent context.Context, svc string, header http.Header, tags map[string]string, traceType string) {
31-
//设置 context
32+
// setting context
3233
ctx, cancel := context.WithCancel(parent)
33-
//设置通道
34+
// setting chan
3435
ch := make(chan context.Context, 0)
3536
go doTask(ch, ctx, svc, header, tags, traceType)
36-
//接受信号
37+
// receive signal
3738
pctx := <-ch
3839
pch <- pctx
39-
//销毁资源
40+
// destroy resources
4041
for {
4142
select {
4243
case <-ctx.Done():
@@ -48,14 +49,14 @@ func GenerateTracingJobs(pch chan<- context.Context, parent context.Context, svc
4849
}
4950
}
5051

51-
//执行 trace reporter
52+
// do trace reporter
5253
func doTask(ch chan context.Context, parent context.Context,
5354
svc string, header http.Header, tags map[string]string, traceType string) {
5455
//定义 tracer, closer
5556
var tracer opentracing.Tracer
5657
var closer io.Closer
5758
var ctx context.Context
58-
//选择 reporter 类别
59+
// select reporter type
5960
switch traceType {
6061
case "jaeger":
6162
tracer, closer = tracing.InitJaeger(svc)

0 commit comments

Comments
 (0)