Skip to content

feat: add traceId to upload logs and improve observability - #647

Merged
trygve-lie merged 4 commits into
mainfrom
feat/upload-logging
Aug 24, 2026
Merged

feat: add traceId to upload logs and improve observability#647
trygve-lie merged 4 commits into
mainfrom
feat/upload-logging

Conversation

@trygve-lie

Copy link
Copy Markdown
Contributor

Threads a per-request trace ID through all upload-related log lines and adds missing log points across the upload path.

Trace ID

Each log line for a request now includes the trace ID from `req.traceId` (set by the service layer from the Fastify request ID). This makes it straightforward to filter all logs for a single upload in any log aggregation tool. The trace ID is also passed to `sink.write()` so GCS sinks can store it as object metadata.

New log points

pkg.put handler:

  • Upload start: `pkg:put - Received upload - Name: X - Version: Y - TraceId: Z`
  • Upload completion: `pkg:put - Upload completed - Name: X - Version: Y - TraceId: Z`
  • Error logs for four previously silent 502 failure paths (`_readVersions`, `_writeEikJson`, `writeJSON`, `_writeVersions`)

Multipart parser:

  • Tar extraction success with file counts: `multipart - Tar successfully unpacked - Total: N - Written: N - Failed: N`
  • Tar extraction failure extended with partial counts
  • Abort log when file size limit or extraction error cancels in-flight writes
  • `eik.json` presence/absence logged at `debug` level
  • Name and Version added to parser log lines

Alias handlers:

  • `alias:put - Alias updated - Org: X - Type: Y - Name: Z - Alias: A - Version: B - TraceId: C`
  • `alias:post - Alias created - Org: X - Type: Y - Name: Z - Alias: A - Version: B - TraceId: C`

Log level changes

Per-file write start and success logs downgraded from `info` to `debug`. A package with 50 files previously produced 100 `info` lines per upload; these are now only visible when debug logging is enabled.

Bug fix

A copy-paste error in `alias.put.js` that logged `alias:post` instead of `alias:put` is corrected.

Threads a per-request trace ID through all upload-related log lines
(pkg:put, alias:put, alias:post, map:put and the multipart parser).
The trace ID is read from req.traceId which the service layer sets from
the Fastify request ID.

Additional changes:
- Upload start and completion logs in pkg.put handler
- Error logs for the four previously silent 502 failure paths
- Tar extraction success log with total/written/failed file counts
- Abort log when an upload is cancelled
- eik.json presence/absence logged at debug level
- Per-file write start and success logs downgraded from info to debug
- Name and Version added to parser log lines where missing
- traceId passed to sink.write() to enable GCS object metadata tagging
- Copy-paste bug fixed in alias.put handler (was logging alias:post)
The @eik/sink base class type definition does not yet include the optional
third options parameter. Suppress the type error with @ts-ignore until the
base class is updated and a new version is published.
@trygve-lie
trygve-lie merged commit 32f8d38 into main Aug 24, 2026
6 checks passed
@trygve-lie
trygve-lie deleted the feat/upload-logging branch August 24, 2026 13:26
github-actions Bot pushed a commit that referenced this pull request Aug 24, 2026
# [2.3.0](v2.2.3...v2.3.0) (2026-08-24)

### Features

* add traceId to upload logs and improve observability ([#647](#647)) ([32f8d38](32f8d38))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants