Class FcCombineMetrics
java.lang.Object
org.frontcache.include.combine.FcCombineMetrics
Combine-and-reduce outcomes, counted per batch and per member.
See docs/archive/combine-reduce-proposal.md section 12.
What these are for
The feature's whole claim is "N fragments, one origin request", and nothing else in the process can tell you whether that is actually happening. The command metrics count origin calls but cannot say how many fragments each one carried; the cache metrics count hits but a combined batch IS the miss path. So the ratio that matters -
rate(frontcache_include_combine_members_total{result="combined"}[5m])
/ rate(frontcache_include_combine_batches_total{result="ok"}[5m])
average members per batch - is computed from two counters taken here.
Counters, not a distribution summary
Batch size is the obvious candidate for aDistributionSummary, and it is deliberately not
one. A summary has to be recorded into a Micrometer meter at event time, which would put a hard
dependency on the (optional, off-by-default) metrics registry on the include path. Two monotonic
counters give the mean, are free when export is off, and follow FcCacheMetrics: count where the answer is known, let Prometheus compute the
windows.
The accounting is exhaustive
Every include that reachesisCombinable as a candidate - it carries combine="..."
and combining is enabled - lands in exactly one FcCombineMetrics.Member bucket, so
cached + combined + individual + fallback is the number of combine candidates seen. That is
an invariant, and CombineMetricsTest holds it: a member silently accounted twice, or not at
all, would make the members-per-batch ratio quietly wrong in a way no single counter reveals.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow a combined origin call ended.static enumWhy an envelope was rejected.static enumHow one combine candidate was ultimately resolved. -
Method Summary
Modifier and TypeMethodDescriptionstatic longcount(FcCombineMetrics.Batch outcome) static longcount(FcCombineMetrics.Error kind) static longcount(FcCombineMetrics.Member outcome) static voidrecord(FcCombineMetrics.Batch outcome) Records one combined origin call.static voidrecord(FcCombineMetrics.Error kind) Records one rejected envelope.static voidrecord(FcCombineMetrics.Member outcome) Records one combine candidate's resolution.static voidrecord(FcCombineMetrics.Member outcome, int count) Recordscountcandidates resolved the same way - the batch paths resolve in bulk.static voidreset()Test seam - back to zero.
-
Method Details
-
record
Records one combined origin call. LikeFcCacheMetrics.record, this runs on the request path and is aLongAdderincrement and nothing else - no allocation, no lock, and no check for whether export is even enabled. Counting unconditionally keeps the numbers right for a node that has export switched on later, and costs less than the check would. -
record
Records one combine candidate's resolution. -
record
Recordscountcandidates resolved the same way - the batch paths resolve in bulk. -
record
Records one rejected envelope. Always paired with aFcCombineMetrics.Batch.ERROR. -
count
-
count
-
count
-
reset
public static void reset()Test seam - back to zero.
-