Skip to content

fix(core): Finish spans when CLI commands fail#136

Merged
lforst merged 1 commit intomainfrom
lforst-finish-spans
Nov 25, 2022
Merged

fix(core): Finish spans when CLI commands fail#136
lforst merged 1 commit intomainfrom
lforst-finish-spans

Conversation

@lforst
Copy link

@lforst lforst commented Nov 25, 2022

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

@lforst lforst requested review from AbhiPrasad and Lms24 November 25, 2022 13:47
@lforst lforst self-assigned this Nov 25, 2022
try {
await ctx.cli.releases.new(releaseName);
} finally {
span?.finish();
Copy link
Contributor

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
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