\Drupal\strata\Metrics SeriesBuilder

Derives every graphed line from one pass over the timeline's buckets.

The buckets are queried once and every series is computed from them, so the six charts on a page cost one query rather than six, and no two of them can disagree about what happened in a bucket.

Stored size is cumulative and everything else is per-bucket. Stored bytes only ever accumulate until a prune runs, so drawing it per bucket would show a site's storage as a series of small spikes rather than as the line that crosses a budget ceiling. Operation rate, ratios and cost are rates and are drawn as such.

The cumulative line starts from what the store holds NOW and is walked backwards, because the frame index knows the current total exactly and the history of commits only knows what each one added. A line built forwards from zero would be correct in shape and wrong at every point on any site whose history has ever been pruned or that installed the module after it had content.

Two of the six lines are store-wide values drawn flat, and are labelled as such. Deduplication ratio and delta-chain depth are properties of the whole frame index, which records one number and not a history of it: a frame written today may be referenced by a commit from last year, so there is no bucket it belongs to. They are drawn at their real current value across the window rather than apportioned per bucket, because an apportioned figure would be a plausible-looking number with nothing behind it.

Summary

Methods
Properties
Constants
__construct
build
fromBuckets
one
No public properties found
SERIES
No protected methods found
No protected properties found
No protected constants found
cumulativeStored
dedupRatio
deepestChain
timeline
frames
prices
No private constants found

Constant

SERIES

SERIES = ['stored_bytes' => ['label' => 'Stored Size', 'unit' => 'bytes', 'cumulative' => true], 'operations' => ['label' => 'Operation Rate', 'unit' => 'per second', 'cumulative' => false], 'dedup_ratio' => ['label' => 'Deduplication Ratio', 'unit' => 'x', 'cumulative' => false], 'compression_ratio' => ['label' => 'Compression Ratio', 'unit' => 'x', 'cumulative' => false], 'chain_depth' => ['label' => 'Delta Chain Depth', 'unit' => 'links', 'cumulative' => false], 'cost' => ['label' => 'Monthly Cost', 'unit' => 'dollars', 'cumulative' => true]] : array<string, array{label: string, unit: string, cumulative: bool}>

Every series this builds, keyed to its label and unit.

Properties

$timeline

$timeline : \Drupal\strata\Timeline\TimelineQuery

Type

TimelineQuery

$prices

$prices : \Drupal\strata\Estimate\PriceTable

Type

PriceTable

Methods

__construct()

__construct(\Drupal\strata\Timeline\TimelineQuery  $timeline, \Drupal\strata\Cas\FrameIndexInterface  $frames, \Drupal\strata\Estimate\PriceTable  $prices) : mixed

Constructs a builder.

Parameters

\Drupal\strata\Timeline\TimelineQuery $timeline

Supplies the buckets.

\Drupal\strata\Cas\FrameIndexInterface $frames

Supplies what the store holds now, which the cumulative lines are anchored to.

\Drupal\strata\Estimate\PriceTable $prices

Turns bytes into a monthly figure.

Returns

mixed —

build()

build(\Drupal\strata\Timeline\TimelineWindow  $window) : array<string,\Drupal\strata\Metrics\MetricSeries>

Every series over a window.

Parameters

\Drupal\strata\Timeline\TimelineWindow $window

The window.

Returns

array

Series key to series.

fromBuckets()

fromBuckets(list<\Drupal\strata\Timeline\TimelineBucket>  $buckets) : array<string,\Drupal\strata\Metrics\MetricSeries>

Every series from a set of buckets already queried.

Parameters

list<\Drupal\strata\Timeline\TimelineBucket> $buckets

The buckets, oldest first.

Returns

array

Series key to series.

one()

one(string  $key, \Drupal\strata\Timeline\TimelineWindow  $window) : \Drupal\strata\Metrics\MetricSeries|null

One named series over a window.

Parameters

string $key

A key of SERIES.

\Drupal\strata\Timeline\TimelineWindow $window

The window.

Returns

\Drupal\strata\Metrics\MetricSeries|null —

The series, or NULL when the key is not one this builds.

cumulativeStored()

cumulativeStored(list<\Drupal\strata\Timeline\TimelineBucket>  $buckets) : list<float>

Stored bytes at the end of each bucket, anchored to what the store holds now.

Parameters

list<\Drupal\strata\Timeline\TimelineBucket> $buckets

The buckets, oldest first.

Returns

list

One total per bucket.

dedupRatio()

dedupRatio() : float

How much repetition the content addressing removed, across the whole store.

Bytes the commits say were captured, over the distinct decoded bytes the frame index holds. A value written ten times is captured ten times and framed once, so that is a ratio of ten.

Returns

float —

The ratio, or 1.0 when nothing has been stored.

deepestChain()

deepestChain() : int

The deepest delta chain the store holds.

Returns

int —

Links, or 0 when nothing is delta coded.