normalizer

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnsymolizableLocationAddress = 0x0
)

Variables

View Source
var ErrMissingNameLabel = errors.New("missing __name__ label")

Functions

func CalculateBase

func CalculateBase(ei *profilestorepb.ExecutableInfo, start, limit, offset uint64) (uint64, error)

Base determines the base address to subtract from virtual address to get symbol table address. For an executable, the base is 0. Otherwise, it's a shared library, and the base is the address where the mapping starts. The kernel needs special handling.

func LabelNamesFromSamples

func LabelNamesFromSamples(
	takenLabels map[string]string,
	stringTable []string,
	samples []*pprofpb.Sample,
	allLabels map[string]struct{},
	allNumLabels map[string]struct{},
)

func LabelsFromSample

func LabelsFromSample(takenLabels map[string]string, stringTable []string, plabels []*pprofpb.Label) (map[string]string, map[string]int64)

TODO: support num label units.

func NormalizeAddress

func NormalizeAddress(addr uint64, ei *profilestorepb.ExecutableInfo, start, limit, offset uint64) (uint64, error)

func ValidatePprofProfile

func ValidatePprofProfile(p *pprofpb.Profile, ei []*profilestorepb.ExecutableInfo) error

Types

type MetastoreNormalizer

type MetastoreNormalizer struct {
	// contains filtered or unexported fields
}

func NewNormalizer

func NewNormalizer(
	metastore pb.MetastoreServiceClient,
	enableAddressNormalization bool,
	addressNormalizationFailed prometheus.Counter,
) *MetastoreNormalizer

func (*MetastoreNormalizer) NormalizeFunctions

func (n *MetastoreNormalizer) NormalizeFunctions(ctx context.Context, functions []*pprofpb.Function, stringTable []string) ([]*pb.Function, error)

func (*MetastoreNormalizer) NormalizeLocations

func (n *MetastoreNormalizer) NormalizeLocations(
	ctx context.Context,
	locations []*pprofpb.Location,
	mappingsInfo []mappingNormalizationInfo,
	mappings []*pprofpb.Mapping,
	functions []*pb.Function,
	normalizedAddress bool,
	stringTable []string,
	executableInfo []*profilestorepb.ExecutableInfo,
) ([]*pb.Location, error)

func (*MetastoreNormalizer) NormalizeMappings

func (n *MetastoreNormalizer) NormalizeMappings(ctx context.Context, mappings []*pprofpb.Mapping, stringTable []string) ([]mappingNormalizationInfo, error)

func (*MetastoreNormalizer) NormalizePprof

func (n *MetastoreNormalizer) NormalizePprof(
	ctx context.Context,
	name string,
	takenLabelNames map[string]string,
	p *pprofpb.Profile,
	normalizedAddress bool,
	executableInfo []*profilestorepb.ExecutableInfo,
) ([]*profile.NormalizedProfile, error)

func (*MetastoreNormalizer) NormalizeStacktraces

func (n *MetastoreNormalizer) NormalizeStacktraces(ctx context.Context, samples []*pprofpb.Sample, locations []*pb.Location) ([]*pb.Stacktrace, error)

func (*MetastoreNormalizer) NormalizeWriteRawRequest

NormalizeWriteRawRequest normalizes the profiles (mappings, functions, locations, stack traces) to prepare for ingestion. It also validates label names of profiles' series, decompresses the samples, unmarshals and validates them.

type NormalizedWriteRawRequest

type NormalizedWriteRawRequest struct {
	Series                []Series
	AllLabelNames         []string
	AllPprofLabelNames    []string
	AllPprofNumLabelNames []string
}

type Normalizer

type Normalizer interface {
	NormalizePprof(
		ctx context.Context,
		name string,
		takenLabelNames map[string]string,
		p *pprofpb.Profile,
		normalizedAddress bool,
		executableInfo []*profilestorepb.ExecutableInfo,
	) ([]*profile.NormalizedProfile, error)
	NormalizeWriteRawRequest(
		ctx context.Context,
		req *profilestorepb.WriteRawRequest,
	) (NormalizedWriteRawRequest, error)
}

type Series

type Series struct {
	Labels  map[string]string
	Samples [][]*profile.NormalizedProfile
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL