<#2899 Meltano Bisect - Find which record is causi...
# meltano-repo-activity
g
#2899 Meltano Bisect - Find which record is causing the issue Issue created by MeltyBot Migrated from GitLab: https://gitlab.com/meltano/meltano/-/issues/2958 Originally created by @vischous on 2021-09-30 114512 --- Problem to solve I want to know which records are causing my target to fail Target audience 1. Meltano Users 2. Tap/Target developers Further details Example problem 1.
meltano elt tap-clickup target-jsonl --job_id b
2. This exception thrown
Copy code
Traceback (most recent call last):
  File "/home/visch/git/tap-clickup/.meltano/loaders/target-jsonl/venv/bin/target-jsonl", line 8, in <module>
    sys.exit(main())
  File "/home/visch/git/tap-clickup/.meltano/loaders/target-jsonl/venv/lib/python3.8/site-packages/target_jsonl.py", line 94, in main
    state = persist_messages(input_messages, config.get('destination_path', ''), config.get('do_timestamp_file', True))
  File "/home/visch/git/tap-clickup/.meltano/loaders/target-jsonl/venv/lib/python3.8/site-packages/target_jsonl.py", line 59, in persist_messages
    validators[o['stream']].validate(float_to_decimal(o['record']))
  File "/home/visch/git/tap-clickup/.meltano/loaders/target-jsonl/venv/lib/python3.8/site-packages/jsonschema/validators.py", line 130, in validate
    raise error
jsonschema.exceptions.ValidationError: 'true' is not of type 'integer', 'null'

Failed validating 'type' in schema['properties']['custom_fields']['items']['properties']['value']:
    {'type': ['integer', 'null']}

On instance['custom_fields'][1]['value']:
    'true'
Today to solve this problem you do something like 1. Generate an output file that repeats the error (meltano invoke tap-clickup --state state > out ) 2. Run cat out | meltano invoke target-jsonl 3. Find the error Now I'm replicating the error which is great but my output file is roughly 106 lines so I have to try to find which issue this is. I've had this happen with other taps / targets while debugging. What I end up doing is throwing println's in the target to point me to the right place. Brought up here: https://meltano.slack.com/archives/C01PKLU5D1R/p1632247195183600 And here indirectly (Probably could apply to a number of issues) https://meltano.slack.com/archives/C01TCRBBJD7/p1632989543321800 Proposal Not sure exactly there's a few ideas • Meltano Bisect (Stolen from git bisect which is different but the idea is nice). End goal is to give you a list of failing records, while ignoring the successful records (One way is to split the records in half, try half if they are successful try the next half, etc) • Debug Target (Doesn't solve enough issues as target specific issues with records are more common then you'd think) What does success look like, and how can we measure that? 1. When a record level failure happens in Meltano (and you specify that you want this additional information by lets say running meltano bisect) Meltano will tell you exactly which record failed, and will generate a reproducible output file that you can send to your target (Schema, state?, and Record). Regression test N/A Links / references Use cases (There's more but as we get them / point here I'll try to update this) • https://meltano.slack.com/archives/C01TCRBBJD7/p1636312284145100 meltano/meltano