Documentation
¶
Overview ¶
Package telemetry provides utilities for telemetry bottle resolution and event updating.
Index ¶
- Variables
- type Adapter
- func (a *Adapter) FindBottle(ctx context.Context, refSpec ref.Ref) ([]ref.Ref, error)
- func (a *Adapter) NewEvent(location string, rawManifest []byte, action types.EventAction) types.Event
- func (a *Adapter) NotifyTelemetry(ctx context.Context, src content.ReadOnlyGraphStorage, desc ocispec.Descriptor, ...) ([]string, error)
- func (a *Adapter) ResolveWithTelemetry(ctx context.Context, reference string, ...) (oras.ReadOnlyGraphTarget, ocispec.Descriptor, types.Event, error)
- type AdapterOption
Constants ¶
This section is empty.
Variables ¶
var ErrTelemetrySend = errors.New("telemetry reporting delegate failed")
ErrTelemetrySend indicates that a telemetry send event was not properly reported.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter is a lightweight wrapper around the telemetry client that speaks Bottles. TODO: revise name? TODO: We should consider updating the adapter to handle "batch processing" of bottles, i.e. a workflow with multiple calls to ResolveWithTelemetry finishing with a single NotifyTelemetryWithAll method which calls NotifyTelemetry for each resolved bottle. Memory store should be updated to handle this.
func NewAdapter ¶
func NewAdapter(ctx context.Context, hosts []telemv1alpha2.Location, userName string, opts ...AdapterOption) *Adapter
NewAdapter creates the MultiClient for telemetry from the global configuration.
func (*Adapter) FindBottle ¶
FindBottle takes a bottle reference (of type bottle:id) and a telemetry host and returns a list of bottle references that bottle is located at (if the telemetry host knows of said bottle).
func (*Adapter) NewEvent ¶
func (a *Adapter) NewEvent(location string, rawManifest []byte, action types.EventAction) types.Event
NewEvent creates a telemetry Event based on bottle metdata and an event action type.
func (*Adapter) NotifyTelemetry ¶
func (a *Adapter) NotifyTelemetry(ctx context.Context, src content.ReadOnlyGraphStorage, desc ocispec.Descriptor, bottleDir string, event types.Event, ) ([]string, error)
NotifyTelemetry updates a telemetry host with the provided event. It prioritizes local bottle data, and fetches missing data from the remote as necessary.
func (*Adapter) ResolveWithTelemetry ¶
func (a *Adapter) ResolveWithTelemetry(ctx context.Context, reference string, sourceTargeter reg.ReadOnlyGraphTargeter, transferOpts tbottle.TransferOptions) (oras.ReadOnlyGraphTarget, ocispec.Descriptor, types.Event, error)
ResolveWithTelemetry resolves a bottle reference to an oras.GraphTarget and an OCI descriptor. A bottle reference takes the scheme "bottle://<digest>" where the digest is an OCI config digest. Upon resolving a bottle reference, the bottle's version is validated for security purposes. It is safe to provide a regular OCI reference, although telemetry will not be used.
type AdapterOption ¶
type AdapterOption func(adapter *Adapter)
AdapterOption defines a functional option when initializing a telemetry adapter for one or more telemetry clients.
func WithCache ¶
func WithCache(storage content.Storage) AdapterOption
WithCache overrides the default memory-based storage used for caching OCI manifests and configs.
func WithCredStore ¶
func WithCredStore(credStore credentials.Store) AdapterOption
WithCredStore overrides the default memory-based credentials store for discovering authorization refresh tokens.