Skip to content

Commit ef78b62

Browse files
committed
Add instrumentation
1 parent 920804b commit ef78b62

File tree

9 files changed

+716
-437
lines changed

9 files changed

+716
-437
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Container Well-being
22

3-
The package provides standard checks and probes for containers on Kubernetes.
3+
The package provides probes and metrics for containers on Kubernetes.
44

55
## Installation
66

@@ -11,7 +11,7 @@ npm install @thetypefounders/container-well-being --save
1111
## Usage
1212

1313
```javascript
14-
import { Status } from '@thetypefounders/container-well-being';
14+
import { Instrumentation, Status } from '@thetypefounders/container-well-being';
1515
import express from 'express';
1616

1717
const status = new Status({
@@ -25,8 +25,27 @@ const status = new Status({
2525
graceAfterSeconds: 80,
2626
});
2727

28+
const instrumentation = new Instrumentation({
29+
// The host to bind to.
30+
host: '0.0.0.0',
31+
// The port to listen to.
32+
port: 9090,
33+
// Whether to collect default metrics.
34+
collectDefaultMetrics: true,
35+
});
36+
37+
const counter = Instrumentation.Counter({
38+
name: 'example_counter',
39+
help: 'Example of a counter',
40+
});
41+
2842
const app = express();
2943

44+
app.get('/', (request, response) => {
45+
counter.inc();
46+
response.status(204).send();
47+
});
48+
3049
const server = app
3150
.listen(8080, '0.0.0.0', () => {
3251
status.start();

0 commit comments

Comments
 (0)