Skip to content

Conversation

@henrymercer
Copy link
Contributor

This PR adds a status report for uploading databases. This contains:

  • The DB language
  • The size of the zipped DB
  • Whether the DB is an overlay base database
  • How long the upload took
  • Error information, if there was an error uploading the database.

Risk assessment

For internal use only. Please select the risk level of this change:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

Which use cases does this change impact?

Workflow types:

  • Advanced setup - Impacts users who have custom CodeQL workflows.
  • Managed - Impacts users with dynamic workflows (Default Setup, CCR, ...).

Products:

  • Code Scanning - The changes impact analyses when analysis-kinds: code-scanning.

Environments:

  • Dotcom - Impacts CodeQL workflows on github.com.

How did/will you validate this change?

  • Test repository - This change will be tested on a test repository before merging.

See https://github.com/henrymercer-test-org/overlay-testing/actions/runs/20233483858/job/58082003115#step:5:5392

If something goes wrong after this change is released, what are the mitigation and rollback strategies?

  • Rollback - Change can only be disabled by rolling back the release or releasing a new version with a fix.

How will you know if something goes wrong after this change is released?

  • Telemetry - I rely on existing telemetry or have made changes to the telemetry.
    • Dashboards - I will watch relevant dashboards for issues after the release. Consider whether this requires this change to be released at a particular time rather than as part of a regular release.
    • Alerts - New or existing monitors will trip if something goes wrong with this change.

Are there any special considerations for merging or releasing this change?

  • No special considerations - This change can be merged at any time.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

Copilot AI review requested due to automatic review settings December 15, 2025 13:22
@henrymercer henrymercer requested a review from a team as a code owner December 15, 2025 13:22
@github-actions github-actions bot added the size/S Should be easy to review label Dec 15, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds telemetry reporting for database upload operations to provide better observability into the upload process. The changes introduce a structured way to track upload success, failure, and performance metrics.

Key Changes

  • Adds DatabaseUploadResult interface to capture upload metadata including language, size, timing, overlay base status, and error information
  • Changes cleanupAndUploadDatabases to return upload results instead of void
  • Integrates database upload results into the status reporting system

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
src/database-upload.ts Introduces DatabaseUploadResult interface and modifies cleanupAndUploadDatabases to collect and return upload telemetry for each language
src/analyze-action.ts Updates status report interfaces and threading to include database upload results throughout the analyze action workflow
package-lock.json Automatic npm metadata updates adding peer dependency markers
lib/analyze-action.js Generated JavaScript code corresponding to TypeScript changes (not reviewed per guidelines)

mbg
mbg previously approved these changes Dec 16, 2025
Copy link
Member

@mbg mbg left a comment

Choose a reason for hiding this comment

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

Broadly looks good, just a couple of questions I had looking over the changes and one naming suggestion.

actionsUtil.getRequiredInput("checkout_path"),
);
try {
const startTime = Date.now();
Copy link
Member

Choose a reason for hiding this comment

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

Any particular reason for using Date.now() for the measurement here rather than performance.now() that we use elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

performance.now() would be better 👍

Comment on lines 116 to 144
logger.warning(`Failed to upload database for ${language}: ${e}`);
reports.push({
language,
error: util.getErrorMessage(e),
Copy link
Member

Choose a reason for hiding this comment

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

If getErrorMessage(e) is useful here, would it also make sense in the log message above rather than just e?


const cleanupLevel =
// If config.overlayDatabaseMode is OverlayBase, then we have overlay base databases for all languages.
const isOverlayBase =
Copy link
Member

Choose a reason for hiding this comment

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

I think this name is slightly misleading, because it also depends on the FF. Perhaps uploadOverlayDb would be a better name?

mbg
mbg previously approved these changes Dec 16, 2025
Copy link
Member

@mbg mbg left a comment

Choose a reason for hiding this comment

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

Thanks for addressing all the suggestions!

@henrymercer
Copy link
Contributor Author

Fixed a merge conflict.

@henrymercer henrymercer requested a review from mbg December 16, 2025 15:53
@henrymercer henrymercer merged commit 5eb7519 into main Dec 16, 2025
244 checks passed
@henrymercer henrymercer deleted the henrymercer/database-upload-telemetry branch December 16, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Should be easy to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants