# connect-metric

> Middleware that exposes metric for logging in the context of a user

Latest version **1.0.1** (published 2013-12-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install connect-metric
pnpm add connect-metric
yarn add connect-metric
bun add connect-metric
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2013-12-05 |
| First published | 2013-03-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Cameron Bytheway |
| Maintainers | camshaft |

## Links

- npm: https://www.npmjs.com/package/connect-metric
- Repository: https://github.com/CamShaft/connect-metric
- Issues: https://github.com/CamShaft/connect-metric/issues
- npm.io page: https://npm.io/package/connect-metric

## Dependencies (1)

- [metric-log](https://npm.io/package/metric-log.md) ~1.0.0

## Recent versions

- 1.0.1 (latest) — 2013-12-05
- 1.0.0 — 2013-10-12
- 0.2.1 — 2013-04-17
- 0.2.0 — 2013-03-28
- 0.1.0 — 2013-03-26

## README

connect-metric [![Build Status](https://travis-ci.org/CamShaft/connect-metric.png?branch=master)](https://travis-ci.org/CamShaft/connect-metric)
==============

Middleware that exposes [metric](https://github.com/CamShaft/metric-log) for logging in the context of a request

Usage
-----

```js
var app = express()
  , metric = require("connect-metric");

app.use(metric());

app.get("/", function(req, res){
  req.metric("home_page", 1, "views"); // measure=home_page val=1 units=views
});
```

Options
-------

```js
metric(context, options);
```

### context

The metric logger can inherit context

```js
app.use(metric({foo: "bar"}));

app.get("/", function(req, res){
  req.metric("home_page", 1, "views"); // foo=bar measure=home_page val=1 units=views
});
```

### options

#### options.request_id

Header name that provides a request id.

---
_Source: https://npm.io/package/connect-metric · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
