Skip to content

Commit 3fc245a

Browse files
committed
fix(all): Update all examples to the latest version of go-orb.
1 parent b3bda17 commit 3fc245a

File tree

32 files changed

+706
-598
lines changed

32 files changed

+706
-598
lines changed

benchmarks/event/cmd/handler/wire.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func wireRun(
2323
serviceContext *cli.ServiceContext,
2424
components *types.Components,
2525
logger log.Logger,
26-
eventHandler event.Handler,
26+
eventHandler event.Type,
2727
) (wireRunResult, error) {
2828
// Orb start
2929
for _, c := range components.Iterate(false) {

benchmarks/event/cmd/handler/wire_gen.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/event/cmd/request/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type stats struct {
3232
func connection(
3333
ctx context.Context,
3434
wg *sync.WaitGroup,
35-
eventHandler event.Handler,
35+
eventHandler event.Type,
3636
logger log.Logger,
3737
req *echo.Req,
3838
connectionNum int,
@@ -100,7 +100,7 @@ func bench(
100100
sn types.ServiceName,
101101
configs types.ConfigData,
102102
logger log.Logger,
103-
eventHandler event.Handler,
103+
eventHandler event.Type,
104104
) error {
105105
cfg := &clientConfig{
106106
Connections: defaultConnections,

benchmarks/event/cmd/request/wire.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ type wireRunCallback func(
2626
serviceName types.ServiceName,
2727
configs types.ConfigData,
2828
logger log.Logger,
29-
eventHandler event.Handler,
29+
eventHandler event.Type,
3030
) error
3131

3232
func wireRun(
3333
serviceName types.ServiceName,
3434
configs types.ConfigData,
3535
components *types.Components,
3636
logger log.Logger,
37-
event event.Handler,
37+
event event.Type,
3838
cb wireRunCallback,
3939
) (wireRunResult, error) {
4040
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)

benchmarks/event/cmd/request/wire_gen.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/event/go.mod

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ module github.com/go-orb/examples/benchmarks/event
33
go 1.23.6
44

55
require (
6-
github.com/go-orb/go-orb v0.2.2-0.20250307213241-c0f330c4e8b5
7-
github.com/go-orb/plugins/cli/urfave v0.0.0-20250307213404-581f83efe070
8-
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250307213404-581f83efe070
9-
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250307213404-581f83efe070
10-
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250307213404-581f83efe070
11-
github.com/go-orb/plugins/event/natsjs v0.1.1-0.20250307213404-581f83efe070
12-
github.com/go-orb/plugins/log/slog v0.1.1-0.20250307213404-581f83efe070
6+
github.com/go-orb/go-orb v0.2.2-0.20250311013353-9996c5ae2659
7+
github.com/go-orb/plugins/cli/urfave v0.0.0-20250311025432-c3f6c11bc7a0
8+
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250311025432-c3f6c11bc7a0
9+
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250311025432-c3f6c11bc7a0
10+
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250311025432-c3f6c11bc7a0
11+
github.com/go-orb/plugins/event/natsjs v0.1.1-0.20250311025432-c3f6c11bc7a0
12+
github.com/go-orb/plugins/log/slog v0.1.1-0.20250311025432-c3f6c11bc7a0
1313
github.com/go-orb/wire v0.7.0
1414
google.golang.org/protobuf v1.36.5
1515
)
@@ -18,6 +18,7 @@ require (
1818
github.com/cornelk/hashmap v1.0.8 // indirect
1919
github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
2020
github.com/goccy/go-json v0.10.5 // indirect
21+
github.com/google/uuid v1.6.0 // indirect
2122
github.com/hashicorp/errwrap v1.1.0 // indirect
2223
github.com/hashicorp/go-multierror v1.1.1 // indirect
2324
github.com/klauspost/compress v1.18.0 // indirect

benchmarks/event/go.sum

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,30 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo
44
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
55
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
66
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7-
github.com/go-orb/go-orb v0.2.2-0.20250307213241-c0f330c4e8b5 h1:K4T5dG4ptFOnV4S2zTipXy2WlrfDGXNHJXxXrEoD6DY=
8-
github.com/go-orb/go-orb v0.2.2-0.20250307213241-c0f330c4e8b5/go.mod h1:TO/Gnyh+NGy5S5vZj9sYf+U9LSFhwUeAxdlxiPtj6PY=
9-
github.com/go-orb/plugins/cli/urfave v0.0.0-20250307213404-581f83efe070 h1:CFJcYaOr+eJX4b9jDpRtmBO2PsUmRDVvZqh8FS7bV50=
10-
github.com/go-orb/plugins/cli/urfave v0.0.0-20250307213404-581f83efe070/go.mod h1:ZPkcMYjqv3JzJzlTdmMU8LzvzNjwWnRXQQXYr0oOFR0=
11-
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250307213404-581f83efe070 h1:bllOvFDTRm/LTUnhxWA8SlBPBb1KD541d523dldvVKQ=
12-
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250307213404-581f83efe070/go.mod h1:R9zH4zq0+a4/kjCaiOJ0qwiMtCKJGOjhmfOmnz0K/QQ=
13-
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250307213404-581f83efe070 h1:xr2D/6PgJcLzERpci6ROQcYgpQmpzKL52qL14em28yw=
14-
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250307213404-581f83efe070/go.mod h1:7jS2B6/GSV9OiuyCz7oe16YYGm/C2U8J7VrzPX0w0FA=
15-
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250307213404-581f83efe070 h1:GTzMlP5gHs9A4qGrcLpKIiBHj2a1+JzgtHJebubb8NE=
16-
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250307213404-581f83efe070/go.mod h1:/6yE6L6JZgojhcObI3T82zxGSf0Tj8Rqx8vbEAHTwiM=
17-
github.com/go-orb/plugins/event/natsjs v0.1.1-0.20250307213404-581f83efe070 h1:Xjn253XUdforY8vkDQn2YUEOR3n9UeXUMsWQTIydsQQ=
18-
github.com/go-orb/plugins/event/natsjs v0.1.1-0.20250307213404-581f83efe070/go.mod h1:jIo/ROVAMPIHLZefsRwrNzCFBTZr1+5l7YN0yWnwRQw=
19-
github.com/go-orb/plugins/log/slog v0.1.1-0.20250307213404-581f83efe070 h1:t1U3dy9kYoTfKpYD2K//+uZ01N0aPXuBcZGq9Vv9Kl4=
20-
github.com/go-orb/plugins/log/slog v0.1.1-0.20250307213404-581f83efe070/go.mod h1:bwn1a/XGY2wPZFSmjkvUNNUKIKiJTQ0Ru/uQHIJfwmQ=
7+
github.com/go-orb/go-orb v0.2.2-0.20250311013353-9996c5ae2659 h1:lgx4A5R5TKPrAKbg1v+XID/lL7ZgSXa3B20awh4yfI4=
8+
github.com/go-orb/go-orb v0.2.2-0.20250311013353-9996c5ae2659/go.mod h1:UgBB26ldvzHNjg6721K2o5DEM6qX44ZHqCW0SanoAFA=
9+
github.com/go-orb/plugins/cli/urfave v0.0.0-20250311025432-c3f6c11bc7a0 h1:auiIrfEVAochvBUqfxxJGS9rW0JErmGcy52ca6StW4k=
10+
github.com/go-orb/plugins/cli/urfave v0.0.0-20250311025432-c3f6c11bc7a0/go.mod h1:Yvfr2ylrseKWmn4cqLgWdv/cSt6Nsf5VCVS+XXWHva0=
11+
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250311025432-c3f6c11bc7a0 h1:PGrTGgF/+W83zuTisJaq4FCx7id1VVYTopAKQFz1ATM=
12+
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250311025432-c3f6c11bc7a0/go.mod h1:hrbbOHGv47dE0PWchJ1OAc9sEPZ6GcnJcPkB4fYgQ1E=
13+
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250311025432-c3f6c11bc7a0 h1:IX5kvi6quJptaZ4gp2otPkzGWARPP/maGAmik3uXN6A=
14+
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250311025432-c3f6c11bc7a0/go.mod h1:TY3dhUGx+cYbV8cUehQhmS0JOrBpCAc3Cc2VHncjLkE=
15+
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250311025432-c3f6c11bc7a0 h1:veQZltWsUJn3X9ICcGcYPOGwxG/6muNTo8fxJYiv2tQ=
16+
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250311025432-c3f6c11bc7a0/go.mod h1:O/JU+k2HGC/oCG5iA1WFcPgqIX497H1WEaAtluUiD0Q=
17+
github.com/go-orb/plugins/event/natsjs v0.1.1-0.20250311025432-c3f6c11bc7a0 h1:iAXxeTXcvVxGbbLI4/2144V8VHxiz2RG44mSEgg2ack=
18+
github.com/go-orb/plugins/event/natsjs v0.1.1-0.20250311025432-c3f6c11bc7a0/go.mod h1:2R5wT5QYDlUTCjCgfyZsC+FWpJ6RR8LFH/afqGhgYV8=
19+
github.com/go-orb/plugins/log/slog v0.1.1-0.20250311025432-c3f6c11bc7a0 h1:6q7S9LhbMdXqnduO1Dr6DHz4E0uuKBGOAey/X4Xdvn8=
20+
github.com/go-orb/plugins/log/slog v0.1.1-0.20250311025432-c3f6c11bc7a0/go.mod h1:C76zIgyBuHXnMLjQgFMQFDftekPUQ0DnbeRNnOnIwx0=
2121
github.com/go-orb/wire v0.7.0 h1:P9S100bM8nhAgW6e7EJrbi5vzNXCsP/Q1ByIEV5+hUQ=
2222
github.com/go-orb/wire v0.7.0/go.mod h1:/ID7hS6X2F32YnuRgh+k8R/sjucoh4qciqe7dq2dY7g=
2323
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
2424
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
2525
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
26-
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
27-
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
26+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
27+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
2828
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
29+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
30+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
2931
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
3032
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
3133
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=

benchmarks/rps/cmd/orb-rps-client/config.go

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ const (
1111

1212
defaultBypassRegistry = 1
1313
defaultConnections = 256
14+
defaultPoolSize = 256
1415
defaultDuration = 15
15-
defaultTimeout = 8
16+
defaultTimeout = 15
1617
defaultTransport = "grpc"
1718
defaultPackageSize = 1000
1819
defaultContentType = "application/x-protobuf"
@@ -29,63 +30,75 @@ func flags() []*cli.Flag {
2930
flags = append(flags, cli.NewFlag(
3031
"bypass_registry",
3132
defaultBypassRegistry,
32-
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "bypassRegistry"}}),
33+
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "bypassRegistry"}, IsGlobal: true}),
3334
cli.FlagUsage("Bypasses the registry by caching it, set to 0 to disable"),
3435
cli.FlagEnvVars("BYPASS_REGISTRY"),
3536
))
3637

38+
flags = append(flags, cli.NewFlag(
39+
"pool_size",
40+
defaultPoolSize,
41+
cli.FlagConfigPaths(
42+
cli.FlagConfigPath{Path: []string{"client", "poolSize"}},
43+
),
44+
cli.FlagUsage("Number of connections to keep open"),
45+
cli.FlagEnvVars("POOL_SIZE"),
46+
))
47+
3748
flags = append(flags, cli.NewFlag(
3849
"connections",
3950
defaultConnections,
40-
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "connections"}}),
51+
cli.FlagConfigPaths(
52+
cli.FlagConfigPath{Path: []string{configSection, "connections"}, IsGlobal: true},
53+
),
4154
cli.FlagUsage("Connections to keep open"),
4255
cli.FlagEnvVars("CONNECTIONS"),
4356
))
4457

