Skip to content

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

Closed
IvanBorislavovDimitrov wants to merge 1 commit into
cloudfoundry:masterfrom
IvanBorislavovDimitrov:log-async-upload-job-for-operation-clean
Closed

Log async upload job details correlated with operation id#1888
IvanBorislavovDimitrov wants to merge 1 commit into
cloudfoundry:masterfrom
IvanBorislavovDimitrov: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.

At operation start, resolve the operation's file ids and log any associated
async upload job (deploy-from-URL) with a credential-free summary that includes
queue wait time, upload duration and total time. Adds timing derivations and a
log-safe summary to AsyncUploadJobEntry.
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.

1 participant