# felixge/httpsnoop

Package httpsnoop provides an easy way to capture http related metrics (i.e. response time, bytes written, and http status code) from your application's http.Handlers.

Repository: https://github.com/felixge/httpsnoop
Canonical: https://ross.abutalabs.com/products/httpsnoop
Homepage: https://godoc.org/github.com/felixge/httpsnoop
Language: Go
License: MIT
License Family: permissive
Last push: 2026-06-11T18:43:45+00:00

## Health v2 (maintenance only)
Score: 79/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 87, release rhythm 56, longevity 100
- inputs: {"age_days": 3584, "days_push": 83, "days_rel": 83, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1165, forks 48 (observed 2026-08-28T04:03:49.994494+00:00)

## What it is
A small Go library that captures HTTP metrics (response time, bytes written, status code) from http.Handlers by safely wrapping http.ResponseWriter. It preserves optional interfaces like Flusher, Hijacker, and Pusher to avoid subtle bugs.

## Use cases
- capture http status code from a handler in go
- log response time and bytes written per request
- instrument go http handlers with metrics middleware
- wrap http.ResponseWriter without breaking Flusher or Hijacker
- add request logging middleware to a go web server

## When to choose
- you need per-request metrics in a Go net/http app with minimal dependencies
- naive ResponseWriter wrapping is breaking interfaces like http.Flusher or http.Hijacker
- you want a tiny, stable, widely-used library (700+ importers)

## When to avoid
- you use a web framework that already provides built-in metrics middleware
- you need full APM/tracing rather than simple request metrics
- your handlers add custom interfaces to ResponseWriter that httpsnoop cannot detect

## Facets
- artifact type: library
- maturity: stable
- function: monitoring, middleware, http-server
- domain: web-development, backend, developer-tools, monitoring
- platform: go, windows, cross-platform
- tags: http-metrics, responsewriter-wrapper, request-logging, instrumentation, linux, macos

## Member repositories
- felixge/httpsnoop (main) score 79

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:49.994494+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:29:21.433484+00:00, confidence not recorded.
  - readme: https://github.com/felixge/httpsnoop (fetched 2026-08-28T04:03:49.994494+00:00, sha d17362d80df8)
  - homepage: https://godoc.org/github.com/felixge/httpsnoop (fetched 2026-08-29T12:35:19.786579+00:00, sha 409e5c27a896)
  - site_page: https://pkg.go.dev/about (fetched 2026-08-29T12:35:19.791745+00:00, sha 757852027879)
  - site_page: https://pkg.go.dev/github.com/felixge/httpsnoop (fetched 2026-08-29T12:35:19.789635+00:00, sha 896e69228741)
  - site_page: https://go.dev/project (fetched 2026-08-29T12:35:19.793597+00:00, sha d5ca00bb378b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
