From 690a2c864c9411ce0be09a8183e5dc82d53864bf Mon Sep 17 00:00:00 2001 From: r-dilip Date: Wed, 20 Feb 2019 12:40:25 -0800 Subject: [PATCH] No Retries for non 404 4xx errors --- source/code/plugin/out_mdm.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/code/plugin/out_mdm.rb b/source/code/plugin/out_mdm.rb index 2f36ea7d5..6bde98534 100644 --- a/source/code/plugin/out_mdm.rb +++ b/source/code/plugin/out_mdm.rb @@ -126,6 +126,7 @@ def write(chunk) end rescue Exception => e @log.info "Exception when writing to MDM: #{e}" + raise e end end @@ -149,7 +150,11 @@ def send_to_mdm(post_body) @first_post_attempt_made = true ApplicationInsightsUtility.sendExceptionTelemetry(e.backtrace) # Not raising exception, as that will cause retries to happen - else + elsif !response.code.empty? && response.code.start_with?('4') + # Log 400 errors and continue + @log.info "Non-retryable HTTPServerException when POSTing Metrics to MDM #{e} Response: #{response}" + else + # raise if the response code is non-400 @log.info "HTTPServerException when POSTing Metrics to MDM #{e} Response: #{response}" raise e end