Documentation
¶
Index ¶
- type Config
- type MetricTypes
- type Metrics
- type PrometheusPlugin
- func (p *PrometheusPlugin) Close() error
- func (p *PrometheusPlugin) Init() error
- func (p *PrometheusPlugin) Name() string
- func (p *PrometheusPlugin) RegisterWithServer(*grpc.Server) error
- func (p *PrometheusPlugin) StreamClientInterceptor() grpc.StreamClientInterceptor
- func (p *PrometheusPlugin) StreamServerInterceptor() grpc.StreamServerInterceptor
- func (p *PrometheusPlugin) UnaryClientInterceptor() grpc.UnaryClientInterceptor
- func (p *PrometheusPlugin) UnaryServerInterceptor() grpc.UnaryServerInterceptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// 指标的命名空间
Namespace string
// HTTP服务器的地址
HTTPAddr string
// 指标路径
MetricsPath string
// 是否启用
Enabled bool
// 收集的指标类型
EnabledMetrics MetricTypes
}
Config 是Prometheus插件的配置
type MetricTypes ¶
type MetricTypes struct {
// 请求计数器
RequestCounter bool
// 请求延迟
RequestLatency bool
// 请求大小
RequestSize bool
// 响应大小
ResponseSize bool
// 活跃连接数
ActiveConnections bool
// 活跃流数
ActiveStreams bool
}
MetricTypes 表示启用的指标类型
type Metrics ¶
type Metrics struct {
// 请求计数
RequestCounter *prometheus.CounterVec
// 请求延迟
RequestLatency *prometheus.HistogramVec
// 请求大小
RequestSize *prometheus.HistogramVec
// 响应大小
ResponseSize *prometheus.HistogramVec
// 活跃连接数
ActiveConnections prometheus.Gauge
// 活跃流数
ActiveStreams *prometheus.GaugeVec
}
Metrics 包含所有注册的指标
type PrometheusPlugin ¶
type PrometheusPlugin struct {
// contains filtered or unexported fields
}
PrometheusPlugin 是一个用于收集Prometheus指标的插件
func NewPrometheusPlugin ¶
func NewPrometheusPlugin(config Config) *PrometheusPlugin
NewPrometheusPlugin 创建一个新的Prometheus插件
func (*PrometheusPlugin) RegisterWithServer ¶
func (p *PrometheusPlugin) RegisterWithServer(*grpc.Server) error
RegisterWithServer 实现ServerPlugin接口
func (*PrometheusPlugin) StreamClientInterceptor ¶
func (p *PrometheusPlugin) StreamClientInterceptor() grpc.StreamClientInterceptor
StreamClientInterceptor 实现InterceptorPlugin接口
func (*PrometheusPlugin) StreamServerInterceptor ¶
func (p *PrometheusPlugin) StreamServerInterceptor() grpc.StreamServerInterceptor
StreamServerInterceptor 实现InterceptorPlugin接口
func (*PrometheusPlugin) UnaryClientInterceptor ¶
func (p *PrometheusPlugin) UnaryClientInterceptor() grpc.UnaryClientInterceptor
UnaryClientInterceptor 实现InterceptorPlugin接口
func (*PrometheusPlugin) UnaryServerInterceptor ¶
func (p *PrometheusPlugin) UnaryServerInterceptor() grpc.UnaryServerInterceptor
UnaryServerInterceptor 实现InterceptorPlugin接口
Click to show internal directories.
Click to hide internal directories.