Documentation
¶
Overview ¶
Package observability provides unified observability initialization for Go platform According to SPEC.md: "統一可觀察性系統(Console、Prometheus、OTLP 導出器)" "應用端僅輸出 OTLP 至 Alloy/Collector;憑證與 API Key 僅配置於 Alloy"
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitFromConfig ¶
func InitFromConfig(cfg interface{}) (func(), error)
InitFromConfig initializes unified observability according to SPEC.md requirements - Single OTLP exporter endpoint (to Alloy/Collector) - JSON structured logs to stdout (collected by Alloy) - Resource attributes as required by SPEC.md
Types ¶
type LoggerClose ¶
type LoggerClose func() error
func InitZapLoggerToFile ¶
func InitZapLoggerToFile(path string) (*otelzap.Logger, LoggerClose, error)
InitZapLoggerToFile 建議在 process 啟動時呼叫一次 path 例如: ./var/log/detectviz/detectviz.log 說明: - 採用 zap ConsoleEncoder(非 JSON),輸出格式接近 Alloy:ts level caller msg key=value ... - 仍使用 lumberjack 進行檔案輪轉,並雙寫至 stdout,供 Alloy file tail 轉發至雲端。 - 自動建立必要的目錄結構