host-metrics-collector/api/collector.proto
2026-08-15 01:20:11 +08:00

67 lines
1.6 KiB
Protocol Buffer
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "proto3";
package hms.collector.v1;
option go_package = "git.opencomputing.cn/yumoqing/host-metrics-collector/pkg/collectorpb;collectorpb";
// MetricSample 表示单条指标样本labels 统一携带 host_id / service / metric_group。
message MetricSample {
string name = 1;
double value = 2;
int64 timestamp = 3; // Unix 秒
map<string, string> labels = 4;
}
// MetricBatch 是 Agent 一次批量上报的指标消息。
message MetricBatch {
string host_id = 1;
string agent_version = 2;
int64 seq = 3;
int64 sent_at = 4; // Unix 秒
repeated MetricSample samples = 5;
}
// LogEntry 表示单条主机日志offset 用于日志文件断点续传。
message LogEntry {
int64 timestamp = 1; // Unix 秒
string level = 2;
string source = 3;
string message = 4;
map<string, string> fields = 5;
string file = 6;
int64 offset = 7;
}
// LogBatch 是 Agent 一次批量上报的日志消息。
message LogBatch {
string host_id = 1;
int64 seq = 2;
repeated LogEntry entries = 3;
}
// Ack 是上报接口的统一确认响应。
message Ack {
bool ok = 1;
int64 seq = 2;
string error = 3;
}
// HeartbeatRequest 是 Agent 心跳/注册/配置下发请求。
message HeartbeatRequest {
string host_id = 1;
string agent_version = 2;
int64 config_version = 3;
}
// HeartbeatResponse 是心跳响应。
message HeartbeatResponse {
bool ok = 1;
int64 server_time = 2; // Unix 秒
map<string, string> config = 3;
}
// CheckpointResponse 返回服务端已确认的序号。
message CheckpointResponse {
int64 last_acked_seq = 1;
}