debuginfo

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: 32 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// ChunkSize 8MB is the size of the chunks in which debuginfo files are
	// uploaded and downloaded. AWS S3 has a minimum of 5MB for multi-part uploads
	// and a maximum of 15MB, and a default of 8MB.
	ChunkSize = 1024 * 1024 * 8
	// MaxMsgSize is the maximum message size the server can receive or send. By default, it is 64MB.
	MaxMsgSize = 1024 * 1024 * 64
)
View Source
const (
	ReasonDebuginfoInDebuginfod           = "Debuginfo exists in debuginfod, therefore no upload is necessary."
	ReasonFirstTimeSeen                   = "First time we see this Build ID, and it does not exist in debuginfod, therefore please upload!"
	ReasonUploadStale                     = "A previous upload was started but not finished and is now stale, so it can be retried."
	ReasonUploadInProgress                = "A previous upload is still in-progress and not stale yet (only stale uploads can be retried)."
	ReasonDebuginfoAlreadyExists          = "Debuginfo already exists and is not marked as invalid, therefore no new upload is needed."
	ReasonDebuginfoAlreadyExistsButForced = "" /* 155-byte string literal not displayed */
	ReasonDebuginfoInvalid                = "" /* 128-byte string literal not displayed */
	ReasonDebuginfoEqual                  = "" /* 202-byte string literal not displayed */
	ReasonDebuginfoNotEqual               = "Debuginfo already exists but is marked as invalid, therefore a new upload will be accepted."
	ReasonDebuginfodSource                = "Debuginfo is available from debuginfod already and not marked as invalid, therefore no new upload is needed."
	ReasonDebuginfodInvalid               = "Debuginfo is available from debuginfod already but is marked as invalid, therefore a new upload is needed."
)

Variables

View Source
var (
	ErrUnknownDebuginfoSource = errors.New("unknown debuginfo source")
	ErrNotUploadedYet         = errors.New("debuginfo not uploaded yet")
)
View Source
var (
	ErrMetadataShouldExist     = errors.New("debuginfo metadata should exist")
	ErrMetadataUnexpectedState = errors.New("debuginfo metadata state is unexpected")
	ErrMetadataNotFound        = errors.New("debuginfo metadata not found")
	ErrUploadMetadataNotFound  = errors.New("debuginfo upload metadata not found")
	ErrUploadIDMismatch        = errors.New("debuginfo upload id mismatch")
)
View Source
var ErrDebuginfoAlreadyExists = errors.New("debug info already exists")
View Source
var ErrDebuginfoNotFound = errors.New("debuginfo not found")

Functions

This section is empty.

Types

type CacheConfig

type CacheConfig struct {
	Type   CacheProvider `yaml:"type"`
	Config interface{}   `yaml:"config"`
}

type CacheProvider

type CacheProvider string
const (
	FILESYSTEM CacheProvider = "FILESYSTEM"
)

type Config

type Config struct {
	Bucket *client.BucketConfig `yaml:"bucket"`
	Cache  *CacheConfig         `yaml:"cache"`
}

type DebuginfodClient added in v0.15.0

type DebuginfodClient interface {
	Get(ctx context.Context, buildid string) (io.ReadCloser, error)
	Exists(ctx context.Context, buildid string) (bool, error)
}

func NewDebuginfodClientWithObjectStorageCache added in v0.15.0

func NewDebuginfodClientWithObjectStorageCache(
	logger log.Logger,
	bucket objstore.Bucket,
	client DebuginfodClient,
) DebuginfodClient

NewDebuginfodClientWithObjectStorageCache creates a new DebuginfodClient that caches the debug information in the object storage.

type DebuginfodClientConfig added in v0.19.0

type DebuginfodClientConfig struct {
	Host   string
	Client DebuginfodClient
}

type DebuginfodClientObjectStorageCache added in v0.15.0

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

func (*DebuginfodClientObjectStorageCache) Exists added in v0.15.0

Exists returns true if debuginfo for given buildid exists.

func (*DebuginfodClientObjectStorageCache) Get added in v0.15.0

