pulibrary / figgy

Valkyrie-based digital repository backend.
Other
36 stars 4 forks source link

Determine which resources were affected by FileAppender errors since the 9th of April. #6339

Closed tpendragon closed 5 months ago

tpendragon commented 5 months ago

https://app.honeybadger.io/projects/53391/faults/105517424

First Step

Look at the above, find a way to figure out all the resources affected.

hackartisan commented 5 months ago

I downloaded an export the honeybadger notifications, made it into valid json like sed '1s/^/[/;$!s/$/,/;$s/$/]/' filename.jsonl > new_filename.jsonl, and ran this on it:

require "json"
require "csv"

json = JSON.parse(File.read("53391-0c4bacb3-0a61-4ba3-bc2c-cc57e5b44ef9.jsonl"))

CSV.open("file_appender_errors.csv", "w") do |csv|
  headers = %w[timestamp label fileset_id resource_id error path]
  csv << headers
  json.each do |notification|
    timestamp = notification["created_at"]
    message = notification["message"]
    match_data = message.match(/^FileAppender: Failed to append the new file (.*) for (.*) to resource (.*): (.*) - (.*)$/)
    label, fileset_id, resource_id, error, path = match_data.captures
    row = [timestamp, label, fileset_id, resource_id, error, path]
    csv << row
  end
end

Resulting file: file_appender_errors.csv

tpendragon commented 5 months ago

There's 276 of these, we probably need to find a way to fix or reingest.

I'm working on adding them all to https://figgy.princeton.edu/?f%5Bmember_of_collection_titles_ssim%5D%5B%5D=Broken+Resources%3A+Missing+Files&show_children=True

tpendragon commented 5 months ago

Done and folks are working on them.