Skip to content

Commit d593130

Browse files
Add script_cache to Node Stats API (#4744) (#4767)
Relates: #4718 This commit adds the script_cache to node stats API response. Co-authored-by: Russ Cam <[email protected]>
1 parent 7428f27 commit d593130

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/Nest/Cluster/NodesStats/NodeStats.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ public class NodeStats
6262
[DataMember(Name = "script")]
6363
public ScriptStats Script { get; internal set; }
6464

65+
/// <summary>
66+
/// Available in Elasticsearch 7.8.0+
67+
/// </summary>
68+
[DataMember(Name = "script_cache")]
69+
[JsonFormatter(typeof(VerbatimInterfaceReadOnlyDictionaryKeysFormatter<string, ScriptStats>))]
70+
public IReadOnlyDictionary<string, ScriptStats> ScriptCache { get; internal set; }
71+
6572
[DataMember(Name = "thread_pool")]
6673
[JsonFormatter(typeof(VerbatimInterfaceReadOnlyDictionaryKeysFormatter<string, ThreadCountStats>))]
6774
public IReadOnlyDictionary<string, ThreadCountStats> ThreadPool { get; internal set; }
@@ -85,6 +92,9 @@ public class ScriptStats
8592

8693
[DataMember(Name = "compilations")]
8794
public long Compilations { get; internal set; }
95+
96+
[DataMember(Name = "compilation_limit_triggered")]
97+
public long CompilationLimitTriggered { get; internal set; }
8898
}
8999

90100
[DataContract]

tests/Tests/Cluster/NodesStats/NodesStatsApiTests.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ protected override void ExpectResponse(NodesStatsResponse response)
7373
Assert(node.Jvm);
7474
Assert(node.AdaptiveSelection);
7575
Assert(node.Ingest);
76+
77+
if (TestClient.Configuration.InRange(">=7.8.0"))
78+
{
79+
Assert(node.ScriptCache);
80+
}
7681
}
7782

7883
protected void Assert(NodeIngestStats nodeIngestStats)
@@ -94,9 +99,6 @@ protected void Assert(NodeIngestStats nodeIngestStats)
9499

95100
processorStats.Type.Should().Be("set");
96101
processorStats.Statistics.Should().NotBeNull();
97-
98-
99-
100102
}
101103

102104
protected void Assert(IReadOnlyDictionary<string, AdaptiveSelectionStats> adaptiveSelectionStats) =>
@@ -187,6 +189,9 @@ protected void Assert(ProcessStats process)
187189

188190
protected void Assert(ScriptStats script) => script.Should().NotBeNull();
189191

192+
protected void Assert(IReadOnlyDictionary<string, ScriptStats> scriptCache) =>
193+
scriptCache.Should().NotBeNull();
194+
190195
protected void Assert(TransportStats transport) => transport.Should().NotBeNull();
191196

192197
protected void Assert(HttpStats http) => http.Should().NotBeNull();

0 commit comments

Comments
 (0)