Skip to content

Improve health check by returning errors properly #327

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

Merged
merged 3 commits into from
Mar 20, 2025
Merged

Conversation

zoltanbedi
Copy link
Member

No description provided.

@zoltanbedi zoltanbedi requested a review from a team as a code owner March 20, 2025 12:02
@zoltanbedi zoltanbedi self-assigned this Mar 20, 2025
Copy link

@ivanahuckova ivanahuckova left a comment

Choose a reason for hiding this comment

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

Left a comment bellow.

@@ -81,23 +81,19 @@ export class BigQueryDatasource extends DataSourceWithBackend<BigQueryQueryNG, B
async testDatasource() {
const health = await this.callHealthCheck();
if (health.status?.toLowerCase() === 'error') {
return { status: 'error', message: health.message, details: health.details };

Choose a reason for hiding this comment

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

Aren't we loosing details: health.details here? Can't we do

Promise.reject({
        status: 'error',
        message: health.message,
        details: health.details,
        err: new Error(health.message)
})

}

const client = await getApiClient(this.id);
try {
await client.getProjects();
} catch (err: any) {
return {

Choose a reason for hiding this comment

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

Same as above

@zoltanbedi
Copy link
Member Author

zoltanbedi commented Mar 20, 2025

Thanks @ivanahuckova, I changed the code so now the details are provided as well.

This is the way how we do in grafana/grafana https://github.com/grafana/grafana/blob/main/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts#L385

@zoltanbedi zoltanbedi merged commit 19debfa into main Mar 20, 2025
11 checks passed
@zoltanbedi zoltanbedi deleted the zoltan/testds branch March 20, 2025 14:46
@github-project-automation github-project-automation bot moved this to Complete in OSS Big Tent Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

2 participants