Skip to content

feat: Surface provisioning failures to user - #1002

Merged
morgsmccauley merged 13 commits into
mainfrom
feat/surface-provisioning-failures
Aug 9, 2024
Merged

morgsmccauley merged 13 commits into
mainfrom
feat/surface-provisioning-failures

Conversation

@morgsmccauley

Copy link
Copy Markdown
Contributor

This PR updates provisioning such that user-related errors are written to the user-owned logs table, allowing them to debug issues with their schema.

Logging to the user table is tricky, since this table is created during the provisioning step itself. Therefore, I have split provisioning in to two phases:

  1. System Resources - Setups up system related entities: database, schema, logs table/jobs etc.
  2. User Resources - Applies user schema, configures Hasura etc.

This separation allows us to isolate the tasks which are likely to fail due to user error, and therefore only surface errors which are relevant.

The creation of the logs table should always succeed, if it doesn't there is something wrong with the system, i.e. some form of bug has been introduced. Errors thrown during the System portion of provisioning will be error logged to the machine, and I will tune the existing alert so that we are notified of these errors.

Additionally, I have converted all non-critical error logs to warnings, so that we don't get alerted on non-issues.

closes: #901

@morgsmccauley
morgsmccauley requested a review from a team August 8, 2024 23:12
public readonly functionName: string,
public readonly schema: string
public readonly schema: string,
public readonly logLevel: LogLevel = LogLevel.INFO

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Needed to move this from IndexerConfig to ProvisioningConfig so that IndexerMeta could be constructed with it. We only have access to the latter in Provisioning.

logger.info('Successfully provisioned Data Layer');
})
.catch((err) => {
logger.error('Failed to provision Data Layer', err);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Now logged within Provisioner

}

async function indexerLogsQuery(indexerSchemaName: string, graphqlClient: GraphQLClient): Promise<any> {
async function indexerLogsQuery (indexerSchemaName: string, graphqlClient: GraphQLClient): Promise<any> {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@darunrs I think our editors are fighting each other 😅

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LMAO. I actually like the space after the function name for TS. I need to check my linting config.

}

async function indexerLogsQuery(indexerSchemaName: string, graphqlClient: GraphQLClient): Promise<any> {
async function indexerLogsQuery (indexerSchemaName: string, graphqlClient: GraphQLClient): Promise<any> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LMAO. I actually like the space after the function name for TS. I need to check my linting config.

@morgsmccauley
morgsmccauley merged commit 44bc2eb into main Aug 9, 2024
@morgsmccauley
morgsmccauley deleted the feat/surface-provisioning-failures branch August 9, 2024 02:12
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.

Surface provisioning failures to user

2 participants