Skip to content

Commit 88e3284

Browse files
committed
moved metric objects into their own file
1 parent 7c04566 commit 88e3284

File tree

6 files changed

+44
-28
lines changed

6 files changed

+44
-28
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace Elasticsearch.Net
5+
{
6+
public class CallMetrics
7+
{
8+
public string Path { get; set; }
9+
public long SerializationTime { get; set; }
10+
public long DeserializationTime { get; set; }
11+
public DateTime StartedOn { get; set; }
12+
public DateTime CompletedOn { get; set; }
13+
public List<RequestMetrics> Requests { get; set; }
14+
}
15+
}

src/Elasticsearch.Net/Domain/Response/IElasticsearchResponse.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,34 +58,6 @@ public interface IElasticsearchResponse
5858
[DebuggerDisplay("{Request != null ? System.Text.Encoding.UTF8.GetString(Request) : null,nq}")]
5959
byte[] Request { get; }
6060
}
61-
62-
public class CallMetrics
63-
{
64-
public string Path { get; set; }
65-
public long SerializationTime { get; set; }
66-
public long DeserializationTime { get; set; }
67-
public DateTime StartedOn { get; set; }
68-
public DateTime CompletedOn { get; set; }
69-
public List<RequestMetrics> Requests { get; set; }
70-
}
71-
72-
public enum RequestType
73-
{
74-
ElasticsearchCall,
75-
Ping,
76-
Sniff
77-
}
78-
79-
public class RequestMetrics
80-
{
81-
public RequestType RequestType { get; set; }
82-
public Uri Node { get; set; }
83-
public DateTime StartedOn { get; set; }
84-
public long EllapsedMilliseconds { get; set; }
85-
public string Path { get; set; }
86-
public int? HttpStatusCode { get; set; }
87-
public bool Success { get; set; }
88-
}
8961

9062

9163
public interface IResponseWithRequestInformation
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
3+
namespace Elasticsearch.Net
4+
{
5+
public class RequestMetrics
6+
{
7+
public RequestType RequestType { get; set; }
8+
public Uri Node { get; set; }
9+
public DateTime StartedOn { get; set; }
10+
public long EllapsedMilliseconds { get; set; }
11+
public string Path { get; set; }
12+
public int? HttpStatusCode { get; set; }
13+
public bool Success { get; set; }
14+
}
15+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Elasticsearch.Net
2+
{
3+
public enum RequestType
4+
{
5+
ElasticsearchCall,
6+
Ping,
7+
Sniff
8+
}
9+
}

src/Elasticsearch.Net/Elasticsearch.Net.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@
5757
<Compile Include="Connection\RequestState\NoopRequestTimings.cs" />
5858
<Compile Include="Connection\RequestState\RequestTimings.cs" />
5959
<Compile Include="Domain\RequestParameters\BaseRequestParameters.cs" />
60+
<Compile Include="Domain\Response\CallMetrics.cs" />
6061
<Compile Include="Domain\Response\IElasticsearchResponse.cs" />
6162
<Compile Include="Domain\IHideObjectMembers.cs" />
6263
<Compile Include="Domain\RequestParameters\IRequestParameters.cs" />
64+
<Compile Include="Domain\Response\RequestMetrics.cs" />
65+
<Compile Include="Domain\Response\RequestType.cs" />
6366
<Compile Include="Domain\Response\VoidResponse.cs" />
6467
<Compile Include="Domain\Response\ElasticsearchServerError.cs" />
6568
<Compile Include="Exceptions\OneToOneServerException.cs" />

src/Tests/Elasticsearch.Net.Tests.Unit/Connection/NoRetryOnServerExceptionTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ private MemoryStream CreateServerExceptionResponse(int status, string exceptionT
2828
[Test]
2929
[TestCase(505, "SomeException", "Some Error Message")]
3030
[TestCase(505, "", "")]
31+
[TestCase(404, "", "")]
3132
public void IfResponseIsKnowError_DoNotRetry_ThrowServerException(int status, string exceptionType, string exceptionMessage)
3233
{
3334
var response = CreateServerExceptionResponse(status, exceptionType, exceptionMessage);
@@ -67,6 +68,7 @@ public void IfResponseIsKnowError_DoNotRetry_ThrowServerException(int status, st
6768
[Test]
6869
[TestCase(505, "SomeException", "Some Error Message")]
6970
[TestCase(505, "", "")]
71+
[TestCase(404, "", "")]
7072
public async void IfResponseIsKnowError_DoNotRetry_ThrowServerException_Async(int status, string exceptionType, string exceptionMessage)
7173
{
7274
var response = CreateServerExceptionResponse(status, exceptionType, exceptionMessage);

0 commit comments

Comments
 (0)