Skip to content

Commit

Permalink
Add script_cache to Node Stats API
Browse files Browse the repository at this point in the history
Relates: #4718

This commit adds the script_cache to node stats
API response.
  • Loading branch information
russcam committed Jun 9, 2020
1 parent ae0516d commit 7024b00
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/Nest/Cluster/NodesStats/NodeStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ public class NodeStats
[DataMember(Name = "script")]
public ScriptStats Script { get; internal set; }

/// <summary>
/// Available in Elasticsearch 7.8.0+
/// </summary>
[DataMember(Name = "script_cache")]
[JsonFormatter(typeof(VerbatimInterfaceReadOnlyDictionaryKeysFormatter<string, ScriptStats>))]
public IReadOnlyDictionary<string, ScriptStats> ScriptCache { get; internal set; }

[DataMember(Name = "thread_pool")]
[JsonFormatter(typeof(VerbatimInterfaceReadOnlyDictionaryKeysFormatter<string, ThreadCountStats>))]
public IReadOnlyDictionary<string, ThreadCountStats> ThreadPool { get; internal set; }
Expand All @@ -85,6 +92,9 @@ public class ScriptStats

[DataMember(Name = "compilations")]
public long Compilations { get; internal set; }

[DataMember(Name = "compilation_limit_triggered")]
public long CompilationLimitTriggered { get; internal set; }
}

[DataContract]
Expand Down
11 changes: 8 additions & 3 deletions tests/Tests/Cluster/NodesStats/NodesStatsApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ protected override void ExpectResponse(NodesStatsResponse response)
Assert(node.Jvm);
Assert(node.AdaptiveSelection);
Assert(node.Ingest);

if (TestClient.Configuration.InRange(">=7.8.0"))
{
Assert(node.ScriptCache);
}
}

protected void Assert(NodeIngestStats nodeIngestStats)
Expand All @@ -94,9 +99,6 @@ protected void Assert(NodeIngestStats nodeIngestStats)

processorStats.Type.Should().Be("set");
processorStats.Statistics.Should().NotBeNull();



}

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

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

protected void Assert(IReadOnlyDictionary<string, ScriptStats> scriptCache) =>
scriptCache.Should().NotBeNull();

protected void Assert(TransportStats transport) => transport.Should().NotBeNull();

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

0 comments on commit 7024b00

Please sign in to comment.