add tracing feature for package gproc (#1923)

This commit is contained in:
John Guo
2022-06-21 21:46:12 +08:00
committed by GitHub
parent f0568b4e22
commit 2bcee014f7
22 changed files with 355 additions and 164 deletions

View File

@ -7,8 +7,8 @@ require (
github.com/gogf/gf/contrib/registry/etcd/v2 v2.1.0-rc3.0.20220523034830-510fa3faf03f
github.com/gogf/gf/contrib/registry/polaris/v2 v2.0.0-rc2
github.com/gogf/gf/contrib/trace/jaeger/v2 v2.0.0-rc2
github.com/gogf/gf/v2 v2.1.0-rc3.0.20220523034830-510fa3faf03f
github.com/gogf/katyusha v0.4.0
github.com/gogf/gf/v2 v2.1.0-rc4.0.20220620123459-52056644d499
github.com/gogf/katyusha v0.4.1-0.20220620125113-f55d6f739773
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.2
github.com/polarismesh/polaris-go v1.2.0-beta.0.0.20220517041223-596a6a63b00f

View File

@ -113,6 +113,8 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg78
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gogf/katyusha v0.4.0 h1:mQVfXHhzC+UQf11Q8HAk9IOhQZ1VMXqGUqezyywZUOs=
github.com/gogf/katyusha v0.4.0/go.mod h1:nqsIWBsImnq9+OLlfB6iNef6ZLRyR2L1Bnk9h2aZvKs=
github.com/gogf/katyusha v0.4.1-0.20220620125113-f55d6f739773 h1:YQBLawktoymYtPGs9idE9JS5Wqd3SjIzUEZOPKCdSw0=
github.com/gogf/katyusha v0.4.1-0.20220620125113-f55d6f739773/go.mod h1:Z0GCeHXz1UI0HtA0K45c6TzEGM4DL/PLatS747/WarI=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=

View File

@ -0,0 +1,25 @@
package main
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gcmd"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/os/gproc"
)
var (
Main = &gcmd.Command{
Name: "main",
Brief: "main process",
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
g.Log().Debug(ctx, `this is main process`)
return gproc.ShellRun(ctx, `go run sub/sub.go`)
},
}
)
func main() {
Main.Run(gctx.New())
}

View File

@ -0,0 +1,24 @@
package main
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gcmd"
"github.com/gogf/gf/v2/os/gctx"
)
var (
Sub = &gcmd.Command{
Name: "sub",
Brief: "sub process",
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
g.Log().Debug(ctx, `this is sub process`)
return nil
},
}
)
func main() {
Sub.Run(gctx.New())
}

View File

@ -0,0 +1,15 @@
package main
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/os/gproc"
)
func main() {
ctx := gctx.New()
g.Log().Debug(ctx, `this is main process`)
if err := gproc.ShellRun(ctx, `go run sub/sub.go`); err != nil {
panic(err)
}
}

View File

@ -0,0 +1,11 @@
package main
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
)
func main() {
ctx := gctx.New()
g.Log().Debug(ctx, `this is sub process`)
}