@emartech/aggregate-metric-logger 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ metricLogger.warn('etwas-went-wrong', { customer_id: 11 });
|
|
|
29
29
|
|
|
30
30
|
### Measure values
|
|
31
31
|
|
|
32
|
-
If you want aggregate
|
|
32
|
+
If you want aggregate measurements about something you need to simply call the `measure` method
|
|
33
33
|
for each value:
|
|
34
34
|
|
|
35
35
|
```js
|
|
@@ -44,16 +44,16 @@ for each measured tags. (Uses `@emartech/json-logger` behind the scenes for logg
|
|
|
44
44
|
|
|
45
45
|
### Measuring durations
|
|
46
46
|
|
|
47
|
-
For duration
|
|
47
|
+
For duration measurements, there are two convenient methods: `start`, and `stop`;
|
|
48
48
|
|
|
49
49
|
You start the measurement with `start`, the counted value for aggregation will be the duration
|
|
50
|
-
between this `start` and the
|
|
50
|
+
between this `start` and the matching `stop` call;
|
|
51
51
|
|
|
52
52
|
```js
|
|
53
53
|
function exampleIOHeavyFunction() {
|
|
54
|
-
const
|
|
54
|
+
const measurement = metricLogger.start('tag-for-the-measuement');
|
|
55
55
|
const result = db.findItems();
|
|
56
|
-
metricLogger.stop(
|
|
56
|
+
metricLogger.stop(measurement);
|
|
57
57
|
return result;
|
|
58
58
|
}
|
|
59
59
|
```
|
|
@@ -66,15 +66,15 @@ params in an object to `count` and `start` as the last optional argument:
|
|
|
66
66
|
```js
|
|
67
67
|
metricLogger.count('thing-to-count', 14, { customer_id: 12 });
|
|
68
68
|
|
|
69
|
-
const
|
|
69
|
+
const measurement = metricLogger.start(
|
|
70
70
|
'tag-for-the-measuement',
|
|
71
71
|
{ event_type: 'nyul', account: 3 }
|
|
72
72
|
);
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
A
|
|
76
|
-
and these extra params will appended to the log entry.
|
|
75
|
+
A separate log entry will be created for each seen value combinations seen in the extra params
|
|
76
|
+
and these extra params will be appended to the log entry.
|
|
77
77
|
|
|
78
|
-
Be very
|
|
79
|
-
If you include too many parameters, you could
|
|
78
|
+
Be very careful when using extra params, and only include information you really need.
|
|
79
|
+
If you include too many parameters, you could lose the advantage you gain by aggregating your logs
|
|
80
80
|
with this package.
|