haranalyzer

command module
v0.0.0-...-47096ee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 13 Imported by: 0

README

HAR Analyzer

HAR Analyzer is a powerful command-line tool for analyzing HTTP Archive (HAR) files with advanced filtering capabilities. It allows you to process large HAR files, apply complex filters, and generate insightful summaries of network activity.

Features

  • Parse and analyze large HAR files
  • Advanced filtering options (URL, HTTP method, status code, response time, response size, content type)
  • Custom query language for complex filtering
  • Sort entries by time, size, status code, or URL
  • Chunk-based analysis with configurable chunk size
  • Multiple output formats (text, JSON, CSV)
  • Optional AI-powered analysis using the Anthropic API

Installation

  1. Ensure you have Go 1.20 or later installed on your system.
  2. Clone this repository:
    git clone https://github.com/tmc/haranalyzer.git
    
  3. Change to the project directory:
    cd haranalyzer
    
  4. Build the project:
    go build
    

Usage

haranalyzer [flags]
Flags
  • -i, --input string: Input HAR file (required)
  • -o, --output string: Output format (text, json, csv) (default "text")
  • -s, --sort string: Sort entries by (time, size, status, url) (default "time")
  • -c, --chunk int: Chunk size for analysis (default 100)
  • -q, --query string: Query string for filtering
  • -a, --ai: Perform AI analysis
  • --anthropic-key string: Anthropic API key
Examples
  1. Basic usage:

    ./haranalyzer -i example.har
    
  2. Use JSON output and sort by response size:

    ./haranalyzer -i example.har -o json -s size
    
  3. Apply a complex filter:

    ./haranalyzer -i example.har -q "method:GET AND status:200-299 AND time>1000"
    
  4. Perform AI analysis (requires Anthropic API key):

    ./haranalyzer -i example.har -a --anthropic-key YOUR_API_KEY
    

Query Language

The query language allows you to create complex filters using the following syntax:

  • key:value: Exact match (e.g., method:GET)
  • key:value1-value2: Range match (e.g., status:200-299)
  • key>value or key<value: Greater than or less than (e.g., time>1000)
  • key~value: Contains match (e.g., url~example.com)
  • key/regex/: Regular expression match (e.g., `url/^https://api./)

You can combine multiple conditions using AND and OR operators.

Example complex query:

method:GET AND status:200-299 AND time>1000 AND (url~example.com OR url/^https:\/\/api\./)

This query filters for GET requests with status codes between 200 and 299, response times greater than 1000ms, and URLs that either contain "example.com" or match the regex ^https:\/\/api\..

License

This project is licensed under the MIT License. See the LICENSE file for details.

Documentation

Overview

Command haranalyzer analyzes HAR (HTTP Archive) files to provide insights into web performance.

This tool reads HAR files and provides various analysis features including performance metrics, resource breakdowns, and AI-powered insights using Anthropic's Claude API.

Usage:

haranalyzer [command] [flags] <har-file>

Available Commands:

analyze    Perform AI-powered analysis of the HAR file
summary    Display a summary of requests and performance metrics
export     Export HAR data to CSV format
help       Help about any command

Global Flags:

-h, --help    help for haranalyzer

Examples:

# Show summary statistics for a HAR file
haranalyzer summary recording.har

# Perform AI analysis (requires ANTHROPIC_API_KEY)
haranalyzer analyze recording.har

# Export to CSV for spreadsheet analysis
haranalyzer export recording.har > analysis.csv

The tool provides insights into:

  • Request count and types
  • Total data transferred
  • Response time statistics
  • Resource type breakdowns
  • Performance bottlenecks (with AI analysis)

For AI-powered analysis, set the ANTHROPIC_API_KEY environment variable with your Anthropic API key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL