P0.6 — elasticsql: cap-hit funnel instrumentation#130
Merged
Conversation
…csql leg) Add the SEMANTIC cap-hit primitive to the shared TelemetryCollector and wire the maxQueryResults reject site (CoreDqlExtension). Cap-hits are the launch leading indicator (PRD section 15.1, pre-mortem Killer #2) - the only missing funnel signal class. They ride the existing InstancePing daily-ping delta. - TelemetryCollector: CapHitKind {MaterializedViews, QueryResults, Joins, Clusters} + 4 lock-free AtomicLong DELTA buckets + incrementCapHit(kind) + collectAndResetCapHits() (getAndSet, all-4-keys) + TelemetryData.capHitsByKind (collect reads, collectAndReset getAndSet) + Noop overrides. Mirrors the Story-15.3 JOIN-bucket pattern. - CoreDqlExtension: capture capHitCollector = strategy.telemetryCollector at initialize; incrementCapHit(QueryResults) on BOTH capOrReject branches - the explicit-LIMIT 402 reject AND the P0.5 no-LIMIT truncation bite (OQ-2). Suppressed JOIN legs do not count (no double-count). Reject behavior unchanged (AC8 - increment is a side-effect before the existing return). - Tests: TelemetryCollectorSpec (+10), CoreDqlExtensionSpec (+5). Cross 2.12+2.13 green incl. testkit; headerCheck clean. OQ-1 = semantic incrementCapHit per reject site (NOT 'count 402s' - joins/clusters never raise a 402). Cross-repo P0.6 epic leg 1 of 4 (Phase 0 final story). Closed Issue #129 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Story P0.6 — Pricing-funnel instrumentation (cap-hits), elasticsql leg
Closes #129. Cross-repo P0.6 epic leg 1 of 4 (elasticsql → softclient4es-extensions → softclient4es-arrow → softclient4es-license-server). Phase 0 final story.
Cap-hits (count of license quota rejections by quota type) are the launch leading indicator — PRD §15.1 / pre-mortem Killer #2 — and the only missing funnel signal class (Epic 15 already ships conversion/activation/chasm). This leg adds the SEMANTIC cap-hit primitive to the shared
TelemetryCollectorand wires themaxQueryResultsreject site.Changes
licensing/.../TelemetryCollector.scala: newCapHitKindsealed trait{MaterializedViews, QueryResults, Joins, Clusters}(each with a snake-case wirekey); four independent lock-freeAtomicLongcap-hit DELTA buckets;incrementCapHit(kind);collectAndResetCapHits()(getAndSet, always all four keys);TelemetryData.capHitsByKindpopulated incollect(read, no reset — likejoinQueryCount) andcollectAndReset(getAndSetflush);Noopoverrides. Mirrors the Story-15.3 JOIN-bucket pattern exactly.core/.../extensions/CoreDqlExtension.scala: capturecapHitCollector = licenseRefreshStrategy.telemetryCollectoratinitialize;incrementCapHit(QueryResults)on bothcapOrRejectbranches — the explicit-LIMIT402 reject AND the P0.5 no-LIMITtruncation/cappedScroll bite (OQ-2). Suppressed JOIN legs (ResultCapContext.isSuppressed) do not count → no double-count. The reject itself is unchanged (AC8: increment is a side-effect before the existing return). The closedEnforcedDqlExtensioninherits the increment via the sharedcapOrReject.TelemetryCollectorSpec(+10 cap-hit cases: per-kind isolation, all-4-keys, collect-no-reset, collectAndReset delta, concurrency, Noop no-op),CoreDqlExtensionSpec(+5: 402 branch + truncation branch increment, no-increment for within-quota/suppressed-leg/Enterprise).Design decisions
incrementCapHit(kind)at each reject site), NOT by 'HTTP status == 402' (only MV + maxQueryResults raise a 402; joins returnLeft(String), clusters aLicenseError/sys.exit).LIMITtruncation IS counted as aQueryResultscap-hit (the meter biting non-fatally).InstancePingdaily-ping delta (read viacollect, likejoinQueryCount); the license-server computes per-instance deltas from the stored previous snapshot.Build & verify
+ core/compile++ licensing/compile++ softclient4es-core-testkit/compile(cross 2.12 + 2.13) — greenlicensing/testOnly *TelemetryCollectorSpec— 24 passed;core/testOnly *CoreDqlExtensionSpec— 14 passed;headerCheck— cleansoftclient4es-core+softclient4es-licensing0.20-SNAPSHOT (2.12+2.13) — unblocks the extensions + arrow legsSibling PRs
🤖 Generated with Claude Code