Skip to content
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

fix(telemetry): Empty context persisted when remaining beans are negative after run finish #10635

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

usmanmani1122
Copy link
Contributor

refs: #10300

Description

Due to a faulty condition, empty context was persisted in case remaining beans were negative after a run finish
This PR also renames timestamp to time in the context-aware-slog-file.js slogger so that the timestamp is automatically picked up by GCP Stack driver as the time of the log

Security Considerations

None

Scaling Considerations

None

Documentation Considerations

None

Testing Considerations

None

Upgrade Considerations

None

@usmanmani1122 usmanmani1122 requested a review from mhofman December 6, 2024 05:34
@usmanmani1122 usmanmani1122 self-assigned this Dec 6, 2024
@usmanmani1122 usmanmani1122 requested a review from a team as a code owner December 6, 2024 05:34
Copy link
Member

@mhofman mhofman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditionally approved given we reorder fields for easier human consumption.

@@ -356,7 +356,11 @@ export const makeContextualSlogProcessor = (
// eslint-disable-next-line no-restricted-syntax
case SLOG_TYPES.COSMIC_SWINGSET.RUN.FINISH: {
assert(!!triggerContext);
persistContext(finalBody.remainingBeans ? {} : triggerContext);
persistContext(
finalBody.remainingBeans && finalBody.remainingBeans > 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sometimes dislike what types force us to do. The finalBody.remainingBeans && part is totally unnecessary at runtime.


// eslint-disable-next-line prefer-template
stream.write(serializeSlogObj(contextualizedSlog) + '\n').catch(() => {});
stream.write(serializeSlogObj({ time, ...rest }) + '\n').catch(() => {});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would to keep the order or these fields sane when a human (me) is reading the file in a terminal or editor with no line wrap.

Suggested change
stream.write(serializeSlogObj({ time, ...rest }) + '\n').catch(() => {});
stream.write(serializeSlogObj({ ...rest, time }) + '\n').catch(() => {});

I kinda wish the process.uptime moved to the end of the attributes too.

Similarly let's move the body before attributes in the processor. Btw why not rename the time field there instead of here? We already have to extract and process it in the otel sender, so there's no extra work there, and we'd avoid extra work here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved process.uptime to the end, but GCP still order the keys
Same with attributes and body

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup but at least the file output is maintaining the order.

Copy link

cloudflare-workers-and-pages bot commented Dec 6, 2024

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5eff6ba
Status: ✅  Deploy successful!
Preview URL: https://5f867ff6.agoric-sdk.pages.dev
Branch Preview URL: https://usman-misc-slogger-fixes.agoric-sdk.pages.dev

View logs

@usmanmani1122 usmanmani1122 added the automerge:squash Automatically squash merge label Dec 6, 2024
@usmanmani1122 usmanmani1122 merged commit ad4e83e into master Dec 6, 2024
88 of 90 checks passed
@usmanmani1122 usmanmani1122 deleted the usman/misc-slogger-fixes branch December 6, 2024 13:20
Copy link
Contributor

mergify bot commented Dec 6, 2024

This pull request has been removed from the queue for the following reason: pull request dequeued.

Pull request #10635 has been dequeued. The pull request has been merged manually. The pull request has been merged manually at ad4e83e.

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.

If you want to requeue this pull request, you need to post a comment with the text: @mergifyio requeue

mujahidkay pushed a commit that referenced this pull request Dec 9, 2024
mujahidkay added a commit that referenced this pull request Dec 9, 2024
### Description

Cherry-picks the following commits from master:
- #10551
(9e19321)
- #10635
(ad4e83e)
- #10615
(e596a01 )
- #10634
(a1856f3)

Since we plan to verify this rc on devnet rather than emerynet, there is
no apparent need for a new upgrade name. Not aware of any deployments on
devnet before so can reuse the previous upgrade name. However, skipping
emerynet is dependent on comms with the validators so I have added a new
upgrade name `agoric-ugprade-18-emerynet-rc3` just in case. Only added
to bypass the need for a new rc if for some reason emerynet validation
is needed anyways - best case scenario is that it remains unused.

commits added using git cherry-pick
mujahidkay added a commit that referenced this pull request Dec 9, 2024
## Description

Created as per MAINTAINERS.md

## Changes

 - @agoric/cosmos@0.35.0-u18.3
 - agoric@0.22.0-u18.3
 - @agoric/benchmark@0.1.1-u18.3
 - @agoric/boot@0.2.0-u18.3
 - @agoric/builders@0.2.0-u18.3
 - @agoric/casting@0.4.3-u18.3
 - @agoric/cosmic-proto@0.5.0-u18.3
 - @agoric/cosmic-swingset@0.42.0-u18.3
 - @agoric/create-dapp@0.1.1-u18.3
 - @agoric/deploy-script-support@0.10.4-u18.3
 - fast-usdc@0.1.1-u18.3
 - @agoric/inter-protocol@0.17.0-u18.3
 - @agoric/orchestration@0.2.0-u18.3
 - @agoric/pegasus@0.8.0-u18.3
 - @agoric/smart-wallet@0.5.4-u18.3
 - @agoric/solo@0.11.0-u18.3
 - @agoric/swingset-runner@0.22.3-u18.3
 - @agoric/telemetry@0.6.3-u18.2
 - @agoric/vats@0.16.0-u18.3
 - @agoric/wallet-backend@0.15.0-u18.3
 
## Packages that have NEWS.md updates

```diff
--- a/packages/telemetry/CHANGELOG.md
+++ b/packages/telemetry/CHANGELOG.md
@@ -3,6 +3,16 @@
 All notable changes to this project will be documented in this file.
 See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
 
+### [0.6.3-u18.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/telemetry@0.6.3-u18.1...@agoric/telemetry@0.6.3-u18.2) (2024-12-09)
+
+
+### Bug Fixes
+
+* **telemetry:** Empty context persisted when remaining beans are negative after run finish ([#10635](#10635)) ([3988aa0](3988aa0))
+* **telemetry:** event name typo ([070b154](070b154))
+
+
+
 ### [0.6.3-u18.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/telemetry@0.6.3-u18.0...@agoric/telemetry@0.6.3-u18.1) (2024-11-19)
 
 
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:squash Automatically squash merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants