MCPcopy Index your code
hub / github.com/scality/cloudserver / postStats

Function postStats

lib/management/poll.js:69–94  ·  view source on GitHub ↗
(managementEndpoint, instanceId, remoteToken, report, next)

Source from the content-addressed store, hash-verified

67}
68
69function postStats(managementEndpoint, instanceId, remoteToken, report, next) {
70 const toURL = `${managementEndpoint}/${instanceId}/stats`;
71 const toOptions = {
72 json: true,
73 headers: {
74 'content-type': 'application/json',
75 'x-instance-authentication-token': remoteToken,
76 },
77 body: report,
78 };
79 const toCallback = (err, response, body) => {
80 if (err) {
81 logger.info('could not post stats', { error: err });
82 }
83 if (response && response.statusCode !== 201) {
84 logger.info('could not post stats', {
85 body,
86 statusCode: response.statusCode,
87 });
88 }
89 if (next) {
90 next(null, instanceId, remoteToken);
91 }
92 };
93 return request.post(toURL, toOptions, toCallback);
94}
95
96function getStats(next) {
97 const fromURL = `http://localhost:${_config.port}/_/report`;

Callers 1

pushStatsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected