Add retry stats
This commit is contained in:
parent
cb8f5f59d0
commit
9d75fcaa93
1 changed files with 5 additions and 0 deletions
|
@ -1,8 +1,12 @@
|
|||
import { dirname, join } from 'path';
|
||||
import StatsD from 'statsy';
|
||||
import Client from './ssh2-sftp-client';
|
||||
import debugname from 'debug';
|
||||
const debug = debugname('hostr:sftp');
|
||||
|
||||
const statsdOpts = { prefix: 'hostr-api', host: process.env.STATSD_HOST };
|
||||
const statsd = new StatsD(statsdOpts);
|
||||
|
||||
export function get(remotePath) {
|
||||
debug('fetching', join('hostr', 'uploads', remotePath));
|
||||
const sftp = new Client();
|
||||
|
@ -41,6 +45,7 @@ export function *upload(localPath, remotePath) {
|
|||
done = yield sendFile(localPath, remotePath);
|
||||
break;
|
||||
} catch (err) {
|
||||
statsd.incr('file.upload.retry', 1);
|
||||
debug('retry');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue