Package service defines methods to register a gRPC client/service for a profiling service that is exposed in the same server. This service can be queried by a client to remotely manage the gRPC profiling behaviour of an application.


Notice: This package is EXPERIMENTAL and may be changed or removed in a later release.



This section is empty.


This section is empty.


func Init

func Init(pc *ProfilingConfig) error

    Init takes a *ProfilingConfig to initialize profiling (turned on/off depending on the value set in pc.Enabled) and register the profiling service in the server provided in pc.Server.


    type ProfilingConfig

    type ProfilingConfig struct {
    	// Setting this to true will enable profiling.
    	Enabled bool
    	// Profiling uses a circular buffer (ring buffer) to store statistics for
    	// only the last few RPCs so that profiling stats do not grow unbounded. This
    	// parameter defines the upper limit on the number of RPCs for which
    	// statistics should be stored at any given time. An average RPC requires
    	// approximately 2-3 KiB of memory for profiling-related statistics, so
    	// choose an appropriate number based on the amount of memory you can afford.
    	StreamStatsSize uint32
    	// To expose the profiling service and its methods, a *grpc.Server must be
    	// provided.
    	Server *grpc.Server

      ProfilingConfig defines configuration options for the Init method.

      Source Files