Skip to content

Forward X-Scal-Request-Uids on Backbeat report/CRR-metrics requests#6219

Open
delthas wants to merge 3 commits into
development/9.4from
improvement/CLDSRV-947/forward-requids-report
Open

Forward X-Scal-Request-Uids on Backbeat report/CRR-metrics requests#6219
delthas wants to merge 3 commits into
development/9.4from
improvement/CLDSRV-947/forward-requids-report

Conversation

@delthas

@delthas delthas commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Forward the werelogs request-uid chain (log.getSerializedUids()) on cloudserver's Backbeat report / CRR-metrics HTTP calls, via the x-scal-request-uids header.

Previously traceparent flowed on these calls but the reqUids chain did not. The header set here uses the same lowercase name cloudserver already reads on incoming admin requests (lib/server.js) and that arsenal's RESTServer reads, so req_id continuity is preserved across the Backbeat metric and state/schedule calls.

Scope: only the Backbeat metric/state calls that go through reportHandler's _makeRequest (CRR/ingestion metrics, replication/ingestion states and schedules). The vault/metadata/data calls in reportHandler already forward reqUids through their arsenal clients and are unchanged.

Issue: CLDSRV-947

@bert-e

bert-e commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Hello delthas,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval
/bypass_build_status Bypass the build and test status
/bypass_commit_size Bypass the check on the size of the changeset TBA
/bypass_incompatible_branch Bypass the check on the source branch prefix
/bypass_jira_check Bypass the Jira issue check
/bypass_peer_approval Bypass the pull request peers' approval
/bypass_leader_approval Bypass the pull request leaders' approval
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request TBA
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@scality scality deleted a comment from bert-e Jul 6, 2026
@bert-e

bert-e commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

Comment thread lib/utilities/reportHandler.js Fixed
Comment thread lib/utilities/reportHandler.js Fixed
@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
9660 1 9659 0
View the full list of 2 ❄️ flaky test(s)
"after each" hook for "should fail if trying to overwrite a delete marker"::MPU with x-scal-s3-version-id header With v4 signature "after each" hook for "should fail if trying to overwrite a delete marker"

Flake rate in main: 100.00% (Passed 0 times, Failed 206 times)

Stack Traces | 0.022s run time
We encountered an internal error. Please try again.
should create a bunch of objects and their versions::put and head object with versioning With v4 signature on versioning suspended then enabled bucket w/ null version should create a bunch of objects and their versions

Flake rate in main: 13.81% (Passed 668 times, Failed 107 times)

Stack Traces | 600s run time
Timeout of 600000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (.../test/versioning/objectHead.js)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

delthas added 2 commits July 6, 2026 16:21
Propagate the werelogs request-uid chain (log.getSerializedUids()) on the
Backbeat report / CRR-metrics HTTP calls made through reportHandler's
_makeRequest, via the x-scal-request-uids header. This matches the header
cloudserver already reads on incoming admin requests, so req_id continuity
is preserved across the Backbeat metric and state/schedule calls.

Issue: CLDSRV-947
@delthas delthas force-pushed the improvement/CLDSRV-947/forward-requids-report branch from e39cb49 to 881981a Compare July 6, 2026 14:22
Comment on lines +270 to +282
(site, next) =>
requestMethod(endpoint, site, log, (err, res) => {
if (err) {
log.debug('Error in retrieving site metrics', {
method: '_getMetricsByLocation',
error: err,
site,
requestType: requestMethod.name,
});
return next(null, { site, stats: {} });
}
return next(null, { site, stats: res });
}),
});
return async.parallel(
{
all: done => requestMethod(endpoint, 'all', log, done),
return async.parallel(
{
all: done => requestMethod(endpoint, 'all', log, done),
byLocation: done => _getMetricsByLocation(endpoint, sites, requestMethod, log, done),
locationSchedules[loc] = new Date(val);
async.parallel(
{
states: done => _makeRequest(endpoint, statusPath, log, done),
async.parallel(
{
states: done => _makeRequest(endpoint, statusPath, log, done),
schedules: done => _makeRequest(endpoint, schedulePath, log, done),
getMDDiskUsage: cb => metadata.getDiskUsage(log, cb),
getDataDiskUsage: cb => data.getDiskUsage(log, cb),
getVersion: cb => getGitVersion(cb),
getObjectCount: cb => metadata.countItems(log, cb),
getDataDiskUsage: cb => data.getDiskUsage(log, cb),
getVersion: cb => getGitVersion(cb),
getObjectCount: cb => metadata.countItems(log, cb),
getCRRMetrics: cb => getCRRMetrics(log, cb),
getVersion: cb => getGitVersion(cb),
getObjectCount: cb => metadata.countItems(log, cb),
getCRRMetrics: cb => getCRRMetrics(log, cb),
getReplicationStates: cb => getReplicationStates(log, cb),
getObjectCount: cb => metadata.countItems(log, cb),
getCRRMetrics: cb => getCRRMetrics(log, cb),
getReplicationStates: cb => getReplicationStates(log, cb),
getIngestionInfo: cb => getIngestionInfo(log, cb),
getCRRMetrics: cb => getCRRMetrics(log, cb),
getReplicationStates: cb => getReplicationStates(log, cb),
getIngestionInfo: cb => getIngestionInfo(log, cb),
getVaultReport: cb => vault.report(log, cb),
Convert reportHandler's _makeRequest, whose signature this change modified,
to an async function using the dual callback+async continuation trampoline:
callers keep the callback contract while the body is async/await. This
preempts the CodeQL js/callback-style-function alert on the function this
PR touched.

_makeRequest is an internal HTTP helper (endpoint, path, log, cb), not a
CORS-bearing lib/api handler, so the trampoline omits the
err.additionalResHeaders / collectCorsHeaders handling. request.get yields
two success values (response, body), which util.promisify cannot express, so
it is wrapped in a manual Promise. The (err, res) callback contract is
preserved exactly, including the cb('responseError', body) sentinel path.

The .then()/.catch() on the trampoline (eslint promise/prefer-await-to-then
and CodeQL js/promise-then-usage) are the accepted trade-off of this pattern.

Issue: CLDSRV-947
Comment thread lib/utilities/reportHandler.js
Comment on lines +156 to +157
return _makeRequest(endpoint, path, log)
.then(res => cb(null, res))
@delthas delthas marked this pull request as ready for review July 7, 2026 14:43
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.

3 participants