duck_hunt

Parsen und analysieren Sie Testergebnisse, Build-Ausgaben und CI/CD-Pipeline-Logs aus über 110 Formaten mit Severity-Filterung, automatischer Formaterkennung und Kontextextraktion

Maintainer: teaguesterling

Installation und Laden

INSTALL duck_hunt FROM community;
LOAD duck_hunt;

Beispiel

-- Parse build errors (warnings and above)
SELECT ref_file, ref_line, message
FROM read_duck_hunt_log('build.log', 'auto', severity_threshold := 'warning')
WHERE status = 'ERROR';
-- Parse test results with all events
SELECT test_name, status, execution_time
FROM read_duck_hunt_log('pytest.json', 'pytest_json', severity_threshold := 'all')
WHERE status = 'FAIL';
-- Process multiple files, skip failures (new in v1.4.0)
SELECT * FROM read_duck_hunt_log('logs/*.json', ignore_errors := true);
-- Control log_content size for memory efficiency (new in v1.4.0)
SELECT * FROM read_duck_hunt_log('huge.log', content := 200);
SELECT * FROM read_duck_hunt_log('huge.log', content := 'smart');
-- Extract surrounding log lines for context (new in v1.6.0)
SELECT ref_file, message, context
FROM read_duck_hunt_log('build.log', 'make_error', context := 3);
-- Parse GitHub Actions ZIP archives (new in v1.4.0, requires zipfs)
-- INSTALL zipfs FROM community; LOAD zipfs;
SELECT job_name, severity, message
FROM read_duck_hunt_workflow_log('workflow_run.zip', 'github_actions_zip')
WHERE severity = 'error';
-- Debug format detection
SELECT format, can_parse, events_produced, is_selected
FROM duck_hunt_diagnose_read('build.log');
-- LATERAL join for per-file parsing (new in v1.7.0)
SELECT f.filename, e.*
FROM glob('logs/*.log') f,
LATERAL read_duck_hunt_log(f.filename) e;
-- Comma-separated format fallback chain (new in v1.9.0)
SELECT ref_file, ref_line, message
FROM read_duck_hunt_log('build.log', 'gcc_text,make_error,cmake_build');
-- Load custom parser from config file (new in v1.8.0)
SELECT duck_hunt_load_parser_config('my_parser.yml');
-- Build health badge
SELECT status_badge(
COUNT(*) FILTER (WHERE status = 'ERROR'),
COUNT(*) FILTER (WHERE status = 'WARNING')
) FROM read_duck_hunt_log('build.log', 'auto');

Über duck_hunt

Duck Hunt ist eine umfassende DuckDB-Erweiterung zum Parsen und Analysieren von Ausgaben von Entwicklungswerkzeugen. Sie bietet eine einheitliche SQL-Schnittstelle, um Testergebnisse, Build-Logs, Linting-Ausgaben und CI/CD- Pipeline-Daten aus über 90 Tools und Formaten abzufragen.

Dokumentation: https://duck-hunt.readthedocs.io/

Zentrale Tabellenfunktionen:

  • read_duck_hunt_log(source, format, severity_threshold, ignore_errors, content, context) - Tool-Ausgaben aus Dateien parsen
  • parse_duck_hunt_log(text, format, severity_threshold, content, context) - Tool-Ausgaben aus Strings parsen
  • read_duck_hunt_workflow_log(source, format, severity_threshold, ignore_errors) - CI/CD-Workflow-Logs parsen
  • parse_duck_hunt_workflow_log(text, format, severity_threshold) - Workflow-Strings parsen

Neu in v1.9.0:

  • Kommagetrennte Formatstrings – mehrere Parser der Reihe nach versuchen (z. B. 'gcc_text,make_error')
  • Unscharfe Formatanamensvorschläge – Tippfehler erhalten hilfreiche „Meinten Sie?“-Fehler
  • Pytest-Parser-Anreicherungsfix – tatsächliche Assertion-Fehler statt „Test failed“
  • Pytest-Dedup – ein Ereignis pro Fehler statt Duplikate aus Inline+Summary
  • Extraktion von function_name für pytest-Test-Ereignisse
  • Parser-Nachrichtenqualität – 14 Parser korrigiert, damit Test-/Methodennamen in Nachrichten enthalten sind

Neu in v1.8.0:

  • Unity-Test-XML-Parser – NUnit-3-Format-Testergebnisse parsen (erfordert die Erweiterung webbed)
  • Konfigurationsbasiertes Parser-System – benutzerdefinierte Parser über JSON-Konfigurationsdateien definieren
  • Unity-Editor-Build-Log-Parser
  • Dateibasiertes Parser-Interface für effizientes XML-Parsing
  • Security-Härtung – Schutz vor Path Traversal, Dateigrößenlimit 100 MB
  • Performance – statische Regex-Muster, threadsicherer ParserRegistry

Neu in v1.7.0:

  • LATERAL-Join-Unterstützung für read_duck_hunt_log und parse_duck_hunt_log
  • Streaming-Parser-Unterstützung für große Dateien
  • ruff_json-Parser für JSON-Ausgabe des Ruff-Python-Linters
  • Parameter include_unparsed zum Debuggen des regexp-Parsers
  • Verbesserter DuckDB-Test-Parser mit besserer Fehler-Extraktion
  • Normalisierung von Zeilenenden (CRLF/CR-Unterstützung)

