Documentation ¶
Overview ¶
Package reporter implements a central reporting mechanism for various data types. The provided information is cached before it is sent in a configured interval to the destination. It may happen that information get lost if reporter can not send the provided information to the destination.
As we must convert our internal types, e.g. libpf.TraceHash, into primitive types, before sending them over the wire, the question arises as to where to do this? In this package we favor doing so as close to the actual 'send' over the network as possible. So, the ReportX functions that clients of this package make use of try to accept our types, push them onto a reporting queue, and then do the conversion in whichever function flushes that queue and sends the data over the wire.
Index ¶
- type Config
- type GRPCReporter
- func (r *GRPCReporter) ExecutableMetadata(ctx context.Context, fileID libpf.FileID, fileName, buildID string)
- func (r *GRPCReporter) FrameMetadata(fileID libpf.FileID, addressOrLine libpf.AddressOrLineno, ...)
- func (r *GRPCReporter) GetMetrics() Metrics
- func (r *GRPCReporter) ReportCountForTrace(traceHash libpf.TraceHash, timestamp libpf.UnixTime32, count uint16, ...)
- func (r *GRPCReporter) ReportFallbackSymbol(frameID libpf.FrameID, symbol string)
- func (r *GRPCReporter) ReportFramesForTrace(trace *libpf.Trace)
- func (r *GRPCReporter) ReportHostMetadata(_ map[string]string)
- func (r *GRPCReporter) ReportHostMetadataBlocking(_ context.Context, _ map[string]string, _ int, _ time.Duration) error
- func (r *GRPCReporter) ReportMetrics(timestamp uint32, ids []uint32, values []int64)
- func (r *GRPCReporter) Stop()
- type HostMetadata
- type HostMetadataReporter
- type Metrics
- type MetricsReporter
- type OTLPReporter
- func (r *OTLPReporter) ExecutableMetadata(_ context.Context, fileID libpf.FileID, fileName, buildID string)
- func (r *OTLPReporter) FrameMetadata(fileID libpf.FileID, addressOrLine libpf.AddressOrLineno, ...)
- func (r *OTLPReporter) GetMetrics() Metrics
- func (r *OTLPReporter) ReportCountForTrace(traceHash libpf.TraceHash, timestamp libpf.UnixTime32, count uint16, ...)
- func (r *OTLPReporter) ReportFallbackSymbol(frameID libpf.FrameID, symbol string)
- func (r *OTLPReporter) ReportFramesForTrace(trace *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) Stop()
- type Reporter
- type SymbolReporter
- type Times
- type TraceReporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // CollAgentAddr defines the destination of the backend connection CollAgentAddr string // MaxRPCMsgSize defines the maximum size of a gRPC message. MaxRPCMsgSize int // ExecMetadataMaxQueue defines the maximum size for the queue which holds // data of type collectionagent.ExecutableMetadata. ExecMetadataMaxQueue uint32 // CountsForTracesMaxQueue defines the maximum size for the queue which holds // data of type libpf.TraceAndCounts. CountsForTracesMaxQueue uint32 // MetricsMaxQueue defines the maximum size for the queue which holds // data of type collectionagent.Metric. MetricsMaxQueue uint32 // FramesForTracesMaxQueue defines the maximum size for the queue which holds // data of type libpf.Trace. FramesForTracesMaxQueue uint32 // FrameMetadataMaxQueue defines the maximum size for the queue which holds // data of type collectionagent.FrameMetadata. FrameMetadataMaxQueue uint32 // HostMetadataMaxQueue defines the maximum size for the queue which holds // data of type collectionagent.HostMetadata. HostMetadataMaxQueue uint32 // FallbackSymbolsMaxQueue defines the maximum size for the queue which holds // data of type collectionagent.FallbackSymbol. FallbackSymbolsMaxQueue uint32 // Disable secure communication with Collection Agent DisableTLS bool // Number of connection attempts to the collector after which we give up retrying MaxGRPCRetries uint32 Times Times }
type GRPCReporter ¶
type GRPCReporter struct {
// contains filtered or unexported fields
}
GRPCReporter will be the reporter state and implements various reporting interfaces
func Start ¶
func Start(_ context.Context, c *Config) (*GRPCReporter, error)
Start sets up and manages the reporting connection to our backend as well as a per data type caching mechanism to send the provided information in bulks to the backend. Callers of Start should be calling the corresponding Stop() API to conclude gracefully the operations managed here.
func (*GRPCReporter) ExecutableMetadata ¶
func (r *GRPCReporter) ExecutableMetadata(ctx context.Context, fileID libpf.FileID, fileName, buildID string)
ExecutableMetadata implements the SymbolReporter interface.
func (*GRPCReporter) FrameMetadata ¶
func (r *GRPCReporter) FrameMetadata(fileID libpf.FileID, addressOrLine libpf.AddressOrLineno, lineNumber libpf.SourceLineno, functionOffset uint32, functionName, filePath string)
FrameMetadata implements the SymbolReporter interface.
func (*GRPCReporter) GetMetrics ¶
func (r *GRPCReporter) GetMetrics() Metrics
func (*GRPCReporter) ReportCountForTrace ¶
func (r *GRPCReporter) ReportCountForTrace(traceHash libpf.TraceHash, timestamp libpf.UnixTime32, count uint16, comm, podName, containerName string)
ReportCountForTrace implements the TraceReporter interface.
func (*GRPCReporter) ReportFallbackSymbol ¶
func (r *GRPCReporter) ReportFallbackSymbol(frameID libpf.FrameID, symbol string)
ReportFallbackSymbol implements the SymbolReporter interface.
func (*GRPCReporter) ReportFramesForTrace ¶
func (r *GRPCReporter) ReportFramesForTrace(trace *libpf.Trace)
ReportFramesForTrace implements the TraceReporter interface.
func (*GRPCReporter) ReportHostMetadata ¶
func (r *GRPCReporter) ReportHostMetadata(_ map[string]string)
ReportHostMetadata implements the HostMetadataReporter interface.
func (*GRPCReporter) ReportHostMetadataBlocking ¶
func (r *GRPCReporter) ReportHostMetadataBlocking(_ context.Context, _ map[string]string, _ int, _ time.Duration) error
ReportHostMetadataBlocking implements the HostMetadataReporter interface.
func (*GRPCReporter) ReportMetrics ¶
func (r *GRPCReporter) ReportMetrics(timestamp uint32, ids []uint32, values []int64)
ReportMetrics implements the MetricsReporter interface.
type HostMetadata ¶
HostMetadata holds metadata about the host.
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 { CountsForTracesOverwriteCount uint32 ExeMetadataOverwriteCount uint32 FrameMetadataOverwriteCount uint32 FramesForTracesOverwriteCount uint32 HostMetadataOverwriteCount uint32 MetricsOverwriteCount uint32 FallbackSymbolsOverwriteCount uint32 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 (*OTLPReporter) ExecutableMetadata ¶
func (r *OTLPReporter) ExecutableMetadata(_ context.Context, fileID libpf.FileID, fileName, buildID string)
ExecutableMetadata accepts a fileID with the corresponding filename and caches this information.
func (*OTLPReporter) FrameMetadata ¶
func (r *OTLPReporter) FrameMetadata(fileID libpf.FileID, addressOrLine libpf.AddressOrLineno, lineNumber libpf.SourceLineno, functionOffset uint32, functionName, filePath string)
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(traceHash libpf.TraceHash, timestamp libpf.UnixTime32, count uint16, comm, podName, containerName string)
ReportCountForTrace accepts a hash of a trace with a corresponding count and caches this information.
func (*OTLPReporter) ReportFallbackSymbol ¶
func (r *OTLPReporter) ReportFallbackSymbol(frameID libpf.FrameID, symbol string)
ReportFallbackSymbol enqueues a fallback symbol for reporting, for a given frame.
func (*OTLPReporter) ReportFramesForTrace ¶
func (r *OTLPReporter) ReportFramesForTrace(trace *libpf.Trace)
ReportFramesForTrace accepts a trace with the corresponding frames and caches this information.
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) Stop ¶
func (r *OTLPReporter) Stop()
Stop triggers a graceful shutdown of OTLPReporter.
type Reporter ¶
type Reporter interface { TraceReporter SymbolReporter HostMetadataReporter MetricsReporter // 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 SymbolReporter ¶
type SymbolReporter interface { // ReportFallbackSymbol enqueues a fallback symbol for reporting, for a given frame. ReportFallbackSymbol(frameID libpf.FrameID, symbol string) // ExecutableMetadata accepts a fileID with the corresponding filename // and caches this information before a periodic reporting to the backend. ExecutableMetadata(ctx context.Context, fileID libpf.FileID, fileName, buildID string) // FrameMetadata accepts metadata associated with a frame and caches this information before // a periodic reporting to the backend. FrameMetadata(fileID libpf.FileID, addressOrLine libpf.AddressOrLineno, lineNumber libpf.SourceLineno, functionOffset uint32, functionName, filePath string) }
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 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, timestamp libpf.UnixTime32, count uint16, comm, podName, containerName string) }