Skip to content

Commit 0f4a6f2

Browse files
Use OTEL Exporter instead of Jaeger Exporter (#18)
I have used the otel exporter instead of the jaeger exporter. Also ran `go get -d -t ./...` and `go mod tidy` and fixed errors caused by it. Use the `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` ```bash export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:14268/api/traces ``` --------- Signed-off-by: FlamingSaint <[email protected]> Signed-off-by: Yuri Shkuro <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]>
1 parent c0fd0b7 commit 0f4a6f2

File tree

13 files changed

+119
-104
lines changed

13 files changed

+119
-104
lines changed

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ between simulations in each worker.
2121

2222
The tool comes with a built-in configuration for Jaeger's HotROD application that can be printed with:
2323

24-
```sh
24+
```shell
2525
docker run yurishkuro/microsim -o | jq
2626
```
2727

@@ -35,10 +35,27 @@ docker run yurishkuro/microsim -o | jq
3535

3636
To see all command line options:
3737

38-
```sh
38+
```shell
3939
docker run yurishkuro/microsim -h
4040
```
4141

42+
`microsim` uses OpenTelemetry SDK to export traces. By default it will try to send them to `https://localhost:4318/v1/traces` (with TLS enabled). This can be changed by setting environment variables supported by the SDK:
43+
* `OTEL_EXPORTER_OTLP_ENDPOINT` to point to a different host/port.
44+
* `OTEL_EXPORTER_OTLP_INSECURE=true` if you just want to switch default URL to `http` instead of `https`.
45+
46+
Note that when we run `microsim` as a container, the `localhost` refers to the container's inner network namespace, so it will not be able to reach the collector even if it's running on the same host. You might see an error like this:
47+
48+
```
49+
2024/07/02 18:06:07 traces export: Post "https://localhost:4318/v1/traces": dial tcp [::1]:4318: connect: connection refused
50+
```
51+
52+
To work around that, refer to the IP address of the host instead:
53+
54+
```shell
55+
docker run --env OTEL_EXPORTER_OTLP_ENDPOINT=https://{YOUR_IP_ADDRESS}:4318/v1/traces \
56+
yurishkuro/microsim -w=1 -r=1
57+
```
58+
4259
## License
4360

4461
MIT license.

