Forward X-Scal-Request-Uids on Backbeat report/CRR-metrics requests#6219
Open
delthas wants to merge 3 commits into
Open
Forward X-Scal-Request-Uids on Backbeat report/CRR-metrics requests#6219delthas wants to merge 3 commits into
delthas wants to merge 3 commits into
Conversation
Contributor
Hello delthas,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Contributor
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
❌ 1 Tests Failed:
View the full list of 2 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
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
e39cb49 to
881981a
Compare
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 on lines
+156
to
+157
| return _makeRequest(endpoint, path, log) | ||
| .then(res => cb(null, res)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Forward the werelogs request-uid chain (
log.getSerializedUids()) on cloudserver's Backbeat report / CRR-metrics HTTP calls, via thex-scal-request-uidsheader.Previously
traceparentflowed 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'sRESTServerreads, 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