refactor: enhance logging and code formatting in SharedJobsService#1487
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the SharedJobsService and AmazonBedrockAiProvider by standardizing code formatting from spaces to tabs and adding logging statements to improve observability during AI-powered database scanning operations.
Key changes:
- Converted indentation from spaces to tabs throughout both files for consistency
- Added informational and error logging to track AI scan progress and failures
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| backend/src/entities/shared-jobs/shared-jobs.service.ts | Reformatted indentation to tabs; added console.info log at scan start and console.error log for error handling to improve debugging visibility |
| backend/src/entities/ai/amazon-bedrock/amazon-bedrock.ai.provider.ts | Reformatted indentation to tabs; added console.info logs to track AI response receipt and log response content for debugging |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const response = await this.bedrockRuntimeClient.send(command); | ||
| console.info('AI response received from Amazon Bedrock.'); | ||
| const responseText = response.output.message?.content[0].text; | ||
| console.info('AI response text. ', responseText); |
There was a problem hiding this comment.
Logging the full AI response text may expose sensitive information. The response could contain user data, internal database structure details, or other confidential information that shouldn't be logged in production environments. Consider removing this log statement or wrapping it in a development-only check, or at minimum redact/truncate sensitive portions of the response.
| console.info('AI response text. ', responseText); |
| if (!connection || isTest()) { | ||
| return; | ||
| } | ||
| console.info(`Starting AI scan for connection with id "${connection.id}"`); |
There was a problem hiding this comment.
The codebase has a structured logging system using WinstonLogger (see backend/src/entities/logging/winston-logger.ts). While console.info/console.error are used in some places in the codebase, for consistency and better log management (centralized configuration, log levels, transports), consider injecting and using WinstonLogger instead of console.info for this logging statement.
| } | ||
| } | ||
| } catch (error) { | ||
| console.error('Error during AI scan and creation of settings/widgets: ', error); |
There was a problem hiding this comment.
The codebase has a structured logging system using WinstonLogger (see backend/src/entities/logging/winston-logger.ts). While console.info/console.error are used in some places in the codebase, for consistency and better log management (centralized configuration, log levels, transports), consider injecting and using WinstonLogger instead of console.error for this logging statement.
| }); | ||
| try { | ||
| const response = await this.bedrockRuntimeClient.send(command); | ||
| console.info('AI response received from Amazon Bedrock.'); |
There was a problem hiding this comment.
The codebase has a structured logging system using WinstonLogger (see backend/src/entities/logging/winston-logger.ts). While console.info/console.error are used in some places in the codebase, for consistency and better log management (centralized configuration, log levels, transports), consider injecting and using WinstonLogger instead of console.info for this logging statement.
No description provided.