4558
flags = append(flags, cli.NewFlag(
4659
"duration",
4760
defaultDuration,
48-
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "duration"}}),
61+
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "duration"}, IsGlobal: true}),
4962
cli.FlagUsage("Duration in seconds"),
5063
cli.FlagEnvVars("DURATION"),
5164
))
5265

5366
flags = append(flags, cli.NewFlag(
5467
"timeout",
5568
defaultTimeout,
56-
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "timeout"}}),
69+
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "timeout"}, IsGlobal: true}),
5770
cli.FlagUsage("Timeout in seconds"),
5871
cli.FlagEnvVars("TIMEOUT"),
5972
))
6073

6174
flags = append(flags, cli.NewFlag(
6275
"threads",
6376
defaultThreads,
64-
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "threads"}}),
77+
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "threads"}, IsGlobal: true}),
6578
cli.FlagUsage("Number of threads to use = runtime.GOMAXPROCS()"),
6679
cli.FlagEnvVars("THREADS"),
6780
))
6881

6982
flags = append(flags, cli.NewFlag(
7083
"transport",
7184
defaultTransport,
72-
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "transport"}}),
85+
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "transport"}, IsGlobal: true}),
7386
cli.FlagUsage("Transport to use (grpc, drpc, http, uvm.)"),
7487
cli.FlagEnvVars("TRANSPORT"),
7588
))
7689

