statservice

package module
v0.0.0-...-9216de0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

README

grpc-go-stat-service

grpc-go-stat-service is runtime of golang information service.

inspired by golang-stats-api-handler

Installation

$ go get github.com/f110/grpc-go-stat-service

Usage

Server:

import (
	"github.com/f110/grpc-go-stat-service"
	"github.com/golang/protobuf/ptypes/any"
)

func NewServer() {
	s := statservice.New(func () *any.Any {return nil})
	statservice.RegisterStatServer(grpc.Server, statservice.StatServer(s))
}

Client:

import (
	"github.com/f110/grpc-go-stat-service"
	"google.golang.org/grpc"
)

func NewClient() {
    conn, _ := grpc.Dial(ServerAddr)
    statClient := statservice.NewStatClient(conn)
    stat := statClient.Get(context.Background(), &statservice.GetRequest{})
}

Documentation

Overview

Package statservice is a generated protocol buffer package.

It is generated from these files:

stat.proto

It has these top-level messages:

GetRequest
GetResponse
RuntimeStat

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterStatServer

func RegisterStatServer(s *grpc.Server, srv StatServer)

Types

type GetRequest

type GetRequest struct {
}

func (*GetRequest) Descriptor

func (*GetRequest) Descriptor() ([]byte, []int)

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) Reset

func (m *GetRequest) Reset()

func (*GetRequest) String

func (m *GetRequest) String() string

type GetResponse

type GetResponse struct {
	Time         string               `protobuf:"bytes,1,opt,name=time" json:"time,omitempty"`
	GoVersion    string               `protobuf:"bytes,2,opt,name=go_version,json=goVersion" json:"go_version,omitempty"`
	GoOs         string               `protobuf:"bytes,3,opt,name=go_os,json=goOs" json:"go_os,omitempty"`
	GoArch       string               `protobuf:"bytes,4,opt,name=go_arch,json=goArch" json:"go_arch,omitempty"`
	CpuNum       int32                `protobuf:"varint,5,opt,name=cpu_num,json=cpuNum" json:"cpu_num,omitempty"`
	GoMaxProcs   int32                `protobuf:"varint,6,opt,name=go_max_procs,json=goMaxProcs" json:"go_max_procs,omitempty"`
	RuntimeStat  *RuntimeStat         `protobuf:"bytes,7,opt,name=runtime_stat,json=runtimeStat" json:"runtime_stat,omitempty"`
	InternalStat *google_protobuf.Any `protobuf:"bytes,8,opt,name=internal_stat,json=internalStat" json:"internal_stat,omitempty"`
}

func (*GetResponse) Descriptor

func (*GetResponse) Descriptor() ([]byte, []int)

func (*GetResponse) GetCpuNum

func (m *GetResponse) GetCpuNum() int32

func (*GetResponse) GetGoArch

func (m *GetResponse) GetGoArch() string

func (*GetResponse) GetGoMaxProcs

func (m *GetResponse) GetGoMaxProcs() int32

func (*GetResponse) GetGoOs

func (m *GetResponse) GetGoOs() string

func (*GetResponse) GetGoVersion

func (m *GetResponse) GetGoVersion() string

func (*GetResponse) GetInternalStat

func (m *GetResponse) GetInternalStat() *google_protobuf.Any

func (*GetResponse) GetRuntimeStat

func (m *GetResponse) GetRuntimeStat() *RuntimeStat

func (*GetResponse) GetTime

func (m *GetResponse) GetTime() string

func (*GetResponse) ProtoMessage

func (*GetResponse) ProtoMessage()

func (*GetResponse) Reset

func (m *GetResponse) Reset()

func (*GetResponse) String

func (m *GetResponse) String() string

type RuntimeStat

