Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
.idea/
target/
.DS_Store
dhat-heap.json
profile.json
profile.json.gz
42 changes: 42 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# CLAUDE.md

## Project overview

pgweasel is a fast CLI PostgreSQL log parser written in Rust (edition 2024, MSRV 1.92). It aggregates errors, locks, slow queries, connections, and system events from Postgres log files.

## Build & test commands

```bash
cargo build # Build
cargo test # Run all tests (unit + integration)
cargo test --test connections # Run a single integration test file
cargo clippy --all-targets -- -W clippy::pedantic # Lint (always run in pedantic mode)
cargo fmt --all -- --check # Check formatting
```

Each change should check tests and formatting, and if necessary fix.
Also each change should write app tests using new functionality.

## Commiting changes

Usually changes are done according to GitHub issues which are stated in subject:

`#12 Added sorting for connections analysis`

## Project structure

- `src/main.rs` — CLI entry point (clap-based subcommands: `err`, `locks`, `slow`, `conn`, `system`)
- `src/aggregators/` — One aggregator per feature (connections, error_frequency, error_histogram, top_slow_query)
- `src/filters/` — Log line filters
- `src/format/` — Log format detection and parsing
- `src/output_results/` — Output orchestration
- `tests/` — Integration tests using `assert_cmd` + `predicates`, one file per subcommand
- `tests/files/` — Sample log files for tests

## Conventions

- Integration tests run the compiled binary via `assert_cmd::cargo::cargo_bin!("pgweasel")` and assert on stdout/stderr
- Aggregators implement the `Aggregator` trait (`update`, `merge_box`, `print`, `boxed_clone`, `as_any`)
- Sorted output sections use `Vec::sort_by` on collected HashMap entries, sorted descending by count
- Use `memchr::memmem` for fast byte-level string searches in hot paths
- Parallel processing via `rayon`; aggregator results merged with `merge_box()`
42 changes: 0 additions & 42 deletions CLAUDE.md

This file was deleted.

1 change: 1 addition & 0 deletions CLAUDE.md
Loading
Loading