From 5334d291c899ca1c1e196dc7ec562b5524957b5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Oct 2021 11:47:32 -0700 Subject: [PATCH 1/3] Bump golang.org/x/tools from 0.1.5 to 0.1.6 in /internal/tools (#2247) * Bump golang.org/x/tools from 0.1.5 to 0.1.6 in /internal/tools Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.5 to 0.1.6. - [Release notes](https://github.com/golang/tools/releases) - [Commits](https://github.com/golang/tools/compare/v0.1.5...v0.1.6) --- updated-dependencies: - dependency-name: golang.org/x/tools dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * %w can only be used with fmt.Errorf("...") * precommit * update to golang.org/x/tools-v0.1.7 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Evan Torrie Co-authored-by: Tyler Yahn --- internal/tools/go.mod | 2 +- internal/tools/go.sum | 8 ++++++-- trace/trace_test.go | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index c79161d351c..886dbb74385 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/build-tools/multimod v0.0.0-20210920164323-2ceabab23375 go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210920164323-2ceabab23375 golang.org/x/mod v0.5.1 // indirect - golang.org/x/tools v0.1.5 + golang.org/x/tools v0.1.7 ) replace go.opentelemetry.io/otel => ../.. diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 95f149f9414..46253fb418f 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -754,6 +754,7 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -888,8 +889,9 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -980,6 +982,7 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e h1:XMgFehsDnnLGtjvjOfqWSUzt0alpTR1RSEuznObga2c= golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -1093,8 +1096,9 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/trace/trace_test.go b/trace/trace_test.go index d6115f286b9..758c58185db 100644 --- a/trace/trace_test.go +++ b/trace/trace_test.go @@ -189,7 +189,7 @@ func TestSpanContextMarshalJSON(t *testing.T) { } have, err := sc.MarshalJSON() if err != nil { - t.Errorf("Marshaling failed: %w", err) + t.Errorf("Marshaling failed: %v", err) } if !bytes.Equal(have, testcase.want) { From d3f1ea2a501af692aa08590cd64a7f54e11b26c3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Oct 2021 12:00:17 -0700 Subject: [PATCH 2/3] Bump codecov/codecov-action from 2.0.3 to 2.1.0 (#2246) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2.0.3 to 2.1.0. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v2.0.3...v2.1.0) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebd5688fb85..bb9585d74ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,7 +95,7 @@ jobs: cp coverage.txt $TEST_RESULTS cp coverage.html $TEST_RESULTS - name: Upload coverage report - uses: codecov/codecov-action@v2.0.3 + uses: codecov/codecov-action@v2.1.0 with: file: ./coverage.txt fail_ci_if_error: true From c71afaf31ff960d79cd5f0f91e5f9977fb559f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B5nis=20Tiigi?= Date: Mon, 11 Oct 2021 12:23:12 -0700 Subject: [PATCH 3/3] allow otlp clients to use existing grpc connection (#2002) Signed-off-by: Tonis Tiigi Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 ++++ .../otlp/otlpmetric/internal/connection/connection.go | 4 ++++ exporters/otlp/otlpmetric/internal/otlpconfig/options.go | 1 + exporters/otlp/otlpmetric/otlpmetricgrpc/options.go | 8 ++++++++ .../otlp/otlptrace/internal/connection/connection.go | 4 ++++ exporters/otlp/otlptrace/internal/otlpconfig/options.go | 1 + exporters/otlp/otlptrace/otlptracegrpc/options.go | 8 ++++++++ 7 files changed, 30 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb122786042..35a18a4d6bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Adds `otlptracegrpc.WithGRPCConn` and `otlpmetricgrpc.WithGRPCConn` for reusing existing gRPC connection. (#2002) + ## [1.0.1] - 2021-10-01 ### Fixed diff --git a/exporters/otlp/otlpmetric/internal/connection/connection.go b/exporters/otlp/otlpmetric/internal/connection/connection.go index edfd07d34a1..4ace51f2201 100644 --- a/exporters/otlp/otlpmetric/internal/connection/connection.go +++ b/exporters/otlp/otlpmetric/internal/connection/connection.go @@ -220,6 +220,10 @@ func (c *Connection) setConnection(cc *grpc.ClientConn) bool { } func (c *Connection) dialToCollector(ctx context.Context) (*grpc.ClientConn, error) { + if c.cfg.GRPCConn != nil { + return c.cfg.GRPCConn, nil + } + dialOpts := []grpc.DialOption{} if c.cfg.ServiceConfig != "" { dialOpts = append(dialOpts, grpc.WithDefaultServiceConfig(c.cfg.ServiceConfig)) diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/options.go b/exporters/otlp/otlpmetric/internal/otlpconfig/options.go index cc46fc775ca..b5fb9ce2e67 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/options.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/options.go @@ -75,6 +75,7 @@ type ( ReconnectionPeriod time.Duration ServiceConfig string DialOptions []grpc.DialOption + GRPCConn *grpc.ClientConn RetrySettings RetrySettings } ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go index 9a551217308..c4dc9973e3c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go @@ -116,6 +116,14 @@ func WithDialOption(opts ...grpc.DialOption) Option { })} } +// WithGRPCConn allows reusing existing gRPC connection when it has already been +// established for other services. When set, other dial options will be ignored. +func WithGRPCConn(conn *grpc.ClientConn) Option { + return wrappedOption{otlpconfig.NewGRPCOption(func(cfg *otlpconfig.Config) { + cfg.GRPCConn = conn + })} +} + // WithTimeout tells the client the max waiting time for the backend to process // each metrics batch. If unset, the default will be 10 seconds. func WithTimeout(duration time.Duration) Option { diff --git a/exporters/otlp/otlptrace/internal/connection/connection.go b/exporters/otlp/otlptrace/internal/connection/connection.go index b2b94731fd6..67e06888c89 100644 --- a/exporters/otlp/otlptrace/internal/connection/connection.go +++ b/exporters/otlp/otlptrace/internal/connection/connection.go @@ -221,6 +221,10 @@ func (c *Connection) setConnection(cc *grpc.ClientConn) bool { } func (c *Connection) dialToCollector(ctx context.Context) (*grpc.ClientConn, error) { + if c.cfg.GRPCConn != nil { + return c.cfg.GRPCConn, nil + } + dialOpts := []grpc.DialOption{} if c.cfg.ServiceConfig != "" { dialOpts = append(dialOpts, grpc.WithDefaultServiceConfig(c.cfg.ServiceConfig)) diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/internal/otlpconfig/options.go index 0ec2c879eae..8e21250c674 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options.go @@ -58,6 +58,7 @@ type ( ReconnectionPeriod time.Duration ServiceConfig string DialOptions []grpc.DialOption + GRPCConn *grpc.ClientConn } ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/options.go b/exporters/otlp/otlptrace/otlptracegrpc/options.go index d2cf76461cc..86bfc1dc8a5 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -116,6 +116,14 @@ func WithDialOption(opts ...grpc.DialOption) Option { })} } +// WithGRPCConn allows reusing existing gRPC connection when it has already been +// established for other services. When set, other dial options will be ignored. +func WithGRPCConn(conn *grpc.ClientConn) Option { + return wrappedOption{otlpconfig.NewGRPCOption(func(cfg *otlpconfig.Config) { + cfg.GRPCConn = conn + })} +} + // WithTimeout tells the driver the max waiting time for the backend to process // each spans batch. If unset, the default will be 10 seconds. func WithTimeout(duration time.Duration) Option {