[DockerRunner] fix metric incrementing and error logging
- do not log on first EPIPE - inc 'container-inspect-epipe-error' on permanent error only Co-Authored-By: Tim Alby <timothee.alby@gmail.com>
This commit is contained in:
@@ -408,31 +408,28 @@ module.exports = DockerRunner = {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
var inspectContainer = (isRetry) =>
|
||||||
const callbackWithRetry = error => {
|
|
||||||
if (error.message.match(/EPIPE/)) {
|
|
||||||
metrics.inc('container-inspect-epipe-retry')
|
|
||||||
return inspectContainer(container, callback)
|
|
||||||
}
|
|
||||||
callback(error)
|
|
||||||
}
|
|
||||||
|
|
||||||
var inspectContainer = (container, innerCallback) =>
|
|
||||||
container.inspect(function(error, stats) {
|
container.inspect(function(error, stats) {
|
||||||
if ((error != null ? error.statusCode : undefined) === 404) {
|
if ((error != null ? error.statusCode : undefined) === 404) {
|
||||||
return createAndStartContainer()
|
return createAndStartContainer()
|
||||||
} else if (error != null) {
|
} else if (error != null) {
|
||||||
metrics.inc('container-inspect-epipe-error')
|
if (error.message.match(/EPIPE/)) {
|
||||||
|
if (!isRetry) {
|
||||||
|
metrics.inc('container-inspect-epipe-retry')
|
||||||
|
return inspectContainer(true)
|
||||||
|
}
|
||||||
|
metrics.inc('container-inspect-epipe-error')
|
||||||
|
}
|
||||||
logger.err(
|
logger.err(
|
||||||
{ container_name: name, error },
|
{ container_name: name, error },
|
||||||
'unable to inspect container to start'
|
'unable to inspect container to start'
|
||||||
)
|
)
|
||||||
return innerCallback(error)
|
return callback(error)
|
||||||
} else {
|
} else {
|
||||||
return startExistingContainer()
|
return startExistingContainer()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
inspectContainer(container, callbackWithRetry)
|
inspectContainer(false)
|
||||||
},
|
},
|
||||||
|
|
||||||
attachToContainer(containerId, attachStreamHandler, attachStartCallback) {
|
attachToContainer(containerId, attachStreamHandler, attachStartCallback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user