Files
OpenFlare/internal/apps/agent/nginx/observability_assets_test.go
T
ryan f0e234df1f feat(obs): 访问日志 SSOT 与 edge_health,去掉协议兼容层
Agent 仅上报 host_metrics/edge_health/access_logs;业务流量与 UV 由
Server 侧访问日志聚合。新增 of_node_edge_health 与 of_access_log_hourly,
删除 request_reports/openresty 吞吐路径;API 不再暴露 traffic_reports
与 openresty_rx|tx。心跳/离线默认阈值与回填迁移一并入库。
2026-07-18 11:53:11 +08:00

36 lines
958 B
Go

package nginx
import (
"strings"
"testing"
)
func TestManagedObservabilityLuaIsHealthOnly(t *testing.T) {
t.Parallel()
files := ManagedObservabilityLuaFiles()
var logLua, readLua string
for _, file := range files {
switch file.Path {
case "log.lua":
logLua = file.Content
case "read.lua":
readLua = file.Content
}
}
if logLua == "" || readLua == "" {
t.Fatal("expected log.lua and read.lua")
}
// Business counters must not be written in log phase.
if strings.Contains(logLua, "openresty_rx_bytes") ||
strings.Contains(logLua, "request_count") {
t.Fatal("log.lua must not accumulate business counters")
}
if !strings.Contains(readLua, "connections") || !strings.Contains(readLua, "ok") {
t.Fatal("read.lua must expose ok + connections health snapshot")
}
if strings.Contains(readLua, "top_domains") || strings.Contains(readLua, "request_count") {
t.Fatal("read.lua must not expose business traffic aggregates")
}
}