Skip to main content

ReportAgentFactSummary

Struct ReportAgentFactSummary 

Source
pub struct ReportAgentFactSummary {
Show 18 fields pub api_version: String, pub kind: String, pub report_id: String, pub agent_id: String, pub instance_id: String, pub content_digest: String, pub revision: i64, pub observed_at: String, pub os: String, pub arch: String, pub process_count: i64, pub process_executables: Vec<String>, pub packages: Vec<String>, pub listen_ports: Vec<String>, pub host_id: String, pub host_name: String, pub network_addresses: Vec<String>, pub reported_at: String,
}
Expand description

agentd → 网关的事实摘要上报(控制面)。

与数据面上的原文快照(ReportDiscoverySnapshot)分工不同,不是同一条路: 摘要只服务用途推断(网关侧按规则表算),去重后 10~30 KB,走已认证的控制面; 原文快照一台几百 KB,走数据面给中心做资产整理。所以网关只接摘要。

幂等键是内容摘要,不是 revision(后者每轮 refresh 无条件 +1)。

agentd 无条件周期全量上报,判重归网关:网关用 wist_contracts::fact_summary::FactContent::content_digest 从收到的内容自己算摘要, 以此判重。content_digest 字段因此只是 agent 的声明: 与网关算出来的不一致时会记 FactDigestMismatch 告警(可能只是版本偏差,不拒收)。

Fields§

§api_version: String§kind: String§report_id: String§agent_id: String§instance_id: String§content_digest: String

agent 侧声明的内容摘要。不是判重键:网关从下列内容字段自算,此值只作版本偏差的金丝雀。

§revision: i64

仅留痕:快照 revision 每轮 refresh 无条件 +1,网关不据它判重。

§observed_at: String

仅留痕:观察到的事实属于哪一刻(快照生成时间)。

§os: String§arch: String§process_count: i64

仅留痕:去重前的进程条数(去重会毁掉基数,留一个原始计数备查),不进摘要。

§process_executables: Vec<String>

去重后的进程可执行标识。注意两边不同源: macOS 是 ps -axo comm= 给的完整路径,Linux 是 /proc/{pid}/comm(只有 basename)。

§packages: Vec<String>

已装包名(仅 linux;macOS 侧待定)。

§listen_ports: Vec<String>§host_id: String

主机标识(发现里 host 方向的 host.id)。

§host_name: String

主机名(host.name)。

§network_addresses: Vec<String>

网卡地址(每块网卡一条,形如 en0 192.168.1.5/24)。

§reported_at: String

Implementations§

Source§

impl ReportAgentFactSummary

Source

pub fn new_agent_facts( report_id: String, agent_id: String, instance_id: String, content_digest: String, revision: i64, observed_at: String, os: String, arch: String, process_count: i64, process_executables: Vec<String>, packages: Vec<String>, listen_ports: Vec<String>, reported_at: String, ) -> Self

Source

pub fn with_display( self, host_id: String, host_name: String, network_addresses: Vec<String>, ) -> Self

补上留痕/展示字段(不参与内容摘要与判重)。

为什么另开一个方法而不是给构造函数再加三个参数:那个函数已经有 13 个位置参数, 再加就是 16 个 —— 调用方只需错一次顺序,就会把主机名传成 os、把端口传成包名, 而这类错不会报错(都是 String/Vec),只会静默写错数据。

Trait Implementations§

Source§

impl Clone for ReportAgentFactSummary

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReportAgentFactSummary

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ReportAgentFactSummary

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ReportAgentFactSummary

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ReportAgentFactSummary

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ReportAgentFactSummary

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.