feat(micrometer): observe transactions as storm.transaction Observations#236
Merged
Conversation
Queries are observed since the Micrometer binding landed, but the transaction boundaries around them were not: long-running transactions, rollback rates, and per-domain transaction behavior were invisible. - The QueryObserver SPI gains a default no-op onTransaction hook, invoked when the pending transaction scope materializes a physical transaction (an outermost block or REQUIRES_NEW; joined blocks and savepoint scopes run inside an existing transaction and are not double-counted) and completed with the outcome. The hook sits in the shared scope engine, so blocking, suspend, and Spring-bridged transactions are covered identically. Observer failures are contained and never affect the transaction. - MicrometerQueryObserver reports storm.transaction observations with storm.tx.outcome (committed/rolled_back), storm.tx.propagation, storm.tx.read_only, and the observer's extra key values (storm.database in multi-database setups). - No new wiring: the starters, the Ktor plugin, and builder-composed templates pick the signal up through their existing query observer. Fixes #235
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.
Queries are observed since the Micrometer binding landed (#203/#231), but the transaction boundaries around them were not: long-running transactions, rollback rates, and per-domain transaction behavior were invisible. This completes the observability story — spans for queries, spans for transactions, trace-context comments for the database's own logs.
Fixes #235
What's included
QueryObserver.onTransaction— a default no-op hook on the existing SPI, invoked when the pending transaction scope materializes a physical transaction (an outermost block orREQUIRES_NEW) and completed with the outcome. Joined blocks and savepoint scopes run inside an existing transaction and are deliberately not double-counted. The hook sits in the shared scope engine, so blocking, suspend, and Spring-bridged transactions are covered by one code path; observer failures are contained and never affect the transaction.storm.transactionobservations inMicrometerQueryObserver: duration,storm.tx.outcome(committed/rolled_back, with completion failures recorded as errors),storm.tx.propagation,storm.tx.read_only, plus the observer's extra key values (storm.databasein multi-database setups).Verification
REQUIRES_NEWeach observed, joinedREQUIREDblock skipped.Docs: observability sections of spring-integration.md and ktor-integration.md gain the transaction signal; CHANGELOG entry.