client/client.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
// Get makes a traced HTTP GET call.
13-
func Get(ctx context.Context, url string, tracer trace.Tracer) error {
13+
func Get(ctx context.Context, url string, tp trace.TracerProvider) error {
1414
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
1515
if err != nil {
1616
return err
@@ -19,7 +19,7 @@ func Get(ctx context.Context, url string, tracer trace.Tracer) error {
1919
client := http.Client{
2020
Transport: otelhttp.NewTransport(
2121
http.DefaultTransport,
22-
otelhttp.WithTracerProvider(&tracerProvider{tracer}),
22+
otelhttp.WithTracerProvider(tp),
2323
),
2424
}
2525
res, err := client.Do(req)
@@ -34,11 +34,3 @@ func Get(ctx context.Context, url string, tracer trace.Tracer) error {
3434

3535
return nil
3636
}
37-
38-
type tracerProvider struct {
39-
tracer trace.Tracer
40-
}
41-
42-
func (p *tracerProvider) Tracer(_ string, _ ...trace.TracerOption) trace.Tracer {
43-
return p.tracer
44-
}

go.mod

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
module github.com/yurishkuro/microsim
22

3-
go 1.18
3+
go 1.21
4+
5+
toolchain go1.22.3
46

57
require (
6-
github.com/opentracing-contrib/go-stdlib v1.0.0
7-
github.com/opentracing/opentracing-go v1.2.0
8-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.3
9-
go.opentelemetry.io/otel v1.11.0
10-
go.opentelemetry.io/otel/exporters/jaeger v1.11.0
11-
go.opentelemetry.io/otel/sdk v1.11.0
12-
go.opentelemetry.io/otel/trace v1.11.0
8+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0
9+
go.opentelemetry.io/otel v1.27.0
10+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0
11+
go.opentelemetry.io/otel/sdk v1.27.0
12+
go.opentelemetry.io/otel/trace v1.27.0
1313
)
1414

1515
require (
16-
github.com/felixge/httpsnoop v1.0.3 // indirect
17-
github.com/go-logr/logr v1.2.3 // indirect
16+
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
17+
github.com/felixge/httpsnoop v1.0.4 // indirect
18+
github.com/go-logr/logr v1.4.1 // indirect
1819
github.com/go-logr/stdr v1.2.2 // indirect
19-
go.opentelemetry.io/otel/metric v0.32.3 // indirect
20-
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
20+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
21+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 // indirect
22+
go.opentelemetry.io/otel/metric v1.27.0 // indirect
23+
go.opentelemetry.io/proto/otlp v1.2.0 // indirect
24+
golang.org/x/net v0.25.0 // indirect
25+
golang.org/x/sys v0.20.0 // indirect
26+
golang.org/x/text v0.15.0 // indirect
27+
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 // indirect
28+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect
29+
google.golang.org/grpc v1.64.0 // indirect
30+
google.golang.org/protobuf v1.34.1 // indirect
2131
)

go.sum

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,51 @@
1-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1+
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
2+
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
23
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3-
github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
4-
github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
4+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5+
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
6+
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
57
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
6-
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
7-
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
8+
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
9+
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
810
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
911
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
10-
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
11-
github.com/opentracing-contrib/go-stdlib v1.0.0 h1:TBS7YuVotp8myLon4Pv7BtCBzOTo1DeZCld0Z63mW2w=
12-
github.com/opentracing-contrib/go-stdlib v1.0.0/go.mod h1:qtI1ogk+2JhVPIXVc6q+NHziSmy2W5GbdQZFUHADCBU=
13-
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
14-
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
15-
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
12+
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
13+
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
14+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0=
15+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
1616
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1717
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
18-
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
19-
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
20-
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
21-
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
22-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.3 h1:SGz6Fnp7blR+sskRZkyuFDb3qI1d8I0ygLh13F+sw6I=
23-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.3/go.mod h1:+OXcluxum2GicWQ9lMXLQkLkOWoaw20OrVbYq6kkPks=
24-
go.opentelemetry.io/otel v1.11.0 h1:kfToEGMDq6TrVrJ9Vht84Y8y9enykSZzDDZglV0kIEk=
25-
go.opentelemetry.io/otel v1.11.0/go.mod h1:H2KtuEphyMvlhZ+F7tg9GRhAOe60moNx61Ex+WmiKkk=
26-
go.opentelemetry.io/otel/exporters/jaeger v1.11.0 h1:Sv2valcFfMlfu6g8USSS+ZUN5vwbuGj1aY/CFtMG33w=
27-
go.opentelemetry.io/otel/exporters/jaeger v1.11.0/go.mod h1:nRgyJbgJ0hmaUdHwyDpTTfBYz61cTTeeGhVzfQc+FsI=
28-
go.opentelemetry.io/otel/metric v0.32.3 h1:dMpnJYk2KULXr0j8ph6N7+IcuiIQXlPXD4kix9t7L9c=
29-
go.opentelemetry.io/otel/metric v0.32.3/go.mod h1:pgiGmKohxHyTPHGOff+vrtIH39/R9fiO/WoenUQ3kcc=
30-
go.opentelemetry.io/otel/sdk v1.11.0 h1:ZnKIL9V9Ztaq+ME43IUi/eo22mNsb6a7tGfzaOWB5fo=
31-
go.opentelemetry.io/otel/sdk v1.11.0/go.mod h1:REusa8RsyKaq0OlyangWXaw97t2VogoO4SSEeKkSTAk=
32-
go.opentelemetry.io/otel/trace v1.11.0 h1:20U/Vj42SX+mASlXLmSGBg6jpI1jQtv682lZtTAOVFI=
33-
go.opentelemetry.io/otel/trace v1.11.0/go.mod h1:nyYjis9jy0gytE9LXGU+/m1sHTKbRY0fX0hulNNDP1U=
34-
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc=
35-
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
18+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
19+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
20+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 h1:9l89oX4ba9kHbBol3Xin3leYJ+252h0zszDtBwyKe2A=
21+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0/go.mod h1:XLZfZboOJWHNKUv7eH0inh0E9VV6eWDFB/9yJyTLPp0=
22+
go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg=
23+
go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ=
24+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 h1:R9DE4kQ4k+YtfLI2ULwX82VtNQ2J8yZmA7ZIF/D+7Mc=
25+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0/go.mod h1:OQFyQVrDlbe+R7xrEyDr/2Wr67Ol0hRUgsfA+V5A95s=
26+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0 h1:QY7/0NeRPKlzusf40ZE4t1VlMKbqSNT7cJRYzWuja0s=
27+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0/go.mod h1:HVkSiDhTM9BoUJU8qE6j2eSWLLXvi1USXjyd2BXT8PY=
28+
go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik=
29+
go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak=
30+
go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI=
31+
go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A=
32+
go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw=
33+
go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4=
34+
go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94=
35+
go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A=
36+
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
37+
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
38+
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
39+
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
40+
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
41+
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
42+
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 h1:P8OJ/WCl/Xo4E4zoe4/bifHpSmmKwARqyqE4nW6J2GQ=
43+
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5/go.mod h1:RGnPtTG7r4i8sPlNyDeikXF99hMM+hN6QMm4ooG9g2g=
44+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 h1:AgADTJarZTBqgjiUzRgfaBchgYB3/WFTC80GPwsMcRI=
45+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
46+
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
47+
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
48+
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
49+
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
3650
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
51+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010

1111
"github.com/yurishkuro/microsim/config"
1212
"github.com/yurishkuro/microsim/model"
13-
"github.com/yurishkuro/microsim/tracing"
1413
)
1514

1615
var (
@@ -24,7 +23,6 @@ var (
2423
)
2524

2625
func main() {
27-
flag.StringVar(&tracing.JaegerCollectorURL, "j", tracing.JaegerCollectorURL, "address of Jaeger collector to submit spans")
2826
flag.Parse()
2927

3028
if *simulation == "" {

model/config.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (c *Config) Run() {
8686
}
8787

8888
func (c *Config) runWorker(instanceName string, stop chan struct{}, done *sync.WaitGroup) {
89-
tracer, shutdown, err := tracing.InitTracer("test-executor", instanceName)
89+
tracerProvider, shutdown, err := tracing.InitTracer("test-executor", instanceName)
9090
if err != nil {
9191
log.Fatalf("failed to create a tracer: %v", err)
9292
}
@@ -98,7 +98,7 @@ func (c *Config) runWorker(instanceName string, stop chan struct{}, done *sync.W
9898
case <-stop:
9999
return
100100
default:
101-
c.runTest(tracer)
101+
c.runTest(tracerProvider)
102102
}
103103
if repeats > 0 {
104104
repeats--
@@ -109,19 +109,19 @@ func (c *Config) runWorker(instanceName string, stop chan struct{}, done *sync.W
109109
}
110110
}
111111

112-
func (c *Config) runTest(tracer trace.Tracer) {
112+
func (c *Config) runTest(tracerProvider trace.TracerProvider) {
113113
rootSvc := c.Services[0]
114114
inst := rootSvc.instances[0]
115115
endpoint := inst.Endpoints[0]
116-
116+
tracer := tracerProvider.Tracer("worker")
117117
ctx, rootSpan := tracer.Start(
118118
context.Background(),
119119
"runTest",
120120
trace.WithAttributes(attribute.String("test_name", c.TestName)),
121121
)
122122
defer rootSpan.End()
123123

124-
err := endpoint.Call(ctx, tracer)
124+
err := endpoint.Call(ctx, tracerProvider)
125125
if err != nil {
126126
log.Printf("transaction failed: %v", err)
127127
}

model/dependencies.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ func (d *Dependencies) Validate(r *Registry) error {
4242
}
4343

4444
// Call makes calls to all dependencies.
45-
func (d *Dependencies) Call(ctx context.Context, tracer trace.Tracer) error {
45+
func (d *Dependencies) Call(ctx context.Context, tracerProvider trace.TracerProvider) error {
4646
if len(d.Seq) > 0 {
47-
return d.Seq.Call(ctx, tracer)
47+
return d.Seq.Call(ctx, tracerProvider)
4848
}
4949
if d.Par != nil {
50-
return d.Par.Call(ctx, tracer)
50+
return d.Par.Call(ctx, tracerProvider)
5151
}
52-
return d.Service.Call(ctx, tracer)
52+
return d.Service.Call(ctx, tracerProvider)
5353
}

model/endpoint_instance.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ func (e *EndpointInstance) ServeHTTP(w http.ResponseWriter, r *http.Request) {
2626
// executes the endpoint, calling dependencies if necessary.
2727
func (e *EndpointInstance) execute(ctx context.Context) error {
2828
if e.Depends != nil {
29-
if err := e.Depends.Call(ctx, e.service.tracing.tracer); err != nil {
29+
if err := e.Depends.Call(ctx, e.service.tracing.tracerProvider); err != nil {
3030
return err
3131
}
3232
}
3333
return e.Perf.Apply(ctx)
3434
}
3535

3636
// Call makes a call to this endpoint.
37-
func (e *EndpointInstance) Call(ctx context.Context, tracer trace.Tracer) error {
37+
func (e *EndpointInstance) Call(ctx context.Context, tracerProvider trace.TracerProvider) error {
3838
url := e.service.server.URL + e.Name
39-
return client.Get(ctx, url, tracer)
39+
return client.Get(ctx, url, tracerProvider)
4040
}

model/parallel.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ func (p *Parallel) Validate(r *Registry) error {
3232
}
3333

3434
// Call makes calls to all dependencies.
35-
func (p *Parallel) Call(ctx context.Context, tracer trace.Tracer) error {
35+
func (p *Parallel) Call(ctx context.Context, tracerProvider trace.TracerProvider) error {
3636
if p.MaxPar == 0 {
37-
return p.fullParCall(ctx, tracer)
37+
return p.fullParCall(ctx, tracerProvider)
3838
}
39-
return p.maxParCall(ctx, tracer)
39+
return p.maxParCall(ctx, tracerProvider)
4040
}
4141

42-
func (p *Parallel) fullParCall(ctx context.Context, tracer trace.Tracer) error {
42+
func (p *Parallel) fullParCall(ctx context.Context, tracerProvider trace.TracerProvider) error {
4343
// done := &sync.WaitGroup{}
4444
// done.Add(len(p.Items))
4545

@@ -54,7 +54,7 @@ func (p *Parallel) fullParCall(ctx context.Context, tracer trace.Tracer) error {
5454
return nil
5555
}
5656

57-
func (p *Parallel) maxParCall(ctx context.Context, tracer trace.Tracer) error {
57+
func (p *Parallel) maxParCall(ctx context.Context, tracerProvider trace.TracerProvider) error {
5858
done := &sync.WaitGroup{}
5959
done.Add(len(p.Items))
6060

@@ -70,7 +70,7 @@ func (p *Parallel) maxParCall(ctx context.Context, tracer trace.Tracer) error {
7070
for i := 0; i < p.MaxPar; i++ {
7171
go func() {
7272
for n := range ch {
73-
err := p.Items[n].Call(ctx, tracer)
73+
err := p.Items[n].Call(ctx, tracerProvider)
7474
if err != nil {
7575
errMutex.Lock()
7676
topErrors = append(topErrors, err)

model/sequence.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ func (s Sequence) Validate(r *Registry) error {
2121
}
2222

2323
// Call makes calls to all dependencies.
24-
func (s Sequence) Call(ctx context.Context, tracer trace.Tracer) error {
24+
func (s Sequence) Call(ctx context.Context, tracerProvider trace.TracerProvider) error {
2525
for _, dep := range s {
26-
if err := dep.Call(ctx, tracer); err != nil {
26+
if err := dep.Call(ctx, tracerProvider); err != nil {
2727
return err
2828
}
2929
}

0 commit comments

Comments
 (0)