import "go.chromium.org/goma/server/server"
Package server provides functions for goma servers.
cluster.go dial.go init.go limited_sampler.go process_collector.go resource.go server.go
const ( // same as default sampler // https://github.com/census-instrumentation/opencensus-go/blob/master/trace/sampling.go#L21 DefaultTraceFraction = 1e-4 // trace API limit is 4800/minutes. // https://cloud.google.com/trace/docs/quotas#trace-api-limit // 4800/60/(total number of replicas in the project) DefaultTraceQPS = 0.05 )
ClusterName returns cluster name where server is running on.
func DefaultDialOption() []grpc.DialOption
DefaultDialOption is default dial option to record opencensus stats and traces.
func DialContext(ctx context.Context, addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
DialContext dials to addr with default dial options.
func Flush()
Flush flushes opencensus data.
GC runs garbage-collector and reports latest measured resident memory size in bytes.
HostName returns hostname. in k8s, it is podname.
Init initializes opencensus instrumentations, and error reporter. If projectID is not empty, it registers stackdriver exporter for the project. It also calls SetupHTTPClient.
MemoryLimit returns server memory limit, set by cgroup.
NewHTTP creates http server.
NewLimitedSampler returns trace sampler limited by fraction and qps.
ProjectID returns current project id.
ResidentMemorySize reports latest measured resident memory size in bytes.
Run runs servers. This is typically invoked as the last statement in the server's main function.
func SetupHTTPClient()
SetupHTTPClient sets up http default client to monitor by opencensus.
GRPC represents grpc server.
NewGRPC creates grpc server listening on port.
ListenAndServe listens on Listener and handles requests with Server.
Shutdown gracefully shuts down the server.
type Server interface { // ListenAndServe listens and then serve to handle requests on incoming // connections. ListenAndServe() error // Shutdown gracefully shuts down the server. Shutdown(context.Context) error }
Server is interface to control server.
NewHTTPS creates https server.
Path | Synopsis |
---|---|
healthz | Package healthz provides /healthz for grpc server. |
Package server imports 37 packages (graph) and is imported by 9 packages. Updated 2020-10-27. Refresh now. Tools for package owners.