-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing trigger slog events #10357
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
92f8dfd
feat(cosmic-swingset): add missing trigger events
mhofman 0ffdf00
fix(telemetry): otel correctly pop upgrade span
mhofman d32cb7e
fix(telemetry): handle new trigger slog events
mhofman 03965d9
feat(telemetry): context aware slog support new triggers
mhofman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
* 'run.trigger.msgIdx': number; | ||
* 'run.trigger.sender': Slog['sender']; | ||
* 'run.trigger.source': Slog['source']; | ||
* 'run.trigger.bundleHash': Slog['endoZipBase64Sha512']; | ||
* 'run.trigger.time': Slog['blockTime']; | ||
* 'run.trigger.txHash': string; | ||
* 'run.trigger.type': string; | ||
|
@@ -40,6 +41,7 @@ | |
* runNum?: number; | ||
* sender?: string; | ||
* source?: string; | ||
* endoZipBase64Sha512?: string; | ||
* syscallNum?: number; | ||
* time: number; | ||
* type: string; | ||
|
@@ -57,12 +59,10 @@ const SLOG_TYPES = { | |
FINISH: 'cosmic-swingset-bootstrap-block-finish', | ||
START: 'cosmic-swingset-bootstrap-block-start', | ||
}, | ||
BRIDGE_INBOUND: 'cosmic-swingset-bridge-inbound', | ||
COMMIT: { | ||
FINISH: 'cosmic-swingset-commit-finish', | ||
START: 'cosmic-swingset-commit-start', | ||
}, | ||
DELIVER_INBOUND: 'cosmic-swingset-deliver-inbound', | ||
END_BLOCK: { | ||
FINISH: 'cosmic-swingset-end-block-finish', | ||
START: 'cosmic-swingset-end-block-start', | ||
|
@@ -73,6 +73,12 @@ const SLOG_TYPES = { | |
START: 'cosmic-swingset-run-start', | ||
}, | ||
}, | ||
COSMIC_SWINGSET_TRIGGERS: { | ||
BRIDGE_INBOUND: 'cosmic-swingset-bridge-inbound', | ||
DELIVER_INBOUND: 'cosmic-swingset-deliver-inbound', | ||
TIMER_POLL: 'cosmic-swingset-timer-poll', | ||
INSTALL_BUNDLE: 'cosmic-swingset-install-bundle', | ||
}, | ||
CRANK: { | ||
FINISH: 'crank-finish', | ||
START: 'crank-start', | ||
|
@@ -169,8 +175,8 @@ export const makeContextualSlogProcessor = ( | |
assert(!!blockContext && !triggerContext); | ||
break; | ||
} | ||
case SLOG_TYPES.COSMIC_SWINGSET.BRIDGE_INBOUND: | ||
case SLOG_TYPES.COSMIC_SWINGSET.DELIVER_INBOUND: { | ||
case SLOG_TYPES.COSMIC_SWINGSET_TRIGGERS.BRIDGE_INBOUND: | ||
case SLOG_TYPES.COSMIC_SWINGSET_TRIGGERS.DELIVER_INBOUND: { | ||
const [blockHeight, txHash, msgIdx] = ( | ||
finalBody.inboundNum || '' | ||
).split('-'); | ||
|
@@ -189,6 +195,38 @@ export const makeContextualSlogProcessor = ( | |
}; | ||
break; | ||
} | ||
case SLOG_TYPES.COSMIC_SWINGSET_TRIGGERS.INSTALL_BUNDLE: { | ||
const [blockHeight, txHash, msgIdx] = ( | ||
finalBody.inboundNum || '' | ||
).split('-'); | ||
|
||
const triggerType = 'install-bundle'; | ||
|
||
triggerContext = { | ||
'run.num': undefined, | ||
'run.id': `${triggerType}-${finalBody.inboundNum}`, | ||
'run.trigger.type': triggerType, | ||
'run.trigger.bundleHash': finalBody.endoZipBase64Sha512, | ||
'run.trigger.blockHeight': Number(blockHeight), | ||
'run.trigger.txHash': txHash, | ||
'run.trigger.msgIdx': Number(msgIdx), | ||
}; | ||
|
||
break; | ||
} | ||
case SLOG_TYPES.COSMIC_SWINGSET_TRIGGERS.TIMER_POLL: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
const triggerType = 'timer-poll'; | ||
|
||
triggerContext = { | ||
'run.num': undefined, | ||
'run.id': `${triggerType}-${finalBody.inboundNum}`, | ||
'run.trigger.type': triggerType, | ||
'run.trigger.time': finalBody.blockTime, | ||
'run.trigger.blockHeight': finalBody.blockHeight, | ||
}; | ||
|
||
break; | ||
} | ||
// eslint-disable-next-line no-restricted-syntax | ||
case SLOG_TYPES.COSMIC_SWINGSET.RUN.START: { | ||
if (!finalBody.runNum) { | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -915,7 +915,7 @@ export const makeSlogToOtelKit = (tracer, overrideAttrs = {}) => { | |
break; | ||
} | ||
case 'cosmic-swingset-upgrade-finish': { | ||
spans.pop(['slogAttrs.blockHeight', slogAttrs.blockHeight]); | ||
spans.pop(['upgrade', slogAttrs.blockHeight]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💯 |
||
dbTransactionManager.end(); | ||
break; | ||
} | ||
|
@@ -971,6 +971,16 @@ export const makeSlogToOtelKit = (tracer, overrideAttrs = {}) => { | |
spans.pop('bridge-inbound'); | ||
break; | ||
} | ||
case 'cosmic-swingset-timer-poll': { | ||
spans.push(['timer-poll', slogAttrs.blockTime]); | ||
spans.pop('timer-poll'); | ||
break; | ||
} | ||
case 'cosmic-swingset-install-bundle': { | ||
spans.push(['install-bundle', slogAttrs.endoZipBase64Sha512]); | ||
spans.pop('install-bundle'); | ||
break; | ||
} | ||
case 'cosmic-swingset-end-block-start': { | ||
// Add `end-block` as an event onto the encompassing `block` span | ||
spans.top()?.addEvent('end-block-action', cleanAttrs(slogAttrs), now); | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