prometheus

package
v0.0.0-...-3481ce3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: MIT Imports: 4 Imported by: 0

README

备注

直接使用 github.com/grpc-ecosystem/go-grpc-prometheus 实现

docker-compose.yml

version: '2'

services:
  prometheus:
    image: prom/prometheus
    ports:
      - 9090:9090
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
  grafana:
    image: grafana/grafana
    ports:
      - 3000:3000
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=password
    volumes:
      - $PWD/extra/grafana_db:/var/lib/grafana grafana/grafana

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPrometheus

func NewPrometheus(opts ...Option) middleware.Middleware

Types

type Option

type Option func(*Options)

Option 实例值设置

func Enable

func Enable(enable bool) Option

Enable 是否启用普罗米修斯指标采集中间件

func FilterOutFunc

func FilterOutFunc(filterOutFunc middleware.FilterFunc) Option

FilterOutFunc 设置中间件忽略函数列表

type Options

type Options struct {
	Enable        bool // 是否启用监控
	FilterOutFunc middleware.FilterFunc
}

Options 注册相关参数

type Prometheus

type Prometheus struct {
	Options *Options
}

Prometheus 普罗米修斯指标监控中间件

func (*Prometheus) StreamClient

func (p *Prometheus) StreamClient(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (cs grpc.ClientStream, err error)

StreamClient 流式服客户中间件 grpc.StreamClientInterceptor

func (*Prometheus) StreamHandler

func (p *Prometheus) StreamHandler(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error)

StreamHandler 流式中间件

func (*Prometheus) UnaryClient

func (p *Prometheus) UnaryClient(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) (err error)

UnaryClient 非流式客户端中间件 grpc.UnaryClientInterceptor

func (*Prometheus) UnaryHandler

func (p *Prometheus) UnaryHandler(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)

UnaryHandler 非流式中间件

Jump to

Keyboard shortcuts

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