7790
flags = append(flags, cli.NewFlag(
7891
"package_size",
7992
defaultPackageSize,
80-
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "packageSize"}}),
93+
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "packageSize"}, IsGlobal: true}),
8194
cli.FlagUsage("Per request package size"),
8295
cli.FlagEnvVars("PACKAGE_SIZE"),
8396
))
8497

8598
flags = append(flags, cli.NewFlag(
8699
"content_type",
87100
defaultContentType,
88-
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "contentType"}}),
101+
cli.FlagConfigPaths(cli.FlagConfigPath{Path: []string{configSection, "contentType"}, IsGlobal: true}),
89102
cli.FlagUsage("Content-Type (application/x-protobuf, application/x-protobuf+json)"),
90103
cli.FlagEnvVars("CONTENT_TYPE"),
91104
))
@@ -95,6 +108,7 @@ func flags() []*cli.Flag {
95108

96109
type clientConfig struct {
97110
BypassRegistry int `json:"bypassRegistry" yaml:"bypassRegistry"`
111+
PoolSize int `json:"poolSize" yaml:"poolSize"`
98112
Connections int `json:"connections" yaml:"connections"`
99113
Duration int `json:"duration" yaml:"duration"`
100114
Timeout int `json:"timeout" yaml:"timeout"`

0 commit comments

Comments
 (0)