type RuntimeStat struct {
	Time             string    `protobuf:"bytes,1,opt,name=time" json:"time,omitempty"`
	GoroutineNum     int32     `protobuf:"varint,2,opt,name=goroutine_num,json=goroutineNum" json:"goroutine_num,omitempty"`
	CgoCallNum       int32     `protobuf:"varint,3,opt,name=cgo_call_num,json=cgoCallNum" json:"cgo_call_num,omitempty"`
	MemoryAlloc      uint64    `protobuf:"varint,4,opt,name=memory_alloc,json=memoryAlloc" json:"memory_alloc,omitempty"`
	MemoryTotalAlloc uint64    `protobuf:"varint,5,opt,name=memory_total_alloc,json=memoryTotalAlloc" json:"memory_total_alloc,omitempty"`
	MemorySys        uint64    `protobuf:"varint,6,opt,name=memory_sys,json=memorySys" json:"memory_sys,omitempty"`
	MemoryLookups    uint64    `protobuf:"varint,7,opt,name=memory_lookups,json=memoryLookups" json:"memory_lookups,omitempty"`
	MemoryMallocs    uint64    `protobuf:"varint,8,opt,name=memory_mallocs,json=memoryMallocs" json:"memory_mallocs,omitempty"`
	MemoryFrees      uint64    `protobuf:"varint,9,opt,name=memory_frees,json=memoryFrees" json:"memory_frees,omitempty"`
	StackInUse       uint64    `protobuf:"varint,10,opt,name=stack_in_use,json=stackInUse" json:"stack_in_use,omitempty"`
	HeapAlloc        uint64    `protobuf:"varint,11,opt,name=heap_alloc,json=heapAlloc" json:"heap_alloc,omitempty"`
	HeapSys          uint64    `protobuf:"varint,12,opt,name=heap_sys,json=heapSys" json:"heap_sys,omitempty"`
	HeapIdle         uint64    `protobuf:"varint,13,opt,name=heap_idle,json=heapIdle" json:"heap_idle,omitempty"`
	HeapInUse        uint64    `protobuf:"varint,14,opt,name=heap_in_use,json=heapInUse" json:"heap_in_use,omitempty"`
	HeapReleased     uint64    `protobuf:"varint,15,opt,name=heap_released,json=heapReleased" json:"heap_released,omitempty"`
	HeapObjects      uint64    `protobuf:"varint,16,opt,name=heap_objects,json=heapObjects" json:"heap_objects,omitempty"`
	GcNext           uint64    `protobuf:"varint,17,opt,name=gc_next,json=gcNext" json:"gc_next,omitempty"`
	GcLast           uint64    `protobuf:"varint,18,opt,name=gc_last,json=gcLast" json:"gc_last,omitempty"`
	GcNum            uint32    `protobuf:"varint,19,opt,name=gc_num,json=gcNum" json:"gc_num,omitempty"`
	GcPerSecond      float64   `protobuf:"fixed64,20,opt,name=gc_per_second,json=gcPerSecond" json:"gc_per_second,omitempty"`
	GcPausePerSecond float64   `protobuf:"fixed64,21,opt,name=gc_pause_per_second,json=gcPausePerSecond" json:"gc_pause_per_second,omitempty"`
	GcPause          []float64 `protobuf:"fixed64,22,rep,packed,name=gc_pause,json=gcPause" json:"gc_pause,omitempty"`
}

func (*RuntimeStat) Descriptor

func (*RuntimeStat) Descriptor() ([]byte, []int)

func (*RuntimeStat) GetCgoCallNum

func (m *RuntimeStat) GetCgoCallNum() int32

func (*RuntimeStat) GetGcLast

func (m *RuntimeStat) GetGcLast() uint64

func (*RuntimeStat) GetGcNext

func (m *RuntimeStat) GetGcNext() uint64

func (*RuntimeStat) GetGcNum

func (m *RuntimeStat) GetGcNum() uint32

func (*RuntimeStat) GetGcPause

func (m *RuntimeStat) GetGcPause() []float64

func (*RuntimeStat) GetGcPausePerSecond

func (m *RuntimeStat) GetGcPausePerSecond() float64

func (*RuntimeStat) GetGcPerSecond

func (m *RuntimeStat) GetGcPerSecond() float64

func (*RuntimeStat) GetGoroutineNum

func (m *RuntimeStat) GetGoroutineNum() int32

func (*RuntimeStat) GetHeapAlloc

func (m *RuntimeStat) GetHeapAlloc() uint64

func (*RuntimeStat) GetHeapIdle

func (m *RuntimeStat) GetHeapIdle() uint64

func (*RuntimeStat) GetHeapInUse

func (m *RuntimeStat) GetHeapInUse() uint64

func (*RuntimeStat) GetHeapObjects

func (m *RuntimeStat) GetHeapObjects() uint64

func (*RuntimeStat) GetHeapReleased

func (m *RuntimeStat) GetHeapReleased() uint64

func (*RuntimeStat) GetHeapSys

func (m *RuntimeStat) GetHeapSys() uint64

func (*RuntimeStat) GetMemoryAlloc

func (m *RuntimeStat) GetMemoryAlloc() uint64

func (*RuntimeStat) GetMemoryFrees

func (m *RuntimeStat) GetMemoryFrees() uint64

func (*RuntimeStat) GetMemoryLookups

func (m *RuntimeStat) GetMemoryLookups() uint64

func (*RuntimeStat) GetMemoryMallocs

func (m *RuntimeStat) GetMemoryMallocs() uint64

func (*RuntimeStat) GetMemorySys

func (m *RuntimeStat) GetMemorySys() uint64

func (*RuntimeStat) GetMemoryTotalAlloc

func (m *RuntimeStat) GetMemoryTotalAlloc() uint64

func (*RuntimeStat) GetStackInUse

func (m *RuntimeStat) GetStackInUse() uint64

func (*RuntimeStat) GetTime

func (m *RuntimeStat) GetTime() string

func (*RuntimeStat) ProtoMessage

func (*RuntimeStat) ProtoMessage()

func (*RuntimeStat) Reset

func (m *RuntimeStat) Reset()

func (*RuntimeStat) String

func (m *RuntimeStat) String() string

type Service

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

func New

func New(internalFunc func() *any.Any) *Service

func (*Service) Get

func (s *Service) Get(ctx context.Context, req *GetRequest) (*GetResponse, error)

type StatClient

type StatClient interface {
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
}

func NewStatClient

func NewStatClient(cc *grpc.ClientConn) StatClient

type StatServer

type StatServer interface {
	Get(context.Context, *GetRequest) (*GetResponse, error)
}

Jump to

Keyboard shortcuts

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