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

feat: run pushed monitors locally in dry-run mode #991

Merged
merged 8 commits into from
Jan 22, 2025

Conversation

vigneshshanmugam
Copy link
Member

@vigneshshanmugam vigneshshanmugam commented Dec 19, 2024

Screenshot 2024-12-19 at 4 17 52 PM

@vigneshshanmugam vigneshshanmugam marked this pull request as ready for review December 19, 2024 23:41
@@ -106,7 +126,6 @@ export async function push(monitors: Monitor[], options: PushOptions) {
}

if (removedIDs.size > 0) {
log(`deleting monitor ids: ${Array.from(removedIDs.keys()).join(', ')}`);
Copy link
Member Author

Choose a reason for hiding this comment

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

covered by the logGroups

@@ -148,6 +151,15 @@ export async function buildMonitorSchema(monitors: Monitor[], isV2: boolean) {
monitor.setContent(content);
Object.assign(schema, { content, filter });
}
const size = monitor.size();
Copy link
Contributor

Choose a reason for hiding this comment

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

SIZE_LIMIT_KB description specifies this is gzipped, whereas monitor.size() is not, maybe we should align the description

Copy link
Member Author

Choose a reason for hiding this comment

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

It is though, the content extracted is the gzipped size of the monitor. Can you give me hint on where we should align it?

let outer = bold(`Aborted: Bundled code ${sizeKB}kB exceeds the recommended ${SIZE_LIMIT_KB}kB limit. Please check the dependencies imported.\n`);
const inner = `* ${config.id} - ${source.file}:${source.line}:${source.column}\n`;
outer += indent(inner);
throw red(outer);
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be better DX if we iterate through all monitors and collect all errors before pushing so that we report all at once, instead of just the first, wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about it, But it might cause the errors to be not meaningful if user decides to pull in a dep like playwright-core etc which would get included across all journeys if it was in a helper library (common case in ecp). Throwing it away first avoids those issues. This is why we also kept it this way from the beginning.

src/push/run-local.ts Outdated Show resolved Hide resolved
src/push/run-local.ts Outdated Show resolved Hide resolved
src/push/run-local.ts Outdated Show resolved Hide resolved
src/push/run-local.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@emilioalvap emilioalvap left a comment

Choose a reason for hiding this comment

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

LGTM

@vigneshshanmugam vigneshshanmugam merged commit e198ddc into elastic:main Jan 22, 2025
8 checks passed
@vigneshshanmugam vigneshshanmugam deleted the preview-push branch January 22, 2025 17:37
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.

enable/document local testing using
2 participants