Skip to content

Log async upload job details correlated with operation id - #1889

Merged
IvanBorislavovDimitrov merged 1 commit into
masterfrom
log-async-upload-job-for-operation-clean
Aug 11, 2026
Merged

Log async upload job details correlated with operation id#1889
IvanBorislavovDimitrov merged 1 commit into
masterfrom
log-async-upload-job-for-operation-clean

Conversation

@IvanBorislavovDimitrov

Copy link
Copy Markdown
Contributor

What

When an operation starts, log the async upload job (deploy-from-URL scenario) associated with that operation, correlated by the operation id — in a single, greppable line.

Previously there was no log line tying a deploy operation to its async upload job. The only shared key between the two is the uploaded file id (appArchiveId), and it was never logged next to the operation id, so correlating an operation with its upload required manual cross-referencing.

Changes

  • StartProcessListener — after files are stamped with the operation id, resolve the operation's file ids (appArchiveId + ext-descriptor ids) via OperationFileIdsUtil and query AsyncUploadJobService.withFileIds(...). For each associated job, log one INFO line:

    Async upload job for operation "<operationId>" - id: …, state: FINISHED, fileId: …, mtaId: …, bytesRead: …, addedAt: …, startedAt: …, finishedAt: …, queueWaitTime: 30000 ms, uploadDuration: 90000 ms, totalTime: 120000 ms, error: null
    

    Best-effort: operations without file ids (e.g. undeploy) short-circuit, and any lookup failure logs a WARN rather than failing the operation. Injects AsyncUploadJobService (already available transitively, same as OrphanedFilesCleaner).

  • AsyncUploadJobEntry — adds a credential-free buildLogSummary() plus timing derivations:

    • getQueueWaitTime() = addedAt → startedAt (time parked in the queue)
    • getUploadDuration() = startedAt → finishedAt (actual upload time)
    • getTotalTime() = addedAt → finishedAt
    • Timings return null (rendered as N/A) when the relevant timestamps are not set yet.
  • Sensitive data — the summary intentionally omits url and user (may carry basic-auth credentials / PII) and spaceGuid.

Tests

  • New AsyncUploadJobEntryTest — timing derivations for finished/running/initial jobs, sensitive-data redaction, and N/A rendering.
  • Updated StartProcessListenerTest for the new constructor dependency.

Both suites green; multiapps-controller-persistence and -process build clean.

vkalapov
vkalapov previously approved these changes Aug 10, 2026

@vkalapov vkalapov left a comment

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.

Looks good but check the sonar scan warnings before merge.

@IvanBorislavovDimitrov

Copy link
Copy Markdown
Contributor Author

Addressed the SonarCloud warnings in bdb2e34:

  • S8700 (reliability bug, ×3, was failing the quality gate)getQueueWaitTime/getUploadDuration/getTotalTime now compute the Duration over time-zone-aware Instants (UTC) instead of LocalDateTime. Extracted a shared durationBetween(...) helper, which also removes the duplicated null-checks.
  • S2629 — the async-upload-job INFO line is now guarded with LOGGER.isInfoEnabled() so the MessageFormat.format(...) / buildLogSummary() aren't invoked unless INFO is on.
  • S8694 — test uses the java.time.Month.AUGUST enum instead of the 8 int literal.
  • S8924 — statically import Mockito.when in the test.

Both AsyncUploadJobEntryTest and StartProcessListenerTest are green and both modules build clean.

@IvanBorislavovDimitrov
IvanBorislavovDimitrov force-pushed the log-async-upload-job-for-operation-clean branch 2 times, most recently from 24adb5e to 1c4258a Compare August 11, 2026 10:40
When an operation starts, log the async upload job (deploy-from-URL
scenario) associated with that operation, correlated by the operation
id, in a single greppable INFO line.

- StartProcessListener resolves the operation's file ids and queries
  AsyncUploadJobService for the associated jobs, logging one summary
  line per job; lookup failures log a WARN instead of failing the
  operation.
- AsyncUploadJobEntry gains a credential-free buildLogSummary() plus
  queue-wait / upload-duration / total-time derivations computed over
  time-zone-aware Instants; timings render as N/A when timestamps are
  not set yet. The summary omits url, user and spaceGuid.
- Tests cover the timing derivations, sensitive-data redaction, the
  logged-jobs path and the best-effort failure path.
@IvanBorislavovDimitrov
IvanBorislavovDimitrov force-pushed the log-async-upload-job-for-operation-clean branch from 1c4258a to 767fa30 Compare August 11, 2026 11:09
@sonarqubecloud

Copy link
Copy Markdown

@IvanBorislavovDimitrov
IvanBorislavovDimitrov merged commit 7a455c1 into master Aug 11, 2026
7 of 8 checks passed
@IvanBorislavovDimitrov
IvanBorislavovDimitrov deleted the log-async-upload-job-for-operation-clean branch August 11, 2026 12:47
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.

2 participants