Neu in v1.6.0:

  • Parameter context – N umgebende Log-Zeilen um jedes Ereignis einbeziehen
  • Kontextspaltentyp: LIST(STRUCT(line_number INT, content VARCHAR, is_event BOOL))
  • Funktioniert mit allen Parsern und kombiniert sich mit anderen Parametern

Neu in v1.5.0:

  • Formatgruppen: Verwenden Sie python, javascript, lint, test, build usw. zur automatischen Erkennung
  • 14 Formate auf Production-Reife hochgestuft (205 neue Test-Assertions)
  • Aufgeräumte Codebasis: 37 Parser auf das DelegatingParser-Template migriert

Neu in v1.4.0:

  • Parameter ignore_errors – Verarbeitung fortsetzen, wenn einzelne Dateien fehlschlagen
  • Parameter content – Größe von log_content steuern: Ganzzahllimit, 'smart', 'none' oder 'full'
  • Format github_actions_zip – ZIP-Archive von GitHub Actions parsen (erfordert die Erweiterung zipfs)
  • Workflow-Delegation – Workflow-Parser delegieren automatisch an Tool-Parser (make, pytest usw.)

Diagnosefunktionen:

  • duck_hunt_detect_format(content) - Format automatisch erkennen, gibt Formatanamen oder NULL zurück
  • duck_hunt_diagnose_read(path) - Debuggen, welche Parser zu einer Datei passen
  • duck_hunt_diagnose_parse(content) - Debuggen, welche Parser zum Inhalt passen
  • duck_hunt_formats() - Alle unterstützten Formate mit Prioritäten auflisten

Skalarfunktionen:

  • status_badge(status) - Status in Badge umwandeln: [ OK ], [FAIL], [WARN], [ .. ], [ ?? ]
  • status_badge(errors, warnings) - Badge aus Zählungen berechnen
  • status_badge(errors, warnings, is_running) - Badge mit Laufzustand

Severity-Filterung: Ereignisse nach Severity-Stufe filtern: 'all' < 'info' < 'warning' < 'error' < 'critical'

Unterstützte Formate (über 110): Siehe: https://duck-hunt.readthedocs.io/en/latest/formats/

  • Dynamisch: regexp:<pattern> - Benutzerdefinierte Muster mit benannten Capture Groups
  • Test-Frameworks: pytest, Go test, Cargo test, JUnit, RSpec, Mocha/Chai, Google Test, NUnit/xUnit
  • Linting-Tools: ESLint, RuboCop, Pylint, Flake8, MyPy, Clippy, SwiftLint, PHPStan, isort und mehr
  • Build-Systeme: CMake, Make, Maven, Gradle, Cargo, MSBuild, Node.js, Python, Spack
  • CI/CD-Engines: GitHub Actions, GitLab CI, Jenkins, Docker, Drone CI, Terraform
  • Verteilte Systeme: HDFS, Spark, Zookeeper, OpenStack, Android, Blue Gene/L
  • Infrastruktur: Kubernetes, AWS CloudTrail, VPC Flow, S3 Access, Syslog
  • Debugging: Valgrind, GDB/LLDB, strace

Schemafelder (39): Siehe: https://duck-hunt.readthedocs.io/en/latest/schema/

  • Referenzkontext: ref_file, ref_line, ref_column (in Logs erwähnte Stellen)
  • Log-Quelle: log_file, log_content, log_line_start, log_line_end
  • Kern: event_id, tool_name, event_type, status, severity, message
  • Fehleranalyse: fingerprint, similarity_score, pattern_id
  • Hierarchie: scope, group, unit, subunit (und zugehörige _id- und _status-Felder)

Zentrale Funktionen:

  • Automatische Formaterkennung mit Diagnose-Debugging
  • Transparente Kompressionsunterstützung (GZIP eingebaut, ZSTD über parquet)
  • Unterstützung für GitHub-Actions-ZIP-Archive (über die Erweiterung zipfs)
  • Severity-basierte Ereignisfilterung
  • Kontextextraktion für umgebende Log-Zeilen
  • Fehlerclusterung und Fingerprinting
  • Mehrdatei-Glob-Verarbeitung mit ignore_errors für robuste Stapelverarbeitung
  • Speichereffiziente Inhaltsmodi (Limit, smartes Kürzen, Weglassen)
  • Workflow-Delegation an toolspezifische Parser
  • Pipeline-Integration mit stdin-Unterstützung
  • Hierarchisches Parsing von CI/CD-Workflows

Ideal für CI/CD-Analyse, automatisiertes Debugging, Testaggregation, Quality Gates und agentengesteuerte Entwicklungs-Workflows.

Hinzugefügte Funktionen

function_name function_type description comment examples
duck_hunt_detect_format scalar NULL NULL
duck_hunt_diagnose_parse table NULL NULL
duck_hunt_diagnose_read table NULL NULL
duck_hunt_formats table NULL NULL
duck_hunt_load_parser_config scalar NULL NULL
duck_hunt_match_command_patterns table_macro NULL NULL
duck_hunt_unload_parser scalar NULL NULL
parse_duck_hunt_log table NULL NULL
parse_duck_hunt_workflow_log table NULL NULL
read_duck_hunt_log table NULL NULL
read_duck_hunt_workflow_log table NULL NULL
status_badge scalar NULL NULL

Überladene Funktionen

Diese Erweiterung fügt keine Funktionsüberladungen hinzu.

Hinzugefügte Typen

Diese Erweiterung fügt keine Typen hinzu.

Hinzugefügte Einstellungen

Diese Erweiterung fügt keine Einstellungen hinzu.