metrics

package
v1.77.1-rc Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: AGPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Error defines the metrics chore errors class.
	Error = errs.Class("metrics")
)

Functions

This section is empty.

Types

type Chore

type Chore struct {
	Loop *sync2.Cycle

	Counter *Counter
	// contains filtered or unexported fields
}

Chore implements the metrics chore.

architecture: Chore

func NewChore

func NewChore(log *zap.Logger, config Config, loop *segmentloop.Service) *Chore

NewChore creates a new instance of the metrics chore.

func (*Chore) Close

func (chore *Chore) Close() error

Close closes metrics chore.

func (*Chore) Run

func (chore *Chore) Run(ctx context.Context) (err error)

Run starts the metrics chore.

type Config

type Config struct {
	UseRangedLoop bool `help:"whether to use ranged loop instead of segment loop" default:"false"`
}

Config contains configurable values for metrics collection.

type Counter

type Counter struct {
	// number of objects that has at least one remote segment
	RemoteObjects int64
	// number of objects that has all inline segments
	InlineObjects int64

	// encrypted size
	TotalInlineBytes int64
	// encrypted size
	TotalRemoteBytes int64

	TotalInlineSegments int64
	TotalRemoteSegments int64
	// contains filtered or unexported fields
}

Counter implements the segment loop observer interface for data science metrics collection.

architecture: Observer

func NewCounter

func NewCounter() *Counter

NewCounter instantiates a new counter to be subscribed to the metainfo loop.

func (*Counter) InlineSegment

func (counter *Counter) InlineSegment(ctx context.Context, segment *segmentloop.Segment) error

InlineSegment increments the count for inline objects.

func (*Counter) LoopStarted added in v1.27.3

func (counter *Counter) LoopStarted(context.Context, segmentloop.LoopInfo) (err error)

LoopStarted is called at each start of a loop.

func (*Counter) RemoteSegment

func (counter *Counter) RemoteSegment(ctx context.Context, segment *segmentloop.Segment) error

RemoteSegment increments the count for objects with remote segments.

type Metrics added in v1.70.1

type Metrics struct {
	// RemoteObjects is the count of objects with at least one remote segment.
	RemoteObjects int64

	// InlineObjects is the count of objects with only inline segments.
	InlineObjects int64

	// TotalInlineBytes is the amount of bytes across all inline segments.
	TotalInlineBytes int64

	// TotalRemoteBytes is the amount of bytes across all remote segments.
	TotalRemoteBytes int64

	// TotalInlineSegments is the count of inline segments across all objects.
	TotalInlineSegments int64

	// TotalRemoteSegments is the count of remote segments across all objects.
	TotalRemoteSegments int64
}

Metrics represents the metrics that are tracked by this package.

func (*Metrics) Aggregate added in v1.70.1

func (metrics *Metrics) Aggregate(partial Metrics)

Aggregate aggregates the given metrics into the receiver.

func (*Metrics) Reset added in v1.70.1

func (metrics *Metrics) Reset()

Reset resets the invidual metrics back to zero.

type Observer added in v1.70.1

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

Observer implements the ranged segment loop observer interface for data science metrics collection.

func NewObserver added in v1.70.1

func NewObserver() *Observer

NewObserver instantiates a new rangedloop observer which aggregates object statistics from observed segments.

func (*Observer) Finish added in v1.70.1

func (obs *Observer) Finish(ctx context.Context) error

Finish emits the aggregated metrics.

func (*Observer) Fork added in v1.70.1

func (obs *Observer) Fork(ctx context.Context) (rangedloop.Partial, error)

Fork implements the Observer method of the same name by returning a partial implementation that aggregates metrics about the observed segments/streams. These metrics will be aggregated into the observed totals during Join.

func (*Observer) Join added in v1.70.1

func (obs *Observer) Join(ctx context.Context, partial rangedloop.Partial) error

Join aggregates the partial metrics.

func (*Observer) Start added in v1.70.1

func (obs *Observer) Start(ctx context.Context, startTime time.Time) error

Start implements the Observer method of the same name by resetting the aggregated metrics.

func (*Observer) TestingMetrics added in v1.70.1

func (obs *Observer) TestingMetrics() Metrics

TestingMetrics returns the accumulated metrics. It is intended to be called from tests.

Jump to

Keyboard shortcuts

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