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(core): Finish spans when CLI commands fail #136

Merged
merged 1 commit into from
Nov 25, 2022
Merged

Conversation

lforst
Copy link
Member

@lforst lforst commented Nov 25, 2022

This PR fixes telemetry by finishing spans after CLI commands fail.

@lforst lforst self-assigned this Nov 25, 2022
try {
await ctx.cli.releases.new(releaseName);
} finally {
span?.finish();
Copy link
Member

Choose a reason for hiding this comment

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

we really need a top level span method...

Comment on lines 40 to +46
const span = addSpanToTransaction(ctx, "function.plugin.clean_artifacts");

await ctx.cli.releases.execute(["releases", "files", releaseName, "delete", "--all"], true);
try {
await ctx.cli.releases.execute(["releases", "files", releaseName, "delete", "--all"], true);
} finally {
span?.finish();
}
Copy link
Member

Choose a reason for hiding this comment

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

Don't we put span onto the scope in addSpanToTransaction? In case we do, can we finish the span in the try/catch/finally that wraps the entire release creation pipeline?

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 had that before but it felt very blanket-approachy. I like this more because it is more explicit (though admittedly repetitive).

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough, was just a thought 😅

@lforst lforst merged commit 02ad34e into main Nov 25, 2022
@lforst lforst deleted the lforst-finish-spans branch November 25, 2022 14:09
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.

3 participants