# metronic-boundary

> A boundary adapter for metronic

Latest version **0.1.1** (published 2015-06-17) · MIT License - http://opensource.org/licenses/MIT license · 0 weekly downloads

## Install

```sh
npm install metronic-boundary
pnpm add metronic-boundary
yarn add metronic-boundary
bun add metronic-boundary
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2015-06-17 |
| First published | 2015-05-13 |
| Weekly downloads | 0 |
| License | MIT License - http://opensource.org/licenses/MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+7 in 2 direct dependencies) |
| Install scripts | no |
| Author | LeanKit |
| Maintainers | arobson |

## Links

- npm: https://www.npmjs.com/package/metronic-boundary
- Repository: https://github.com/LeanKit-Labs/metronic-boundary
- Issues: https://github.com/LeanKit-Labs/metronic-boundary/issues
- npm.io page: https://npm.io/package/metronic-boundary

## Dependencies (3)

- [when](https://npm.io/package/when.md) ^3.7.3
- [lodash](https://npm.io/package/lodash.md) ^3.8.0
- [request](https://npm.io/package/request.md) ^2.55.0

## Recent versions

- 0.1.1 (latest) — 2015-06-17
- 0.1.0 — 2015-05-13

## README

## metronic-boundary

A Boundary adapter for metronic that tries to keep things simple. Intended for use with the `metronic-rabbit` module.

> Note: This is alphaware and will quite likely change in terms of how it interacts with Boundary.

## How It Works - READ THIS FIRST

### Not For Direct Inclusion In Your Apps/Services
This adapter will shutdown the process under the following circumstances:

 * The e-mail and token are missing or invalid
 * Metrics could not be retrieved from Boundary
 * There have been more than 2 consecutive failures to post measures to a metric

This approach is intended to alert operations to a potentially serious issue and avoid losing metrics. The [`metronic-rabbit`](https://github.com/LeanKit-Labs/metronic-rabbit) adapter uses `noAck`, `auto-delete`, non-durable queues; while this makes for very fast publishing, it also means the receiving adapter service should shut down when unable to publish messages to the intended end-point.

### Metric Creation
This adapter will create metrics on the fly in Boundary as metronic pushes metrics to it. This is a rather naive approach but avoids the need to predefine every metric in your system with Boundary in advance.

#### Namespace
> !!! IMPORTANT !!! Without a namespace, this plugin cannot guarantee unique metric names and may fail to create metrics (and therefore fail to post measures to Boundary).

There is no default for this setting - you must provide your own.


### Checking for Existing Metric Definitions
When the adapter starts, it requests a metric list from Boundary so that it does not change any existing metric definitions. The expectation is that you would be able to customize any metric created by this adapter after the fact.

### Metric Types
Since metronic supports custom types, you can specify Boundary friendly types (`duration`, `byteCount`, `number` and `percentage`). This adapter also attempts to map specific types to those and choose a sensible default based on the type:

| Metronic Type | Boundary Type | Aggregate |
|--------------:|:-------------:|-----------|
| `time`        | `duration`    | `avg`     |
| `meter`       | `number`      | `sum`     |
| `bytes`       | `byteCount`   | `sum`     |
| `percent`     | `percent`     | `avg`     |


## Configuration
The adapter requires two properties: your account e-mail and the API token to use. Without these, you'll get an exception and the adapter will shutdown the process.

If your metrics include a custom `prefix`, you'll need to set `hasPrefix` to `true` so that the adapter will know how to split up incoming keys into a `source` and `name`.

```javascript
{
	namespace: 'blah',
	email: 'me@self.com',
	token: 'thisismytoken',
	hasPrefix: true
}
```

## Use
This example shows how to configure this Boundary adapter for use with the RabbitMQ adapter on the subscriber side in order to create a service that publishes metrics off the queue to Boundary.

```javascript
var metronic = require( 'metronic' )();
// default values shown
var boundary = require( 'metronic-boundary' )(
	{
		namespace: 'blah',
		email: 'me@self.com',
		token: 'thisismytoken',
		hasPrefix: true
	}
);
metronic.use( boundary );

var config = { ... };
require( 'metronic-rabbit' )
	.subscriber( metronic, config );
```

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