Documentation ¶
Index ¶
- type Config
- type ExecutableMetadataArgs
- type ExecutableOpener
- type FrameMetadataArgs
- type HostMetadataReporter
- type Metrics
- type MetricsReporter
- type OTLPReporter
- func (r *OTLPReporter) ExecutableKnown(fileID libpf.FileID) bool
- func (r *OTLPReporter) ExecutableMetadata(args *ExecutableMetadataArgs)
- func (r *OTLPReporter) FrameKnown(frameID libpf.FrameID) bool
- func (r *OTLPReporter) FrameMetadata(args *FrameMetadataArgs)
- func (r *OTLPReporter) GetMetrics() Metrics
- func (r *OTLPReporter) ReportCountForTrace(_ libpf.TraceHash, _ uint16, _ *TraceEventMeta)
- func (r *OTLPReporter) ReportFramesForTrace(_ *libpf.Trace)
- func (r *OTLPReporter) ReportHostMetadata(metadataMap map[string]string)
- func (r *OTLPReporter) ReportHostMetadataBlocking(_ context.Context, metadataMap map[string]string, _ int, _ time.Duration) error
- func (r *OTLPReporter) ReportMetrics(_ uint32, _ []uint32, _ []int64)
- func (r *OTLPReporter) ReportTraceEvent(trace *libpf.Trace, meta *TraceEventMeta)
- func (r *OTLPReporter) Start(ctx context.Context) error
- func (r *OTLPReporter) Stop()
- func (r *OTLPReporter) SupportsReportTraceEvent() bool
- type Reporter
- type StatsHandlerImpl
- func (sh *StatsHandlerImpl) GetRPCBytesIn() int64
- func (sh *StatsHandlerImpl) GetRPCBytesOut() int64
- func (sh *StatsHandlerImpl) GetWireBytesIn() int64
- func (sh *StatsHandlerImpl) GetWireBytesOut() int64
- func (sh *StatsHandlerImpl) HandleConn(context.Context, stats.ConnStats)
- func (sh *StatsHandlerImpl) HandleRPC(ctx context.Context, s stats.RPCStats)
- func (sh *StatsHandlerImpl) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context
- func (sh *StatsHandlerImpl) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type SymbolReporter
- type Times
- type TraceEventMeta
- type TraceReporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Name defines the name of the agent. Name string // Version defines the version of the agent. Version string // CollAgentAddr defines the destination of the backend connection. CollAgentAddr string // MaxRPCMsgSize defines the maximum size of a gRPC message. MaxRPCMsgSize int // Disable secure communication with Collection Agent. DisableTLS bool // ExecutablesCacheElements defines item capacity of the executables cache. ExecutablesCacheElements uint32 // FramesCacheElements defines the item capacity of the frames cache. FramesCacheElements uint32 // CGroupCacheElements defines the item capacity of the cgroup cache. CGroupCacheElements uint32 // samplesPerSecond defines the number of samples per second. SamplesPerSecond int // HostID is the host ID to be sent to the collection agent. HostID uint64 // KernelVersion is the kernel version of the host. KernelVersion string // HostName is the name of the host. HostName string // IPAddress is the IP address of the host. IPAddress string // Number of connection attempts to the collector after which we give up retrying. MaxGRPCRetries uint32 GRPCOperationTimeout time.Duration GRPCStartupBackoffTime time.Duration GRPCConnectionTimeout time.Duration ReportInterval time.Duration // gRPCInterceptor is the client gRPC interceptor, e.g., for sending gRPC metadata. GRPCClientInterceptor grpc.UnaryClientInterceptor }
type ExecutableMetadataArgs ¶
type ExecutableMetadataArgs struct { // FileID is a unique identifier of the executable. FileID libpf.FileID // FileName is the base filename of the executable. FileName string // GnuBuildID is the GNU build ID from .note.gnu.build-id, if any. GnuBuildID string // DebuglinkFileName is the path to the matching debug file // from the .gnu.debuglink, if any. The caller should // verify that the file in question matches the GnuBuildID of this executable.. DebuglinkFileName string // Interp is the discovered interpreter type of this executable, if any. Interp libpf.InterpreterType // Open is a function that can be used to open the executable for reading, // or nil for interpreters that don't support this. Open ExecutableOpener }
ExecutableMetadataArgs collects metadata about a discovered executable, for reporting to a SymbolReporter via the ExecutableMetadata function.
type ExecutableOpener ¶
type ExecutableOpener = func() (process.ReadAtCloser, error)
ExecutableOpener is a function that attempts to open an executable.
type FrameMetadataArgs ¶
type FrameMetadataArgs struct { // FrameID is a unique identifier for the frame. FrameID libpf.FrameID // FunctionName is the name of the function for the frame. FunctionName string // SourceFile is the source code file name for the frame. SourceFile string // SourceLine is the source code level line number of this frame. SourceLine libpf.SourceLineno // FunctionOffset is the line offset from function start line for the frame. FunctionOffset uint32 }
FrameMetadataArgs collects metadata about a single frame in a trace, for reporting it to a SymbolReporter via the FrameMetadata method.
type HostMetadataReporter ¶
type HostMetadataReporter interface { // ReportHostMetadata enqueues host metadata for sending (to the collection agent). ReportHostMetadata(metadataMap map[string]string) // ReportHostMetadataBlocking sends host metadata to the collection agent. ReportHostMetadataBlocking(ctx context.Context, metadataMap map[string]string, maxRetries int, waitRetry time.Duration) error }
type Metrics ¶
type Metrics struct { RPCBytesOutCount int64 RPCBytesInCount int64 WireBytesOutCount int64 WireBytesInCount int64 }
Metrics holds the metric counters for the reporter package.
type MetricsReporter ¶
type OTLPReporter ¶
type OTLPReporter struct {
// contains filtered or unexported fields
}
OTLPReporter receives and transforms information to be OTLP/profiles compliant.
func NewOTLP ¶
func NewOTLP(cfg *Config) (*OTLPReporter, error)
NewOTLP returns a new instance of OTLPReporter
func (*OTLPReporter) ExecutableKnown ¶
func (r *OTLPReporter) ExecutableKnown(fileID libpf.FileID) bool
ExecutableKnown returns true if the metadata of the Executable specified by fileID is cached in the reporter.
func (*OTLPReporter) ExecutableMetadata ¶
func (r *OTLPReporter) ExecutableMetadata(args *ExecutableMetadataArgs)
ExecutableMetadata accepts a fileID with the corresponding filename and caches this information.
func (*OTLPReporter) FrameKnown ¶
func (r *OTLPReporter) FrameKnown(frameID libpf.FrameID) bool
FrameKnown returns true if the metadata of the Frame specified by frameID is cached in the reporter.
func (*OTLPReporter) FrameMetadata ¶
func (r *OTLPReporter) FrameMetadata(args *FrameMetadataArgs)
FrameMetadata accepts metadata associated with a frame and caches this information.
func (*OTLPReporter) GetMetrics ¶
func (r *OTLPReporter) GetMetrics() Metrics
GetMetrics returns internal metrics of OTLPReporter.
func (*OTLPReporter) ReportCountForTrace ¶
func (r *OTLPReporter) ReportCountForTrace(_ libpf.TraceHash, _ uint16, _ *TraceEventMeta)
ReportCountForTrace is a NOP for OTLPReporter.
func (*OTLPReporter) ReportFramesForTrace ¶
func (r *OTLPReporter) ReportFramesForTrace(_ *libpf.Trace)
ReportFramesForTrace is a NOP for OTLPReporter.
func (*OTLPReporter) ReportHostMetadata ¶
func (r *OTLPReporter) ReportHostMetadata(metadataMap map[string]string)
ReportHostMetadata enqueues host metadata.
func (*OTLPReporter) ReportHostMetadataBlocking ¶
func (r *OTLPReporter) ReportHostMetadataBlocking(_ context.Context, metadataMap map[string]string, _ int, _ time.Duration) error
ReportHostMetadataBlocking enqueues host metadata.
func (*OTLPReporter) ReportMetrics ¶
func (r *OTLPReporter) ReportMetrics(_ uint32, _ []uint32, _ []int64)
ReportMetrics is a NOP for OTLPReporter.
func (*OTLPReporter) ReportTraceEvent ¶
func (r *OTLPReporter) ReportTraceEvent(trace *libpf.Trace, meta *TraceEventMeta)
ReportTraceEvent enqueues reported trace events for the OTLP reporter.
func (*OTLPReporter) Start ¶
func (r *OTLPReporter) Start(ctx context.Context) error
Start sets up and manages the reporting connection to a OTLP backend.
func (*OTLPReporter) Stop ¶
func (r *OTLPReporter) Stop()
Stop triggers a graceful shutdown of OTLPReporter.
func (*OTLPReporter) SupportsReportTraceEvent ¶
func (r *OTLPReporter) SupportsReportTraceEvent() bool
type Reporter ¶
type Reporter interface { TraceReporter SymbolReporter HostMetadataReporter MetricsReporter // Start starts the reporter in the background. // // If the reporter needs to perform a long-running starting operation then it // is recommended that Start() returns quickly and the long-running operation // is performed in the background. Start(context.Context) error // Stop triggers a graceful shutdown of the reporter. Stop() // GetMetrics returns the reporter internal metrics. GetMetrics() Metrics }
Reporter is the top-level interface implemented by a full reporter.
type StatsHandlerImpl ¶
type StatsHandlerImpl struct {
// contains filtered or unexported fields
}
func NewStatsHandler ¶
func NewStatsHandler() *StatsHandlerImpl
NewStatsHandler creates a new statistics handler.
func (*StatsHandlerImpl) GetRPCBytesIn ¶
func (sh *StatsHandlerImpl) GetRPCBytesIn() int64
func (*StatsHandlerImpl) GetRPCBytesOut ¶
func (sh *StatsHandlerImpl) GetRPCBytesOut() int64
func (*StatsHandlerImpl) GetWireBytesIn ¶
func (sh *StatsHandlerImpl) GetWireBytesIn() int64
func (*StatsHandlerImpl) GetWireBytesOut ¶
func (sh *StatsHandlerImpl) GetWireBytesOut() int64
func (*StatsHandlerImpl) HandleConn ¶
func (sh *StatsHandlerImpl) HandleConn(context.Context, stats.ConnStats)
HandleConn implements the stats.Handler interface.
func (*StatsHandlerImpl) HandleRPC ¶
func (sh *StatsHandlerImpl) HandleRPC(ctx context.Context, s stats.RPCStats)
HandleRPC implements the stats.Handler interface.
func (*StatsHandlerImpl) TagConn ¶
func (sh *StatsHandlerImpl) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context
TagConn implements the stats.Handler interface.
func (*StatsHandlerImpl) TagRPC ¶
func (sh *StatsHandlerImpl) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
TagRPC implements the stats.Handler interface.
type SymbolReporter ¶
type SymbolReporter interface { // ExecutableKnown may be used to query the reporter if the FileID is known. // The callers of ExecutableMetadata can optionally use this method to determine if the data // is already cached and avoid extra work resolving the metadata. If the reporter returns false, // the caller will resolve the executable metadata and submit it to the reporter // via a subsequent ExecutableMetadata call. ExecutableKnown(fileID libpf.FileID) bool // ExecutableMetadata accepts a FileID with the corresponding filename // and takes some action with it (for example, it might cache it for // periodic reporting to a backend). // // The `Open` argument can be used to open the executable for reading. Interpreters // that don't support this may pass a `nil` function pointer. Implementations that // wish to upload executables should NOT block this function to do so and instead just // open the file and then enqueue the upload in the background. ExecutableMetadata(args *ExecutableMetadataArgs) // FrameKnown may be used to query the reporter if the FrameID is known. The interpreter // modules can optionally use this method to determine if the data is already cached // and avoid extra work resolving the metadata. If the reporter returns false, // the interpreter plugin will resolve the frame metadata and submit it to the reporter // via a subsequent FrameMetadata call. FrameKnown(frameID libpf.FrameID) bool // FrameMetadata accepts metadata associated with a frame and caches this information before // a periodic reporting to the backend. FrameMetadata(frameMetadata *FrameMetadataArgs) }
type Times ¶
type Times interface { ReportInterval() time.Duration ReportMetricsInterval() time.Duration GRPCConnectionTimeout() time.Duration GRPCOperationTimeout() time.Duration GRPCStartupBackoffTime() time.Duration GRPCAuthErrorDelay() time.Duration }
Times is a subset of config.IntervalsAndTimers.
type TraceEventMeta ¶
type TraceReporter ¶
type TraceReporter interface { // ReportFramesForTrace accepts a trace with the corresponding frames // and caches this information before a periodic reporting to the backend. ReportFramesForTrace(trace *libpf.Trace) // ReportCountForTrace accepts a hash of a trace with a corresponding count and // caches this information before a periodic reporting to the backend. ReportCountForTrace(traceHash libpf.TraceHash, count uint16, meta *TraceEventMeta) // ReportTraceEvent accepts a trace event (trace metadata with frames and counts) // and caches it for reporting to the backend. It returns true if the event was // enqueued for reporting, and false if the event was ignored. ReportTraceEvent(trace *libpf.Trace, meta *TraceEventMeta) // SupportsReportTraceEvent returns true if the reporter supports reporting trace events // via ReportTraceEvent(). SupportsReportTraceEvent() bool }