From a66044b278fbed19cc1c6b61ab1e4c89e1874d85 Mon Sep 17 00:00:00 2001 From: Bryan English Date: Tue, 3 Sep 2024 10:30:46 -0400 Subject: [PATCH] clearer profiling error Indicating that a backoff has expired isn't enough information to diagnose what's causing the backoff in the first place, so rather than creating a new error object, this change just passes the last error along. --- packages/dd-trace/src/profiling/exporters/agent.js | 2 +- packages/dd-trace/test/profiling/exporters/agent.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/dd-trace/src/profiling/exporters/agent.js b/packages/dd-trace/src/profiling/exporters/agent.js index 13310d82770..b34ab3c9d94 100644 --- a/packages/dd-trace/src/profiling/exporters/agent.js +++ b/packages/dd-trace/src/profiling/exporters/agent.js @@ -199,7 +199,7 @@ class AgentExporter { this._logger.error(`Error from the agent: ${err.message}`) return } else if (err) { - reject(new Error('Profiler agent export back-off period expired')) + reject(err) return } diff --git a/packages/dd-trace/test/profiling/exporters/agent.spec.js b/packages/dd-trace/test/profiling/exporters/agent.spec.js index a1878f0579f..7c42ad2af41 100644 --- a/packages/dd-trace/test/profiling/exporters/agent.spec.js +++ b/packages/dd-trace/test/profiling/exporters/agent.spec.js @@ -270,7 +270,7 @@ describe('exporters/agent', function () { try { await exporter.export({ profiles, start, end, tags }) } catch (err) { - expect(err.message).to.match(/^Profiler agent export back-off period expired$/) + expect(err.message).to.match(/^HTTP Error 500$/) failed = true } expect(failed).to.be.true