Get returns debuginfo for given buildid while caching it in object storage.

type DebuginfodClients added in v0.19.0

type DebuginfodClients interface {
	Get(ctx context.Context, server, buildid string) (io.ReadCloser, error)
	Exists(ctx context.Context, buildid string) ([]string, error)
}

func NewDebuginfodClients added in v0.19.0

func NewDebuginfodClients(
	logger log.Logger,
	reg prometheus.Registerer,
	tracerProvider trace.TracerProvider,
	upstreamServerHosts []string,
	rt http.RoundTripper,
	timeout time.Duration,
	bucket objstore.Bucket,
) DebuginfodClients

type DebuginfodExistsClientCache added in v0.19.0

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

func NewDebuginfodExistsClientCache added in v0.19.0

func NewDebuginfodExistsClientCache(
	reg prometheus.Registerer,
	cacheSize int,
	client DebuginfodClient,
) *DebuginfodExistsClientCache

func (*DebuginfodExistsClientCache) Exists added in v0.19.0

func (c *DebuginfodExistsClientCache) Exists(ctx context.Context, buildID string) (bool, error)

func (*DebuginfodExistsClientCache) Get added in v0.19.0

type DebuginfodTracingClient added in v0.19.0

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

func NewDebuginfodTracingClient added in v0.19.0

func NewDebuginfodTracingClient(
	tracer trace.Tracer,
	client DebuginfodClient,
) *DebuginfodTracingClient

func (*DebuginfodTracingClient) Exists added in v0.19.0

func (c *DebuginfodTracingClient) Exists(ctx context.Context, buildID string) (bool, error)

func (*DebuginfodTracingClient) Get added in v0.19.0

type Fetcher added in v0.15.0

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

func NewFetcher added in v0.15.0

func NewFetcher(
	debuginfodClients DebuginfodClients,
	bucket objstore.Bucket,
) *Fetcher

func (*Fetcher) FetchDebuginfo added in v0.15.0

func (f *Fetcher) FetchDebuginfo(ctx context.Context, dbginfo *debuginfopb.Debuginfo) (io.ReadCloser, error)

type FilesystemCacheConfig

type FilesystemCacheConfig struct {
	Directory string `yaml:"directory"`
}

type GrpcDebuginfoUploadServiceClient added in v0.15.0

type GrpcDebuginfoUploadServiceClient interface {
	Upload(ctx context.Context, opts ...grpc.CallOption) (debuginfopb.DebuginfoService_UploadClient, error)
}

type GrpcUploadClient added in v0.15.0

type GrpcUploadClient struct {
	GrpcDebuginfoUploadServiceClient
}

func NewGrpcUploadClient added in v0.15.0

func NewGrpcUploadClient(client GrpcDebuginfoUploadServiceClient) *GrpcUploadClient

func (*GrpcUploadClient) Upload added in v0.15.0

func (c *GrpcUploadClient) Upload(ctx context.Context, uploadInstructions *debuginfopb.UploadInstructions, r io.Reader) (uint64, error)

type HTTPDebuginfodClient added in v0.15.0

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

func NewHTTPDebuginfodClient added in v0.15.0

func NewHTTPDebuginfodClient(
	tp trace.TracerProvider,
	client *http.Client,
	url url.URL,
) *HTTPDebuginfodClient

NewHTTPDebuginfodClient returns a new HTTP debug info client.

func (*HTTPDebuginfodClient) Exists added in v0.15.0

func (c *HTTPDebuginfodClient) Exists(ctx context.Context, buildID string) (bool, error)

func (*HTTPDebuginfodClient) Get added in v0.15.0

func (c *HTTPDebuginfodClient) Get(ctx context.Context, buildID string) (io.ReadCloser, error)

Get returns debug information file for given buildID by downloading it from upstream servers.

type MetadataManager added in v0.12.0

