File tree 2 files changed +14
-1
lines changed
src/Agent/NewRelic/Agent/Core/DataTransport
tests/Agent/UnitTests/Core.UnitTest/DataTransport
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 10
10
using System . IO ;
11
11
using System . Linq ;
12
12
using System . Net ;
13
+ using System . Net . Http ;
13
14
using System . Net . Sockets ;
14
15
15
16
namespace NewRelic . Agent . Core . DataTransport
@@ -106,6 +107,12 @@ private void Connect()
106
107
{
107
108
HandleHttpErrorResponse ( ex ) ;
108
109
}
110
+ // Occurs when the agent is unable to connect to APM. The request failed due to an underlying
111
+ // issue such as network connectivity, DNS failure, server certificate validation or timeout.
112
+ catch ( HttpRequestException )
113
+ {
114
+ ScheduleRestart ( ) ;
115
+ }
109
116
// Occurs when the agent connects to APM but the connection gets aborted by the collector
110
117
catch ( SocketException )
111
118
{
Original file line number Diff line number Diff line change 4
4
using System ;
5
5
using System . IO ;
6
6
using System . Net ;
7
+ using System . Net . Http ;
7
8
using System . Net . Sockets ;
9
+ using System . Web ;
8
10
using NewRelic . Agent . Configuration ;
9
11
using NewRelic . Agent . Core . Events ;
10
- using NewRelic . Agent . Core . Exceptions ;
11
12
using NewRelic . Agent . Core . Fixtures ;
12
13
using NewRelic . Agent . Core . Time ;
13
14
using NewRelic . Agent . Core . Utilities ;
14
15
using NUnit . Framework ;
15
16
using Telerik . JustMock ;
17
+ using HttpException = NewRelic . Agent . Core . Exceptions . HttpException ;
16
18
17
19
namespace NewRelic . Agent . Core . DataTransport
18
20
{
@@ -83,6 +85,7 @@ public void AttemptAutoStart_SchedulesConnectAsynchronously_IfAutoStartIsOnAndSy
83
85
[ Test ]
84
86
[ TestCase ( "ForceRestartException" ) ]
85
87
[ TestCase ( "HttpException" ) ]
88
+ [ TestCase ( "HttpRequestException" ) ]
86
89
[ TestCase ( "SocketException" ) ]
87
90
[ TestCase ( "IOException" ) ]
88
91
[ TestCase ( "OperationCanceledException" ) ]
@@ -97,6 +100,9 @@ public void AttemptAutoStart_SchedulesReconnect_IfCertainExceptionOccurs(string
97
100
case "HttpException" :
98
101
ex = new HttpException ( HttpStatusCode . MethodNotAllowed , null ) ;
99
102
break ;
103
+ case "HttpRequestException" :
104
+ ex = new HttpRequestException ( ) ;
105
+ break ;
100
106
case "SocketException" :
101
107
ex = new SocketException ( ) ;
102
108
break ;
You can’t perform that action at this time.
0 commit comments