From 0af882dedb16dc04e34f788aa5caf54fef5d5d38 Mon Sep 17 00:00:00 2001 From: Injun Song Date: Mon, 1 Mar 2021 07:34:52 +0900 Subject: [PATCH 1/2] Use reasonable interval in sdktrace.WithBatchTimeout This patch resolves #1564. --- CHANGELOG.md | 1 + exporters/otlp/internal/otlptest/otlptest.go | 2 +- exporters/otlp/otlpgrpc/example_test.go | 6 +++--- exporters/otlp/otlpgrpc/otlp_integration_test.go | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 463d3403c137..25ad8cf051d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - AttributePerEventCountLimit and AttributePerLinkCountLimit for SpanLimits. (#1535) - Added `Keys()` method to `propagation.TextMapCarrier` and `propagation.HeaderCarrier` to adapt `http.Header` to this interface. (#1544) - Added `code` attributes to `go.opentelemetry.io/otel/semconv` package. (#1558) +- Changed all examples to use `WithBatchTimeout(5 * time.Second)` rather than `WithBatchTimeout(5)` (#0000) ### Changed diff --git a/exporters/otlp/internal/otlptest/otlptest.go b/exporters/otlp/internal/otlptest/otlptest.go index fa95a08d3a04..ac21f893750e 100644 --- a/exporters/otlp/internal/otlptest/otlptest.go +++ b/exporters/otlp/internal/otlptest/otlptest.go @@ -44,7 +44,7 @@ func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlp.Exporter, mcTr sdktrace.WithBatcher( exp, // add following two options to ensure flush - sdktrace.WithBatchTimeout(5), + sdktrace.WithBatchTimeout(5*time.Second), sdktrace.WithMaxExportBatchSize(10), ), } diff --git a/exporters/otlp/otlpgrpc/example_test.go b/exporters/otlp/otlpgrpc/example_test.go index 96959dac387d..d2e7785fa42f 100644 --- a/exporters/otlp/otlpgrpc/example_test.go +++ b/exporters/otlp/otlpgrpc/example_test.go @@ -53,7 +53,7 @@ func Example_insecure() { sdktrace.WithBatcher( exp, // add following two options to ensure flush - sdktrace.WithBatchTimeout(5), + sdktrace.WithBatchTimeout(5*time.Second), sdktrace.WithMaxExportBatchSize(10), ), ) @@ -106,7 +106,7 @@ func Example_withTLS() { sdktrace.WithBatcher( exp, // add following two options to ensure flush - sdktrace.WithBatchTimeout(5), + sdktrace.WithBatchTimeout(5*time.Second), sdktrace.WithMaxExportBatchSize(10), ), ) @@ -167,7 +167,7 @@ func Example_withDifferentSignalCollectors() { sdktrace.WithBatcher( exp, // add following two options to ensure flush - sdktrace.WithBatchTimeout(5), + sdktrace.WithBatchTimeout(5*time.Second), sdktrace.WithMaxExportBatchSize(10), ), ) diff --git a/exporters/otlp/otlpgrpc/otlp_integration_test.go b/exporters/otlp/otlpgrpc/otlp_integration_test.go index 499be7573723..2004f691abfd 100644 --- a/exporters/otlp/otlpgrpc/otlp_integration_test.go +++ b/exporters/otlp/otlpgrpc/otlp_integration_test.go @@ -337,7 +337,7 @@ func TestNewExporter_withMultipleAttributeTypes(t *testing.T) { sdktrace.WithBatcher( exp, // add following two options to ensure flush - sdktrace.WithBatchTimeout(5), + sdktrace.WithBatchTimeout(5*time.Second), sdktrace.WithMaxExportBatchSize(10), ), ) From 714f88524f31fcc824c0178bb2363abc7df85902 Mon Sep 17 00:00:00 2001 From: Injun Song Date: Mon, 1 Mar 2021 07:45:05 +0900 Subject: [PATCH 2/2] Add pull request ID to CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25ad8cf051d9..4ef3b9964152 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - AttributePerEventCountLimit and AttributePerLinkCountLimit for SpanLimits. (#1535) - Added `Keys()` method to `propagation.TextMapCarrier` and `propagation.HeaderCarrier` to adapt `http.Header` to this interface. (#1544) - Added `code` attributes to `go.opentelemetry.io/otel/semconv` package. (#1558) -- Changed all examples to use `WithBatchTimeout(5 * time.Second)` rather than `WithBatchTimeout(5)` (#0000) +- Changed all examples to use `WithBatchTimeout(5 * time.Second)` rather than `WithBatchTimeout(5)` (#1621) ### Changed