Skip to content

Commit

Permalink
metrics: Also collect pixel sizes of input and output images
Browse files Browse the repository at this point in the history
Fixes #76
  • Loading branch information
jonnor committed Aug 21, 2016
1 parent f9bba03 commit e9f8663
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/newrelic.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ prepareEvent = (job) ->
slush: slush
input_bytes: job.input_bytes
output_bytes: job.output_bytes
input_width: job.input_width
input_height: job.input_height
output_width: job.output_width
output_height: job.output_height
# error
error: job.error?.result?.error

Expand Down
6 changes: 5 additions & 1 deletion src/processing.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,13 @@ class JobExecutor extends EventEmitter

inputType = if downloads.input? then common.typeFromMime downloads.input.type else null
inputFile = if downloads.input? then downloads.input.path else null
processor.process outf, req.outtype, graph, req.iips, inputFile, inputType, (err, stderr) =>
processor.process outf, req.outtype, graph, req.iips, inputFile, inputType, (err, stderr, metadata={}) =>
job.processed_at = Date.now()

job.input_width = metadata.input?.width
job.input_height = metadata.input?.height
job.output_width = metadata.output?.width
job.output_height = metadata.output?.height
@collectImageStats inputFile, (err, inStats) =>
@logEvent 'image-stats-error', { request: request_url, err: err } if err
@collectImageStats outf, (err, outStats) =>
Expand Down

0 comments on commit e9f8663

Please sign in to comment.