Skip to content

Commit

Permalink
Update recipes and add tracing by OpenTelemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
olivere committed Mar 19, 2022
1 parent 4d9e00c commit dd99ab5
Show file tree
Hide file tree
Showing 17 changed files with 458 additions and 218 deletions.
15 changes: 12 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@ go 1.17
require (
github.com/aws/aws-sdk-go v1.43.21
github.com/fortytw2/leaktest v1.3.0
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/go-cmp v0.5.7
github.com/mailru/easyjson v0.7.7
github.com/opentracing/opentracing-go v1.2.0
github.com/pkg/errors v0.9.1
github.com/smartystreets/assertions v1.1.1 // indirect
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9
github.com/smartystreets/gunit v1.4.2 // indirect
go.opencensus.io v0.23.0
go.opentelemetry.io/otel v1.5.0
)

require (
github.com/go-logr/logr v1.2.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/smartystreets/assertions v1.1.1 // indirect
github.com/smartystreets/gunit v1.4.2 // indirect
go.opentelemetry.io/otel/trace v1.5.0 // indirect
)
1 change: 0 additions & 1 deletion recipes/go-modules/.gitignore

This file was deleted.

49 changes: 0 additions & 49 deletions recipes/go-modules/main.go

This file was deleted.

33 changes: 26 additions & 7 deletions recipes/go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
module github.com/olivere/elastic/recipes
module github.com/olivere/elastic/v7/recipes

go 1.14
go 1.17

require (
github.com/aws/aws-sdk-go v1.33.5
github.com/go-kit/kit v0.10.0 // indirect
github.com/google/uuid v1.1.1
github.com/olivere/elastic/v7 v7.0.18
github.com/aws/aws-sdk-go v1.43.21
github.com/google/uuid v1.3.0
github.com/olivere/elastic/v7 v7.0.0-00010101000000-000000000000
github.com/olivere/env v1.1.0
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9
github.com/uber/jaeger-client-go v2.25.0+incompatible
github.com/uber/jaeger-lib v2.2.0+incompatible
go.opentelemetry.io/otel v1.5.0
go.opentelemetry.io/otel/exporters/jaeger v1.5.0
go.opentelemetry.io/otel/sdk v1.5.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
)

require (
github.com/VividCortex/gohistogram v1.0.0 // indirect
github.com/go-kit/kit v0.10.0 // indirect
github.com/go-logr/logr v1.2.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/smartystreets/gunit v1.4.3 // indirect
go.opentelemetry.io/otel/trace v1.5.0 // indirect
go.uber.org/atomic v1.6.0 // indirect
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
)

replace github.com/olivere/elastic/v7 => ../../elastic
108 changes: 78 additions & 30 deletions recipes/go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion recipes/search_with_point_in_time/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/search
/search_with_point_in_time
8 changes: 0 additions & 8 deletions recipes/search_with_point_in_time/go.mod

This file was deleted.

109 changes: 0 additions & 109 deletions recipes/search_with_point_in_time/go.sum

This file was deleted.

4 changes: 2 additions & 2 deletions recipes/search_with_point_in_time/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
//
// Scroll through an index called "products".
//
// search -index=products -size=100
// ./search_with_point_in_time -index=products -size=100
//
// If you don't have an index, use the "populate" command to fill one.
//
// search -index=products populate
// ./search_with_point_in_time -index=products populate
//
package main

Expand Down
1 change: 1 addition & 0 deletions recipes/text_vs_keyword/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/text_vs_keyword
15 changes: 7 additions & 8 deletions recipes/tracing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

Run Jaeger (any other supported tracers work of course):

```
$ ./run-tracer.sh
```sh
./run-tracer.sh
```

Then open the web UI:

```
$ open http://localhost:16686
```sh
open http://localhost:16686
```

Then run the example, e.g.:

```
$ dep ensure # not necessary for Go 1.11 or later
$ go build
$ ./tracing -index=test -type=doc -n=100000 -bulk-size=100
```sh
go build
./tracing -index=test -type=doc -n=100000 -bulk-size=100
```
1 change: 1 addition & 0 deletions recipes/tracing/otel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/tracing
20 changes: 20 additions & 0 deletions recipes/tracing/otel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Tracing with OpenTelemetry

Run Jaeger (any other supported tracers work of course):

```sh
./run-tracer.sh
```

Then open the web UI:

```sh
open http://localhost:16686
```

Then run the example, e.g.:

```sh
go build
./tracing -index=test -type=doc -n=100000 -bulk-size=100
```
11 changes: 11 additions & 0 deletions recipes/tracing/otel/run-tracer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
docker run -d --name jaeger \
-e COLLECTOR_ZIPKIN_HTTP_PORT=9411 \
-p 5775:5775/udp \
-p 6831:6831/udp \
-p 6832:6832/udp \
-p 5778:5778 \
-p 16686:16686 \
-p 14268:14268 \
-p 9411:9411 \
jaegertracing/all-in-one:latest
Loading

0 comments on commit dd99ab5

Please sign in to comment.