From 51bc047f36d00595ec42e5166576770b4409d5ca Mon Sep 17 00:00:00 2001 From: Jacky Shang Date: Mon, 15 Aug 2022 10:28:56 +0800 Subject: [PATCH 01/11] Fix Issue 1848 --- .../ConsoleExporter.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleExporter.cs b/src/OpenTelemetry.Exporter.Console/ConsoleExporter.cs index edca47e2e24..241ba9cdbd7 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleExporter.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleExporter.cs @@ -20,6 +20,7 @@ public abstract class ConsoleExporter : BaseExporter where T : class { private readonly ConsoleExporterOptions options; + private bool disposed = false; protected ConsoleExporter(ConsoleExporterOptions options) { @@ -28,6 +29,11 @@ protected ConsoleExporter(ConsoleExporterOptions options) protected void WriteLine(string message) { + if (this.disposed) + { + return; + } + if (this.options.Targets.HasFlag(ConsoleExporterOutputTargets.Console)) { System.Console.WriteLine(message); @@ -38,5 +44,13 @@ protected void WriteLine(string message) System.Diagnostics.Trace.WriteLine(message); } } + + protected override void Dispose(bool disposing) + { + if (disposing) + { + this.disposed = true; + } + } } } From d44c7a8a3325abd346e7a0849329650533c4ba46 Mon Sep 17 00:00:00 2001 From: Jacky Shang Date: Mon, 15 Aug 2022 13:30:12 +0800 Subject: [PATCH 02/11] add the new function to publicAPI doc --- .../.publicApi/net462/PublicAPI.Unshipped.txt | 1 + .../.publicApi/netstandard2.0/PublicAPI.Unshipped.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/src/OpenTelemetry.Exporter.Console/.publicApi/net462/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.Console/.publicApi/net462/PublicAPI.Unshipped.txt index e69de29bb2d..4d72a55638f 100644 --- a/src/OpenTelemetry.Exporter.Console/.publicApi/net462/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Exporter.Console/.publicApi/net462/PublicAPI.Unshipped.txt @@ -0,0 +1 @@ +override OpenTelemetry.Exporter.ConsoleExporter.Dispose(bool disposing) -> void diff --git a/src/OpenTelemetry.Exporter.Console/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.Console/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt index e69de29bb2d..4d72a55638f 100644 --- a/src/OpenTelemetry.Exporter.Console/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Exporter.Console/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt @@ -0,0 +1 @@ +override OpenTelemetry.Exporter.ConsoleExporter.Dispose(bool disposing) -> void From 699472c6117c6325a65fb4a71609db5d516953f6 Mon Sep 17 00:00:00 2001 From: Jacky Shang Date: Tue, 16 Aug 2022 07:05:59 +0800 Subject: [PATCH 03/11] rather than stop exporting data, added a special message telling users that something went wrong --- .../.publicApi/net462/PublicAPI.Unshipped.txt | 2 +- .../netstandard2.0/PublicAPI.Unshipped.txt | 2 +- .../ConsoleExporter.cs | 14 -------------- .../ConsoleLogRecordExporter.cs | 14 ++++++++++++++ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/OpenTelemetry.Exporter.Console/.publicApi/net462/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.Console/.publicApi/net462/PublicAPI.Unshipped.txt index 4d72a55638f..91e9fc8830a 100644 --- a/src/OpenTelemetry.Exporter.Console/.publicApi/net462/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Exporter.Console/.publicApi/net462/PublicAPI.Unshipped.txt @@ -1 +1 @@ -override OpenTelemetry.Exporter.ConsoleExporter.Dispose(bool disposing) -> void +override OpenTelemetry.Exporter.ConsoleLogRecordExporter.Dispose(bool disposing) -> void diff --git a/src/OpenTelemetry.Exporter.Console/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.Console/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt index 4d72a55638f..91e9fc8830a 100644 --- a/src/OpenTelemetry.Exporter.Console/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Exporter.Console/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt @@ -1 +1 @@ -override OpenTelemetry.Exporter.ConsoleExporter.Dispose(bool disposing) -> void +override OpenTelemetry.Exporter.ConsoleLogRecordExporter.Dispose(bool disposing) -> void diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleExporter.cs b/src/OpenTelemetry.Exporter.Console/ConsoleExporter.cs index 241ba9cdbd7..edca47e2e24 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleExporter.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleExporter.cs @@ -20,7 +20,6 @@ public abstract class ConsoleExporter : BaseExporter where T : class { private readonly ConsoleExporterOptions options; - private bool disposed = false; protected ConsoleExporter(ConsoleExporterOptions options) { @@ -29,11 +28,6 @@ protected ConsoleExporter(ConsoleExporterOptions options) protected void WriteLine(string message) { - if (this.disposed) - { - return; - } - if (this.options.Targets.HasFlag(ConsoleExporterOutputTargets.Console)) { System.Console.WriteLine(message); @@ -44,13 +38,5 @@ protected void WriteLine(string message) System.Diagnostics.Trace.WriteLine(message); } } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - this.disposed = true; - } - } } } diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs index d538c59fb16..2fa8bd4d72b 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs @@ -23,6 +23,7 @@ namespace OpenTelemetry.Exporter public class ConsoleLogRecordExporter : ConsoleExporter { private const int RightPaddingLength = 35; + private bool disposed = false; public ConsoleLogRecordExporter(ConsoleExporterOptions options) : base(options) @@ -33,6 +34,11 @@ public override ExportResult Export(in Batch batch) { foreach (var logRecord in batch) { + if (this.disposed) + { + this.WriteLine("Something is wrong: the ConsoleLogger has been disposed."); + } + this.WriteLine($"{"LogRecord.Timestamp:",-RightPaddingLength}{logRecord.Timestamp:yyyy-MM-ddTHH:mm:ss.fffffffZ}"); if (logRecord.TraceId != default) @@ -129,5 +135,13 @@ void ProcessScope(LogRecordScope scope, ConsoleLogRecordExporter exporter) return ExportResult.Success; } + + protected override void Dispose(bool disposing) + { + if (disposing) + { + this.disposed = true; + } + } } } From a0e25ba74d908cecb1b78768a9b462ccc3c63411 Mon Sep 17 00:00:00 2001 From: Jacky Shang Date: Mon, 29 Aug 2022 11:52:55 +0800 Subject: [PATCH 04/11] 1. Record the callstack when the ConsoleExporter is disposed. 2. If ConsoleExporter.Export is ever called after it is disposed, depending on whether it is the 1st time: 2.1 if it is the first time - outputs an error message - including "what happened" and "what's the consequence" and "what should be done in order to fix the issue", plus two callstacks 1) the callstack where the export is being called 2) the callstack where dispose happened. 2.2 if it is not the first time, simply drop the data and don't output anything. 3. Everything here has to be done in a thread-safe manner. --- .../ConsoleLogRecordExporter.cs | 43 ++++++++++++++++--- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs index 2fa8bd4d72b..7019ce5f42a 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; using OpenTelemetry.Logs; using OpenTelemetry.Resources; @@ -23,7 +24,10 @@ namespace OpenTelemetry.Exporter public class ConsoleLogRecordExporter : ConsoleExporter { private const int RightPaddingLength = 35; + private readonly object disposeLockObj = new(); private bool disposed = false; + private string disposedStackTrace; + private bool isDisposeMessageSent = false; public ConsoleLogRecordExporter(ConsoleExporterOptions options) : base(options) @@ -32,13 +36,14 @@ public ConsoleLogRecordExporter(ConsoleExporterOptions options) public override ExportResult Export(in Batch batch) { - foreach (var logRecord in batch) + if (this.disposed) { - if (this.disposed) - { - this.WriteLine("Something is wrong: the ConsoleLogger has been disposed."); - } + this.SendDisposedMessage(); + return ExportResult.Failure; + } + foreach (var logRecord in batch) + { this.WriteLine($"{"LogRecord.Timestamp:",-RightPaddingLength}{logRecord.Timestamp:yyyy-MM-ddTHH:mm:ss.fffffffZ}"); if (logRecord.TraceId != default) @@ -138,9 +143,33 @@ void ProcessScope(LogRecordScope scope, ConsoleLogRecordExporter exporter) protected override void Dispose(bool disposing) { - if (disposing) + lock (this.disposeLockObj) + { + if (!this.disposed) + { + this.disposed = true; + this.disposedStackTrace = Environment.StackTrace; + } + } + + base.Dispose(disposing); + } + + private void SendDisposedMessage() + { + lock (this.disposeLockObj) { - this.disposed = true; + if (this.isDisposeMessageSent) + { + return; + } + + this.isDisposeMessageSent = true; + + this.WriteLine("The console exporter is still being invoked after it has been disposed. This could be the result of invalid lifecycle management of the OpenTelemetry .NET SDK."); + this.WriteLine(Environment.StackTrace); + this.WriteLine(Environment.NewLine + "The console exporter has been disposed"); + this.WriteLine(this.disposedStackTrace); } } } From d4551314db6ae8cdad4e3c14486308b144c529b6 Mon Sep 17 00:00:00 2001 From: Jacky Shang Date: Tue, 30 Aug 2022 10:25:47 +0800 Subject: [PATCH 05/11] Double-checking locking --- .../ConsoleLogRecordExporter.cs | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs index 7019ce5f42a..6138e6af279 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs @@ -143,12 +143,15 @@ void ProcessScope(LogRecordScope scope, ConsoleLogRecordExporter exporter) protected override void Dispose(bool disposing) { - lock (this.disposeLockObj) + if (!this.disposed) { - if (!this.disposed) + lock (this.disposeLockObj) { - this.disposed = true; - this.disposedStackTrace = Environment.StackTrace; + if (!this.disposed) + { + this.disposed = true; + this.disposedStackTrace = Environment.StackTrace; + } } } @@ -157,19 +160,19 @@ protected override void Dispose(bool disposing) private void SendDisposedMessage() { - lock (this.disposeLockObj) + if (!this.isDisposeMessageSent) { - if (this.isDisposeMessageSent) + lock (this.disposeLockObj) { - return; + if (!this.isDisposeMessageSent) + { + this.isDisposeMessageSent = true; + this.WriteLine("The console exporter is still being invoked after it has been disposed. This could be the result of invalid lifecycle management of the OpenTelemetry .NET SDK."); + this.WriteLine(Environment.StackTrace); + this.WriteLine(Environment.NewLine + "The console exporter has been disposed"); + this.WriteLine(this.disposedStackTrace); + } } - - this.isDisposeMessageSent = true; - - this.WriteLine("The console exporter is still being invoked after it has been disposed. This could be the result of invalid lifecycle management of the OpenTelemetry .NET SDK."); - this.WriteLine(Environment.StackTrace); - this.WriteLine(Environment.NewLine + "The console exporter has been disposed"); - this.WriteLine(this.disposedStackTrace); } } } From 5b3e2bf08bd2acc1a89b3645fd49985f4d215c5c Mon Sep 17 00:00:00 2001 From: Jacky Shang Date: Tue, 30 Aug 2022 13:42:56 +0800 Subject: [PATCH 06/11] update changelog --- src/OpenTelemetry.Exporter.Console/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md index 6fc70d7bd85..c3a93657b0b 100644 --- a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +* Changed error handling, `ConsoleExporter` will only output an error message with two call stacks the first time, + then the data will simply be deleted and nothing will be output. + ([#1848](https://github.com/open-telemetry/opentelemetry-dotnet/issues/1848)) + ## 1.4.0-alpha.2 Released 2022-Aug-18 From 0b7aea7f1b68e022f823fa6784e3c32e585cf8a2 Mon Sep 17 00:00:00 2001 From: Jacky Shang Date: Wed, 31 Aug 2022 09:57:59 +0800 Subject: [PATCH 07/11] remove the SendDisposedMessage method --- .../CHANGELOG.md | 5 +-- .../ConsoleLogRecordExporter.cs | 34 ++++++++----------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md index c3a93657b0b..0abe0370af9 100644 --- a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md @@ -2,8 +2,9 @@ ## Unreleased -* Changed error handling, `ConsoleExporter` will only output an error message with two call stacks the first time, - then the data will simply be deleted and nothing will be output. +* Changed error handling, `ConsoleExporter` will only output an error message + with two call stacks the first time, + then the data will simply be dropped and nothing will be output. ([#1848](https://github.com/open-telemetry/opentelemetry-dotnet/issues/1848)) ## 1.4.0-alpha.2 diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs index 6138e6af279..05878d6e9ed 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs @@ -38,7 +38,21 @@ public override ExportResult Export(in Batch batch) { if (this.disposed) { - this.SendDisposedMessage(); + if (!this.isDisposeMessageSent) + { + lock (this.disposeLockObj) + { + if (!this.isDisposeMessageSent) + { + this.isDisposeMessageSent = true; + this.WriteLine("The console exporter is still being invoked after it has been disposed. This could be the result of invalid lifecycle management of the OpenTelemetry .NET SDK."); + this.WriteLine(Environment.StackTrace); + this.WriteLine(Environment.NewLine + "The console exporter has been disposed"); + this.WriteLine(this.disposedStackTrace); + } + } + } + return ExportResult.Failure; } @@ -157,23 +171,5 @@ protected override void Dispose(bool disposing) base.Dispose(disposing); } - - private void SendDisposedMessage() - { - if (!this.isDisposeMessageSent) - { - lock (this.disposeLockObj) - { - if (!this.isDisposeMessageSent) - { - this.isDisposeMessageSent = true; - this.WriteLine("The console exporter is still being invoked after it has been disposed. This could be the result of invalid lifecycle management of the OpenTelemetry .NET SDK."); - this.WriteLine(Environment.StackTrace); - this.WriteLine(Environment.NewLine + "The console exporter has been disposed"); - this.WriteLine(this.disposedStackTrace); - } - } - } - } } } From 407b85ae8147fc305d7a70529a018e101d1aef57 Mon Sep 17 00:00:00 2001 From: Jacky Shang Date: Wed, 31 Aug 2022 14:04:33 +0800 Subject: [PATCH 08/11] remove lock and update changelog --- .../CHANGELOG.md | 6 ++-- .../ConsoleLogRecordExporter.cs | 31 ++++++------------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md index 0abe0370af9..faa24f0a5aa 100644 --- a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md @@ -2,9 +2,9 @@ ## Unreleased -* Changed error handling, `ConsoleExporter` will only output an error message - with two call stacks the first time, - then the data will simply be dropped and nothing will be output. +* Changed error handling, `ConsoleExporter` will output error messages, + tell user where dispose happened and drop the data + if `Export` is invoked after the exporter is disposed. ([#1848](https://github.com/open-telemetry/opentelemetry-dotnet/issues/1848)) ## 1.4.0-alpha.2 diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs index 05878d6e9ed..1c76efe016f 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs @@ -24,10 +24,9 @@ namespace OpenTelemetry.Exporter public class ConsoleLogRecordExporter : ConsoleExporter { private const int RightPaddingLength = 35; - private readonly object disposeLockObj = new(); - private bool disposed = false; + private bool disposed; private string disposedStackTrace; - private bool isDisposeMessageSent = false; + private bool isDisposeMessageSent; public ConsoleLogRecordExporter(ConsoleExporterOptions options) : base(options) @@ -40,17 +39,11 @@ public override ExportResult Export(in Batch batch) { if (!this.isDisposeMessageSent) { - lock (this.disposeLockObj) - { - if (!this.isDisposeMessageSent) - { - this.isDisposeMessageSent = true; - this.WriteLine("The console exporter is still being invoked after it has been disposed. This could be the result of invalid lifecycle management of the OpenTelemetry .NET SDK."); - this.WriteLine(Environment.StackTrace); - this.WriteLine(Environment.NewLine + "The console exporter has been disposed"); - this.WriteLine(this.disposedStackTrace); - } - } + this.isDisposeMessageSent = true; + this.WriteLine("The console exporter is still being invoked after it has been disposed. This could be the result of invalid lifecycle management of the OpenTelemetry .NET SDK."); + this.WriteLine(Environment.StackTrace); + this.WriteLine(Environment.NewLine + "Dispose was called on the following stack trace:"); + this.WriteLine(this.disposedStackTrace); } return ExportResult.Failure; @@ -159,14 +152,8 @@ protected override void Dispose(bool disposing) { if (!this.disposed) { - lock (this.disposeLockObj) - { - if (!this.disposed) - { - this.disposed = true; - this.disposedStackTrace = Environment.StackTrace; - } - } + this.disposed = true; + this.disposedStackTrace = Environment.StackTrace; } base.Dispose(disposing); From eb4c64ef262483318062f6fae325ee6f4641a5ff Mon Sep 17 00:00:00 2001 From: Jacky Shang Date: Thu, 1 Sep 2022 09:22:49 +0800 Subject: [PATCH 09/11] fix code bugs and update changelog --- src/OpenTelemetry.Exporter.Console/CHANGELOG.md | 5 ++--- .../ConsoleLogRecordExporter.cs | 12 +++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md index faa24f0a5aa..e848525a256 100644 --- a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md @@ -2,9 +2,8 @@ ## Unreleased -* Changed error handling, `ConsoleExporter` will output error messages, - tell user where dispose happened and drop the data - if `Export` is invoked after the exporter is disposed. +* Changed the behavior of `ConsoleExporter`, the exporter will stop outputting + the data if it is disposed. ([#1848](https://github.com/open-telemetry/opentelemetry-dotnet/issues/1848)) ## 1.4.0-alpha.2 diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs index 1c76efe016f..d8e3621672f 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs @@ -24,6 +24,7 @@ namespace OpenTelemetry.Exporter public class ConsoleLogRecordExporter : ConsoleExporter { private const int RightPaddingLength = 35; + private readonly object syncObject = new(); private bool disposed; private string disposedStackTrace; private bool isDisposeMessageSent; @@ -39,7 +40,16 @@ public override ExportResult Export(in Batch batch) { if (!this.isDisposeMessageSent) { - this.isDisposeMessageSent = true; + lock (this.syncObject) + { + if (this.isDisposeMessageSent) + { + return ExportResult.Failure; + } + + this.isDisposeMessageSent = true; + } + this.WriteLine("The console exporter is still being invoked after it has been disposed. This could be the result of invalid lifecycle management of the OpenTelemetry .NET SDK."); this.WriteLine(Environment.StackTrace); this.WriteLine(Environment.NewLine + "Dispose was called on the following stack trace:"); From 1d17a21d6736b697e22842e54b29c780436f9ab4 Mon Sep 17 00:00:00 2001 From: Jacky Shang <100666781+jackyshang12321@users.noreply.github.com> Date: Thu, 1 Sep 2022 13:56:11 +0800 Subject: [PATCH 10/11] Update src/OpenTelemetry.Exporter.Console/CHANGELOG.md Co-authored-by: Reiley Yang --- src/OpenTelemetry.Exporter.Console/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md index e848525a256..f28b918564d 100644 --- a/src/OpenTelemetry.Exporter.Console/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.Console/CHANGELOG.md @@ -4,7 +4,7 @@ * Changed the behavior of `ConsoleExporter`, the exporter will stop outputting the data if it is disposed. - ([#1848](https://github.com/open-telemetry/opentelemetry-dotnet/issues/1848)) + ([#3578](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3578)) ## 1.4.0-alpha.2 From 915bce23482c401b86d28cc3508a2481dfa28255 Mon Sep 17 00:00:00 2001 From: Jacky Shang <100666781+jackyshang12321@users.noreply.github.com> Date: Fri, 2 Sep 2022 17:42:18 +0800 Subject: [PATCH 11/11] make it more clear who is at fault --- src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs index d8e3621672f..f089b0e95a2 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleLogRecordExporter.cs @@ -50,7 +50,7 @@ public override ExportResult Export(in Batch batch) this.isDisposeMessageSent = true; } - this.WriteLine("The console exporter is still being invoked after it has been disposed. This could be the result of invalid lifecycle management of the OpenTelemetry .NET SDK."); + this.WriteLine("The console exporter is still being invoked after it has been disposed. This could be due to the application's incorrect lifecycle management of the LoggerFactory/OpenTelemetry .NET SDK."); this.WriteLine(Environment.StackTrace); this.WriteLine(Environment.NewLine + "Dispose was called on the following stack trace:"); this.WriteLine(this.disposedStackTrace);