type MetadataManager interface {
	MarkAsDebuginfodSource(ctx context.Context, servers []string, buildID string, typ debuginfopb.DebuginfoType) error
	MarkAsUploading(ctx context.Context, buildID, uploadID, hash string, typ debuginfopb.DebuginfoType, startedAt *timestamppb.Timestamp) error
	MarkAsUploaded(ctx context.Context, buildID, uploadID string, typ debuginfopb.DebuginfoType, finishedAt *timestamppb.Timestamp) error
	Fetch(ctx context.Context, buildID string, typ debuginfopb.DebuginfoType) (*debuginfopb.Debuginfo, error)
}

type NopDebuginfodClient added in v0.15.0

type NopDebuginfodClient struct{}

func (NopDebuginfodClient) Exists added in v0.15.0

func (NopDebuginfodClient) Get added in v0.15.0

type NopDebuginfodClients added in v0.19.0

type NopDebuginfodClients struct{}

func (NopDebuginfodClients) Exists added in v0.19.0

func (NopDebuginfodClients) Get added in v0.19.0

type ObjectStoreMetadata added in v0.12.0

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

func NewObjectStoreMetadata added in v0.12.0

func NewObjectStoreMetadata(logger log.Logger, bucket objstore.Bucket) *ObjectStoreMetadata

func (*ObjectStoreMetadata) Fetch added in v0.12.0

func (*ObjectStoreMetadata) MarkAsDebuginfodSource added in v0.15.0

func (m *ObjectStoreMetadata) MarkAsDebuginfodSource(ctx context.Context, servers []string, buildID string, typ debuginfopb.DebuginfoType) error

func (*ObjectStoreMetadata) MarkAsUploaded added in v0.12.0

func (m *ObjectStoreMetadata) MarkAsUploaded(ctx context.Context, buildID, uploadID string, typ debuginfopb.DebuginfoType, finishedAt *timestamppb.Timestamp) error

func (*ObjectStoreMetadata) MarkAsUploading added in v0.12.0

func (m *ObjectStoreMetadata) MarkAsUploading(ctx context.Context, buildID, uploadID, hash string, typ debuginfopb.DebuginfoType, startedAt *timestamppb.Timestamp) error

func (*ObjectStoreMetadata) SetQuality added in v0.15.0

type ParallelDebuginfodClients added in v0.19.0

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

func NewParallelDebuginfodClients added in v0.19.0

func NewParallelDebuginfodClients(clients []DebuginfodClientConfig) *ParallelDebuginfodClients

func (*ParallelDebuginfodClients) Exists added in v0.19.0

func (c *ParallelDebuginfodClients) Exists(ctx context.Context, buildid string) ([]string, error)

func (*ParallelDebuginfodClients) Get added in v0.19.0

func (c *ParallelDebuginfodClients) Get(ctx context.Context, server, buildid string) (io.ReadCloser, error)

type SignedUpload added in v0.15.0

type SignedUpload struct {
	Enabled bool
	Client  SignedUploadClient
}

type SignedUploadClient added in v0.19.0

type SignedUploadClient interface {
	SignedPUT(ctx context.Context, objectKey string, size int64, expiry time.Time) (signedURL string, err error)
}

type Store

type Store struct {
	debuginfopb.UnimplementedDebuginfoServiceServer
	// contains filtered or unexported fields
}

func NewStore

func NewStore(
	tracer trace.Tracer,
	logger log.Logger,
	metadata MetadataManager,
	bucket objstore.Bucket,
	debuginfodClients DebuginfodClients,
	signedUpload SignedUpload,
	maxUploadDuration time.Duration,
	maxUploadSize int64,
) (*Store, error)

NewStore returns a new debug info store.

func (*Store) InitiateUpload added in v0.15.0

func (*Store) MarkUploadFinished added in v0.15.0

func (*Store) ShouldInitiateUpload added in v0.15.0

ShouldInitiateUpload returns whether an upload should be initiated for the given build ID. Checking if an upload should even be initiated allows the parca-agent to avoid extracting debuginfos unnecessarily from a binary.

func (*Store) Upload

type UploadReader

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

func (*UploadReader) Read

func (r *UploadReader) Read(p []byte) (int, error)

Jump to

Keyboard shortcuts

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