agent: keep adaptive rate changes apart from the logs and report them in the heartbeat
This commit is contained in:
1 parent
557b169dae
commit
d63c3bff74
7 files changed
+128
-4
No files matched your search
@@ -342,6 +342,10 @@ public sealed class NodeHeartbeatExtra
|
||||
/// <summary>日志只报计数(不带文本):自上次心跳以来各级别的条数、最多几个出现最多的类型,以及最新一条的编号;文本由 Backend 用 <c>moshiro.logs.fetch</c> 按需拉取。</summary>
|
||||
[JsonPropertyName("log_summary")]
|
||||
public LogSummaryDto? LogSummary { get; set; }
|
||||
|
||||
/// <summary>自上次心跳以来自适应探测频率的状态变化(节点上限 512 条,超出丢最旧的)。</summary>
|
||||
[JsonPropertyName("rate_changes")]
|
||||
public List<RateChange>? RateChanges { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>某一类日志(消息文本的稳定哈希)在一个级别上出现了多少次。</summary>
|
||||
@@ -357,6 +361,56 @@ public sealed class LogTypeCountDto
|
||||
public long Count { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自适应探测频率的一次状态变化(Quiet / Watch / Active / Dead):节点随心跳上报,Backend 存成事件(<c>rate_change</c>),
|
||||
/// 事后可以回看每条线路、每个时段的探测频率为什么升降(例如晚高峰)。线路任务带 <c>listener</c>(对端)和 <c>ip_version</c>,目标任务带 <c>task</c>。
|
||||
/// </summary>
|
||||
public sealed class RateChange
|
||||
{
|
||||
[JsonPropertyName("at_ms")]
|
||||
public long AtMs { get; set; }
|
||||
|
||||
/// <summary>这条线路的监听方节点 id(线路任务)。</summary>
|
||||
[JsonPropertyName("listener")]
|
||||
public string? Listener { get; set; }
|
||||
|
||||
/// <summary>拨号方节点 id:节点上报时不填,由 Backend 按上报者补上。</summary>
|
||||
[JsonPropertyName("dialer")]
|
||||
public string? Dialer { get; set; }
|
||||
|
||||
[JsonPropertyName("ip_version")]
|
||||
public string? IpVersion { get; set; }
|
||||
|
||||
/// <summary>单个 Agent 任务的任务 id。</summary>
|
||||
[JsonPropertyName("task")]
|
||||
public string? Task { get; set; }
|
||||
|
||||
[JsonPropertyName("kind")]
|
||||
public string Kind { get; set; } = "";
|
||||
|
||||
[JsonPropertyName("from")]
|
||||
public string From { get; set; } = "";
|
||||
|
||||
[JsonPropertyName("to")]
|
||||
public string To { get; set; } = "";
|
||||
|
||||
[JsonPropertyName("hz")]
|
||||
public double Hz { get; set; }
|
||||
|
||||
[JsonPropertyName("reason")]
|
||||
public string Reason { get; set; } = "";
|
||||
|
||||
/// <summary>变化时刻证明窗口内的丢包率(百分比)和发出、丢失的包数。</summary>
|
||||
[JsonPropertyName("loss_pct")]
|
||||
public double LossPct { get; set; }
|
||||
|
||||
[JsonPropertyName("sent")]
|
||||
public int Sent { get; set; }
|
||||
|
||||
[JsonPropertyName("lost")]
|
||||
public int Lost { get; set; }
|
||||
}
|
||||
|
||||
public sealed class LogSummaryDto
|
||||
{
|
||||
[JsonPropertyName("last_id")]
|
||||
@@ -826,6 +880,7 @@ public static class FragmentKeys
|
||||
[JsonSerializable(typeof(LogsFetchParams))]
|
||||
[JsonSerializable(typeof(LogsFetchResult))]
|
||||
[JsonSerializable(typeof(LogSummaryDto))]
|
||||
[JsonSerializable(typeof(RateChange))]
|
||||
[JsonSerializable(typeof(UpdateStatus))]
|
||||
[JsonSerializable(typeof(NodeHeartbeatExtra))]
|
||||
[JsonSerializable(typeof(NodeHelloMeta))]
|
||||
|
||||
Reference in new issue
Block a user