Documentation ¶
Overview ¶
Package server provides functions for goma servers.
Index ¶
- func ClusterName(ctx context.Context) string
- func DefaultDialOption() []grpc.DialOption
- func DialContext(ctx context.Context, addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func Flush()
- func GC(ctx context.Context) int64
- func HostName(ctx context.Context) string
- func Init(ctx context.Context, projectID, name string) error
- func MemoryLimit() (int64, error)
- func NewHTTP(port int, handler http.Handler) *http.Server
- func NewLimitedSampler(fraction, qps float64) trace.Sampler
- func ProjectID(ctx context.Context) string
- func ResidentMemorySize() int64
- func Run(ctx context.Context, servers ...Server)
- func SetupHTTPClient()
- type GRPC
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClusterName ¶
ClusterName returns cluster name where server is running on.
func DefaultDialOption ¶
func DefaultDialOption() []grpc.DialOption
DefaultDialOption is default dial option to record opencensus stats and traces.
func DialContext ¶
func DialContext(ctx context.Context, addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
DialContext dials to addr with default dial options.
func Init ¶
Init initializes opencensus instrumentations, and error reporter. If projectID is not empty, it registers stackdriver exporter for the project. It also calls SetupHTTPClient.
func MemoryLimit ¶
MemoryLimit returns server memory limit, set by cgroup.
func NewLimitedSampler ¶
NewLimitedSampler returns trace sampler limited by fraction and qps.
func ResidentMemorySize ¶
func ResidentMemorySize() int64
ResidentMemorySize reports latest measured resident memory size in bytes.
func Run ¶
Run runs servers. It will registers /debug/* for opencensus zpages on default http handler. This is typically invoked as the last statement in the server's main function.
func SetupHTTPClient ¶
func SetupHTTPClient()
SetupHTTPClient sets up http default client to monitor by opencensus.
Types ¶
type GRPC ¶
GRPC represents grpc server.
func NewGRPC ¶
func NewGRPC(port int, opts ...grpc.ServerOption) (GRPC, error)
NewGRPC creates grpc server listening on port.
func (GRPC) ListenAndServe ¶
ListenAndServe listens on Listener and handles requests with Server.