# knyar/nginx-lua-prometheus

Prometheus metric library for Nginx written in Lua

Repository: https://github.com/knyar/nginx-lua-prometheus
Canonical: https://ross.abutalabs.com/products/nginx-lua-prometheus
Language: Lua
License: MIT
License Family: permissive
Topics: nginx, prometheus, metrics, lua, monitoring
Last push: 2025-01-04T08:43:30+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 3819, "days_push": 606, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1562, forks 236 (observed 2026-08-28T04:05:03.900039+00:00)

## What it is
A Lua library for Nginx (via ngx_lua/OpenResty) that tracks metrics like counters, gauges, and histograms and exposes them on a /metrics endpoint for Prometheus scraping. It lets you instrument request counts, latencies, and connection states directly in nginx.conf.

## Use cases
- expose nginx metrics to prometheus
- track http request latency by server name
- count requests by status code in nginx
- monitor nginx connections with prometheus
- instrument openresty applications with prometheus metrics
- scrape nginx metrics endpoint

## When to choose
- you run nginx or OpenResty with ngx_lua and want native Prometheus metrics without an exporter sidecar
- you need low-overhead per-request instrumentation inside nginx itself
- you want counters, gauges, and histograms with custom labels exposed on a scrape endpoint

## When to avoid
- your nginx build lacks the ngx_lua module and you cannot add it
- you need metrics from non-Lua parts of your stack or other services
- you use a metrics backend other than Prometheus without conversion support

## Facets
- artifact type: library
- maturity: stable
- function: monitoring, logging
- domain: monitoring, web-development, backend
- platform: lua, self-hosted
- tags: prometheus, metrics, nginx-lua, observability, instrumentation, devops, nginx, openresty, linux

## Member repositories
- knyar/nginx-lua-prometheus (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:03.900039+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-30T04:00:18.048574+00:00, confidence not recorded.
  - readme: https://github.com/knyar/nginx-lua-prometheus (fetched 2026-08-28T04:05:03.900039+00:00, sha 55631042b2a0)
- Data as of 2026-08-30T08:39:29.467469+00:00.
