health_aggregator

package
v0.0.0-...-1a39f93 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package health_aggregator 實作健康指標聚合插件

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPoint

type DataPoint struct {
	Timestamp time.Time `json:"timestamp"`
	Value     float64   `json:"value"`
}

DataPoint 數據點

type HealthQueryRequest

type HealthQueryRequest struct {
	ServiceName string            `json:"service_name"`
	TimeRange   string            `json:"time_range"`
	Metrics     []string          `json:"metrics"`
	Filters     map[string]string `json:"filters,omitempty"`
}

HealthQueryRequest 健康查詢請求

type HealthQueryResponse

type HealthQueryResponse struct {
	ServiceName string                 `json:"service_name"`
	Metrics     map[string]*MetricData `json:"metrics"`
	Timestamp   time.Time              `json:"timestamp"`
	Warnings    []string               `json:"warnings,omitempty"`
}

HealthQueryResponse 健康查詢回應

type MetricData

type MetricData struct {
	Name       string      `json:"name"`
	Values     []DataPoint `json:"values"`
	Statistics *Statistics `json:"statistics,omitempty"`
}

MetricData 指標數據

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin 實作健康聚合器插件,符合 Handler 介面

func New

func New() *Plugin

New 創建新的健康聚合器插件

func (*Plugin) Close

func (p *Plugin) Close() error

Close 實作 ClosableHandler 介面 - 清理資源

func (*Plugin) CloseWithContext

func (p *Plugin) CloseWithContext(ctx context.Context) error

CloseWithContext 帶超時控制的關閉方法

func (*Plugin) HealthCheck

func (p *Plugin) HealthCheck() error

HealthCheck 實作 HealthAwareHandler 介面 - 健康檢查

func (*Plugin) Initialize

func (p *Plugin) Initialize(logger *zap.Logger)

Initialize 初始化插件(可選,用於配置)

func (*Plugin) Invoke

func (p *Plugin) Invoke(ctx context.Context, req *pb.InvokeRequest) (*pb.InvokeResponse, error)

Invoke 實作 Handler 介面 - 處理插件調用

type Statistics

type Statistics struct {
	Min   float64 `json:"min"`
	Max   float64 `json:"max"`
	Avg   float64 `json:"avg"`
	Count int64   `json:"count"`
}

Statistics 統計資訊

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL