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

test(cosmic-swingset): Add test coverage for Prometheus output #10954

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

gibson042
Copy link
Member

Extends #10941
Fixes #10911

Description

Extracts a testable launchChain unit in packages/cosmic-swingset/src/chain-main.js, and uses that for an ava snapshot test of localhost:${OTEL_EXPORTER_PROMETHEUS_PORT}/metrics. Includes incidental fixes and utility additions along the way (and therefore best reviewed by commit).

Security Considerations

None known.

Scaling Considerations

n/a

Documentation Considerations

n/a

Testing Considerations

Just the usual --update-snapshots when things change.

Upgrade Considerations

n/a

@gibson042 gibson042 requested a review from mhofman February 6, 2025 03:58
@gibson042 gibson042 requested a review from a team as a code owner February 6, 2025 03:58
@gibson042 gibson042 force-pushed the gibson-10911-prometheus-snapshot branch from af8cdb2 to 799daa7 Compare February 6, 2025 04:31
Copy link

cloudflare-workers-and-pages bot commented Feb 6, 2025

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: e32baf0
Status: ✅  Deploy successful!
Preview URL: https://be62467e.agoric-sdk.pages.dev
Branch Preview URL: https://gibson-10911-prometheus-snap.agoric-sdk.pages.dev

View logs

@gibson042 gibson042 changed the base branch from master to gibson-10937-update-opentelemetry February 6, 2025 04:34
@gibson042 gibson042 force-pushed the gibson-10911-prometheus-snapshot branch from 799daa7 to 452567e Compare February 6, 2025 04:35
Base automatically changed from gibson-10937-update-opentelemetry to master February 6, 2025 16:49
Copy link

github-actions bot commented Feb 6, 2025

Base branch is changed to master. Please re-run the integration tests by adding 'force:integration' label.

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.

This looks like the beginning of some awesome test framework for cosmic-swingset. Pretty amazing!

I am however concerned the hangover / savedChainSends logic got hurt in the refactor. (it was really hard to track where things moved, I kinda wish that refactor commit could have been split in multiple commits to facilitate diffing)

Comment on lines +764 to +766
waitForIdleBridge: async () =>
stateSyncExport?.exporter?.onStarted().then(ignore, ignore),
});
Copy link
Member

Choose a reason for hiding this comment

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

Name is a bit misleading here. It's not really wait for idle bridge, but our last chance to delay swing-store commit in case the state-sync export hasn't had a chance to open a read tx on it.

If there is any "idle bridge" it's actually the finally after doBlockingSend which I am moving in my upcoming PR to be explicitly at the end of END_BLOCK.


const { blockingSend, shutdown } = s;
({ writeSlogObject, savedChainSends } = s);
Copy link
Member

Choose a reason for hiding this comment

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

I don't see how savedChainSends is initialized from the value returned by launch. Did that get dropped? The hangover logic is notoriously lacking testing and quite brittle (we have know bugs in it)

Comment on lines +134 to +136
* Generalize Node.js util.promisify to support callbacks with multiple
* post-error parameters, which fulfill the returned promise as an array rather
* than as a single value.
Copy link
Member

Choose a reason for hiding this comment

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

Post-error parameter? Maybe multiple parameters of which the last is an error?

Also what kind of node callback API does this!?

Comment on lines +163 to +166
} else if (result.length === 1) {
resolve(/** @type {any} */ (result[0]));
} else {
resolve(result);
Copy link
Member

Choose a reason for hiding this comment

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

I dislike changing the type of resolved values dynamically like that but I'll allow it here for backwards compat (and because I think the types get it).

But I can't shake the feeling this is trying to be too smart.

import '@endo/eventual-send/shim.js';

try {
lockdown({ __hardenTaming__: 'unsafe' });
Copy link
Member

Choose a reason for hiding this comment

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

Sad, we can't even test if the intrinsics are frozen with unsafe harden.

Copy link
Member

Choose a reason for hiding this comment

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

Should the file's name capture this is doing an unsafe lockdown ?

Copy link
Member

Choose a reason for hiding this comment

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

Also the original @endo/init also tames async_hooks which this doesn't do. See endojs/endo#2711

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add snapshot test of prometheus metrics
2 participants