From 3d6be9cb5770f9f1e46478dccfec18e2ec05f828 Mon Sep 17 00:00:00 2001 From: Alan West <3676547+alanwest@users.noreply.github.com> Date: Wed, 20 Jul 2022 10:20:17 -0700 Subject: [PATCH] Start ZPages HttpListener sooner (#3463) --- .../ZPagesExporterStatsHttpServer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenTelemetry.Exporter.ZPages/ZPagesExporterStatsHttpServer.cs b/src/OpenTelemetry.Exporter.ZPages/ZPagesExporterStatsHttpServer.cs index 3db455b70f0..af40141fee8 100644 --- a/src/OpenTelemetry.Exporter.ZPages/ZPagesExporterStatsHttpServer.cs +++ b/src/OpenTelemetry.Exporter.ZPages/ZPagesExporterStatsHttpServer.cs @@ -65,6 +65,8 @@ public void Start(CancellationToken token = default) new CancellationTokenSource() : CancellationTokenSource.CreateLinkedTokenSource(token); + this.httpListener.Start(); + this.workerThread = Task.Factory.StartNew(this.WorkerThread, default, TaskCreationOptions.LongRunning, TaskScheduler.Default); } } @@ -110,8 +112,6 @@ protected virtual void Dispose(bool disposing) private void WorkerThread() { - this.httpListener.Start(); - try { while (!this.tokenSource.IsCancellationRequested)