-
Notifications
You must be signed in to change notification settings - Fork 663
Expand file tree
/
Copy pathGarnetServerMetrics.cs
More file actions
70 lines (57 loc) · 2.28 KB
/
GarnetServerMetrics.cs
File metadata and controls
70 lines (57 loc) · 2.28 KB
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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
namespace Garnet.server
{
internal struct GarnetServerMetrics
{
/// <summary>
/// Server metrics
/// </summary>
public long total_connections_received;
public long total_connections_disposed;
public long total_connections_active;
/// <summary>
/// Instantaneous metrics
/// </summary>
public static readonly int byteUnit = 1 << 10;
public double instantaneous_cmd_per_sec;
public double instantaneous_net_input_tpt;
public double instantaneous_net_output_tpt;
/// <summary>
/// Global session metrics
/// </summary>
public GarnetSessionMetrics globalSessionMetrics;
/// <summary>
/// History of session metrics.
/// </summary>
public GarnetSessionMetrics historySessionMetrics;
/// <summary>
/// Global latency metrics per command.
/// </summary>
public readonly GarnetLatencyMetrics globalLatencyMetrics;
/// <summary>
/// Global per-command usage statistics (calls, failures, rejections).
/// </summary>
public CommandStats globalCommandStats;
/// <summary>
/// History of per-command usage statistics from disposed sessions.
/// </summary>
public CommandStats historyCommandStats;
public GarnetServerMetrics(bool trackStats, bool trackLatency, bool trackCommandStats, GarnetServerMonitor monitor)
{
total_connections_received = 0;
total_connections_disposed = 0;
total_connections_active = 0;
instantaneous_cmd_per_sec = 0;
instantaneous_net_input_tpt = 0;
instantaneous_net_output_tpt = 0;
globalSessionMetrics = trackStats ? new GarnetSessionMetrics() : null;
historySessionMetrics = trackStats ? new GarnetSessionMetrics() : null;
globalLatencyMetrics = trackLatency ? new() : null;
globalCommandStats = trackCommandStats ? new CommandStats() : null;
historyCommandStats = trackCommandStats ? new CommandStats() : null;
}
public void Dispose()
=> globalLatencyMetrics?.Return();
}
}