/
NodeInfo.cs
337 lines (259 loc) · 9.46 KB
/
NodeInfo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
/* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
using System.Collections.Generic;
using System.Runtime.Serialization;
using OpenSearch.Net;
using OpenSearch.Net.Utf8Json;
namespace OpenSearch.Client
{
[DataContract]
public class NodeInfo
{
[DataMember(Name = "name")]
public string Name { get; internal set; }
[DataMember(Name = "transport_address")]
public string TransportAddress { get; internal set; }
[DataMember(Name = "host")]
public string Host { get; internal set; }
[DataMember(Name = "ip")]
public string Ip { get; internal set; }
[DataMember(Name = "version")]
public string Version { get; internal set; }
[DataMember(Name = "build_type")]
public string BuildType { get; internal set; }
[DataMember(Name = "build_hash")]
public string BuildHash { get; internal set; }
[DataMember(Name = "total_indexing_buffer")]
public long? TotalIndexingBuffer { get; internal set; }
/// <summary>
/// All of the different roles that the node fulfills. An empty
/// collection means that the node is a coordinating only node.
/// </summary>
[DataMember(Name = "roles")]
public List<NodeRole> Roles { get; internal set; }
[DataMember(Name ="attributes")]
public IReadOnlyDictionary<string, string> Attributes { get; internal set; } = EmptyReadOnly<string, string>.Dictionary;
[DataMember(Name = "settings")]
public DynamicDictionary Settings { get; internal set; }
[DataMember(Name = "os")]
public NodeOperatingSystemInfo OperatingSystem { get; internal set; }
[DataMember(Name = "process")]
public NodeProcessInfo Process { get; internal set; }
[DataMember(Name = "jvm")]
public NodeJvmInfo Jvm { get; internal set; }
[DataMember(Name = "http")]
public NodeInfoHttp Http { get; internal set; }
[DataMember(Name = "network")]
public NodeInfoNetwork Network { get; internal set; }
[DataMember(Name = "plugins")]
public List<PluginStats> Plugins { get; internal set; }
[DataMember(Name = "thread_pool")]
[JsonFormatter(typeof(VerbatimInterfaceReadOnlyDictionaryKeysFormatter<string, NodeThreadPoolInfo>))]
public IReadOnlyDictionary<string, NodeThreadPoolInfo> ThreadPool { get; internal set; }
[DataMember(Name = "transport")]
public NodeInfoTransport Transport { get; internal set; }
}
[DataContract]
public class NodeOperatingSystemInfo
{
[DataMember(Name = "arch")]
public string Architecture { get; internal set; }
[DataMember(Name = "available_processors")]
public int AvailableProcessors { get; internal set; }
[DataMember(Name = "cpu")]
public NodeInfoOSCPU Cpu { get; internal set; }
[DataMember(Name = "mem")]
public NodeInfoMemory Mem { get; internal set; }
[DataMember(Name = "name")]
public string Name { get; internal set; }
[DataMember(Name = "pretty_name")]
public string PrettyName { get; internal set; }
[DataMember(Name = "refresh_interval_in_millis")]
public int RefreshInterval { get; internal set; }
[DataMember(Name = "swap")]
public NodeInfoMemory Swap { get; internal set; }
[DataMember(Name = "version")]
public string Version { get; internal set; }
}
[DataContract]
public class NodeInfoOSCPU
{
[DataMember(Name = "cache_size")]
public string CacheSize { get; internal set; }
[DataMember(Name = "cache_size_in_bytes")]
public int CacheSizeInBytes { get; internal set; }
[DataMember(Name = "cores_per_socket")]
public int CoresPerSocket { get; internal set; }
[DataMember(Name = "mhz")]
public int Mhz { get; internal set; }
[DataMember(Name = "model")]
public string Model { get; internal set; }
[DataMember(Name = "total_cores")]
public int TotalCores { get; internal set; }
[DataMember(Name = "total_sockets")]
public int TotalSockets { get; internal set; }
[DataMember(Name = "vendor")]
public string Vendor { get; internal set; }
}
[DataContract]
public class NodeInfoMemory
{
[DataMember(Name = "total")]
public string Total { get; internal set; }
[DataMember(Name = "total_in_bytes")]
public long TotalInBytes { get; internal set; }
}
[DataContract]
public class NodeProcessInfo
{
[DataMember(Name = "id")]
public long Id { get; internal set; }
[DataMember(Name = "mlockall")]
public bool MlockAll { get; internal set; }
[DataMember(Name = "refresh_interval_in_millis")]
public long RefreshIntervalInMilliseconds { get; internal set; }
}
[DataContract]
public class NodeJvmInfo
{
[DataMember(Name = "gc_collectors")]
public IEnumerable<string> GcCollectors { get; internal set; }
[DataMember(Name = "mem")]
public NodeInfoJvmMemory Memory { get; internal set; }
[DataMember(Name = "memory_pools")]
public IEnumerable<string> MemoryPools { get; internal set; }
[DataMember(Name = "pid")]
public int Pid { get; internal set; }
[DataMember(Name = "start_time_in_millis")]
public long StartTime { get; internal set; }
[DataMember(Name = "version")]
public string Version { get; internal set; }
[DataMember(Name = "vm_name")]
public string VMName { get; internal set; }
[DataMember(Name = "vm_vendor")]
public string VMVendor { get; internal set; }
[DataMember(Name = "vm_version")]
public string VMVersion { get; internal set; }
}
[DataContract]
public class NodeInfoJvmMemory
{
[DataMember(Name = "direct_max")]
public string DirectMax { get; internal set; }
[DataMember(Name = "direct_max_in_bytes")]
public long DirectMaxInBytes { get; internal set; }
[DataMember(Name = "heap_init")]
public string HeapInit { get; internal set; }
[DataMember(Name = "heap_init_in_bytes")]
public long HeapInitInBytes { get; internal set; }
[DataMember(Name = "heap_max")]
public string HeapMax { get; internal set; }
[DataMember(Name = "heap_max_in_bytes")]
public long HeapMaxInBytes { get; internal set; }
[DataMember(Name = "non_heap_init")]
public string NonHeapInit { get; internal set; }
[DataMember(Name = "non_heap_init_in_bytes")]
public long NonHeapInitInBytes { get; internal set; }
[DataMember(Name = "non_heap_max")]
public string NonHeapMax { get; internal set; }
[DataMember(Name = "non_heap_max_in_bytes")]
public long NonHeapMaxInBytes { get; internal set; }
}
[DataContract]
public class NodeThreadPoolInfo
{
/// <summary>
/// The configured keep alive time for threads
/// </summary>
[DataMember(Name = "keep_alive")]
public string KeepAlive { get; internal set; }
/// <summary>
/// The configured maximum number of active threads allowed in the current thread pool
/// </summary>
[DataMember(Name = "max")]
public int? Max { get; internal set; }
/// <summary>
/// The configured core number of active threads allowed in the current thread pool
/// </summary>
[DataMember(Name = "core")]
public int? Core { get; internal set; }
/// <summary>
/// The configured fixed number of active threads allowed in the current thread pool
/// </summary>
[DataMember(Name = "size")]
public int? Size { get; internal set; }
/// <summary>
/// The maximum number of tasks permitted in the queue for the current thread pool
/// </summary>
[DataMember(Name = "queue_size")]
public int? QueueSize { get; internal set; }
/// <summary>
/// The type of thread pool
/// </summary>
[DataMember(Name = "type")]
public string Type { get; internal set; }
}
[DataContract]
public class NodeInfoNetwork
{
[DataMember(Name = "primary_interface")]
public NodeInfoNetworkInterface PrimaryInterface { get; internal set; }
[DataMember(Name = "refresh_interval")]
public int RefreshInterval { get; internal set; }
}
[DataContract]
public class NodeInfoNetworkInterface
{
[DataMember(Name = "address")]
public string Address { get; internal set; }
[DataMember(Name = "mac_address")]
public string MacAddress { get; internal set; }
[DataMember(Name = "name")]
public string Name { get; internal set; }
}
[DataContract]
public class NodeInfoTransport
{
[DataMember(Name = "bound_address")]
public IEnumerable<string> BoundAddress { get; internal set; }
[DataMember(Name = "publish_address")]
public string PublishAddress { get; internal set; }
}
[DataContract]
public class NodeInfoHttp
{
[DataMember(Name = "bound_address")]
public IEnumerable<string> BoundAddress { get; internal set; }
[DataMember(Name = "max_content_length")]
public string MaxContentLength { get; internal set; }
[DataMember(Name = "max_content_length_in_bytes")]
public long MaxContentLengthInBytes { get; internal set; }
[DataMember(Name = "publish_address")]
public string PublishAddress { get; internal set; }
}
}