@twin.org/telemetry-service 0.0.3-next.1 → 0.0.3-next.10
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 +1 -1
- package/dist/es/index.js +5 -2
- package/dist/es/index.js.map +1 -1
- package/dist/es/metricsCollectorService.js +114 -0
- package/dist/es/metricsCollectorService.js.map +1 -0
- package/dist/es/models/IMetricsCollectorServiceConfig.js +4 -0
- package/dist/es/models/IMetricsCollectorServiceConfig.js.map +1 -0
- package/dist/es/models/IMetricsCollectorServiceConstructorOptions.js +2 -0
- package/dist/es/models/IMetricsCollectorServiceConstructorOptions.js.map +1 -0
- package/dist/es/telemetryRoutes.js +1 -1
- package/dist/es/telemetryRoutes.js.map +1 -1
- package/dist/es/telemetryService.js.map +1 -1
- package/dist/types/index.d.ts +5 -2
- package/dist/types/metricsCollectorService.d.ts +38 -0
- package/dist/types/models/IMetricsCollectorServiceConfig.d.ts +10 -0
- package/dist/types/models/IMetricsCollectorServiceConstructorOptions.d.ts +15 -0
- package/dist/types/telemetryService.d.ts +2 -2
- package/docs/changelog.md +174 -33
- package/docs/examples.md +83 -1
- package/docs/open-api/spec.json +458 -56
- package/docs/reference/classes/MetricsCollectorService.md +98 -0
- package/docs/reference/classes/TelemetryService.md +11 -11
- package/docs/reference/index.md +3 -0
- package/docs/reference/interfaces/IMetricsCollectorServiceConfig.md +17 -0
- package/docs/reference/interfaces/IMetricsCollectorServiceConstructorOptions.md +25 -0
- package/docs/reference/interfaces/ITelemetryServiceConstructorOptions.md +2 -2
- package/locales/en.json +7 -1
- package/package.json +6 -5
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Class: MetricsCollectorService
|
|
2
|
+
|
|
3
|
+
Collects metrics from registered producers at a fixed interval.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IMetricsCollectorComponent`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new MetricsCollectorService**(`options?`): `MetricsCollectorService`
|
|
14
|
+
|
|
15
|
+
Create a new instance of MetricsCollectorService.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### options?
|
|
20
|
+
|
|
21
|
+
[`IMetricsCollectorServiceConstructorOptions`](../interfaces/IMetricsCollectorServiceConstructorOptions.md)
|
|
22
|
+
|
|
23
|
+
The options for the service.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`MetricsCollectorService`
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
### CLASS\_NAME {#class_name}
|
|
32
|
+
|
|
33
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
34
|
+
|
|
35
|
+
Runtime name for the class.
|
|
36
|
+
|
|
37
|
+
## Methods
|
|
38
|
+
|
|
39
|
+
### className() {#classname}
|
|
40
|
+
|
|
41
|
+
> **className**(): `string`
|
|
42
|
+
|
|
43
|
+
Returns the class name of the component.
|
|
44
|
+
|
|
45
|
+
#### Returns
|
|
46
|
+
|
|
47
|
+
`string`
|
|
48
|
+
|
|
49
|
+
The class name of the component.
|
|
50
|
+
|
|
51
|
+
#### Implementation of
|
|
52
|
+
|
|
53
|
+
`IMetricsCollectorComponent.className`
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### start() {#start}
|
|
58
|
+
|
|
59
|
+
> **start**(): `Promise`\<`void`\>
|
|
60
|
+
|
|
61
|
+
Start the service: register all producers and begin the polling cycle.
|
|
62
|
+
|
|
63
|
+
#### Returns
|
|
64
|
+
|
|
65
|
+
`Promise`\<`void`\>
|
|
66
|
+
|
|
67
|
+
#### Implementation of
|
|
68
|
+
|
|
69
|
+
`IMetricsCollectorComponent.start`
|
|
70
|
+
|
|
71
|
+
***
|
|
72
|
+
|
|
73
|
+
### stop() {#stop}
|
|
74
|
+
|
|
75
|
+
> **stop**(): `Promise`\<`void`\>
|
|
76
|
+
|
|
77
|
+
Stop the service and cancel the pending timer.
|
|
78
|
+
|
|
79
|
+
#### Returns
|
|
80
|
+
|
|
81
|
+
`Promise`\<`void`\>
|
|
82
|
+
|
|
83
|
+
#### Implementation of
|
|
84
|
+
|
|
85
|
+
`IMetricsCollectorComponent.stop`
|
|
86
|
+
|
|
87
|
+
***
|
|
88
|
+
|
|
89
|
+
### tick() {#tick}
|
|
90
|
+
|
|
91
|
+
> **tick**(): `Promise`\<`void`\>
|
|
92
|
+
|
|
93
|
+
One collection cycle across all registered producers.
|
|
94
|
+
Public so tests can drive it deterministically.
|
|
95
|
+
|
|
96
|
+
#### Returns
|
|
97
|
+
|
|
98
|
+
`Promise`\<`void`\>
|
|
@@ -28,7 +28,7 @@ The options for the connector.
|
|
|
28
28
|
|
|
29
29
|
## Properties
|
|
30
30
|
|
|
31
|
-
### CLASS\_NAME
|
|
31
|
+
### CLASS\_NAME {#class_name}
|
|
32
32
|
|
|
33
33
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ Runtime name for the class.
|
|
|
36
36
|
|
|
37
37
|
## Methods
|
|
38
38
|
|
|
39
|
-
### className()
|
|
39
|
+
### className() {#classname}
|
|
40
40
|
|
|
41
41
|
> **className**(): `string`
|
|
42
42
|
|
|
@@ -54,7 +54,7 @@ The class name of the component.
|
|
|
54
54
|
|
|
55
55
|
***
|
|
56
56
|
|
|
57
|
-
### createMetric()
|
|
57
|
+
### createMetric() {#createmetric}
|
|
58
58
|
|
|
59
59
|
> **createMetric**(`metric`): `Promise`\<`void`\>
|
|
60
60
|
|
|
@@ -80,7 +80,7 @@ Nothing.
|
|
|
80
80
|
|
|
81
81
|
***
|
|
82
82
|
|
|
83
|
-
### getMetric()
|
|
83
|
+
### getMetric() {#getmetric}
|
|
84
84
|
|
|
85
85
|
> **getMetric**(`id`): `Promise`\<\{ `metric`: `ITelemetryMetric`; `value`: `ITelemetryMetricValue`; \}\>
|
|
86
86
|
|
|
@@ -106,7 +106,7 @@ The metric details and it's most recent value.
|
|
|
106
106
|
|
|
107
107
|
***
|
|
108
108
|
|
|
109
|
-
### updateMetric()
|
|
109
|
+
### updateMetric() {#updatemetric}
|
|
110
110
|
|
|
111
111
|
> **updateMetric**(`metric`): `Promise`\<`void`\>
|
|
112
112
|
|
|
@@ -132,7 +132,7 @@ Nothing.
|
|
|
132
132
|
|
|
133
133
|
***
|
|
134
134
|
|
|
135
|
-
### addMetricValue()
|
|
135
|
+
### addMetricValue() {#addmetricvalue}
|
|
136
136
|
|
|
137
137
|
> **addMetricValue**(`id`, `value`, `customData?`): `Promise`\<`string`\>
|
|
138
138
|
|
|
@@ -148,9 +148,9 @@ The id of the metric.
|
|
|
148
148
|
|
|
149
149
|
##### value
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
`number` \| `MetricCounterOperation`
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
The value for the add operation.
|
|
154
154
|
|
|
155
155
|
##### customData?
|
|
156
156
|
|
|
@@ -168,7 +168,7 @@ The created metric value id.
|
|
|
168
168
|
|
|
169
169
|
***
|
|
170
170
|
|
|
171
|
-
### removeMetric()
|
|
171
|
+
### removeMetric() {#removemetric}
|
|
172
172
|
|
|
173
173
|
> **removeMetric**(`id`): `Promise`\<`void`\>
|
|
174
174
|
|
|
@@ -194,7 +194,7 @@ Nothing.
|
|
|
194
194
|
|
|
195
195
|
***
|
|
196
196
|
|
|
197
|
-
### query()
|
|
197
|
+
### query() {#query}
|
|
198
198
|
|
|
199
199
|
> **query**(`type?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `ITelemetryMetric`[]; `cursor?`: `string`; \}\>
|
|
200
200
|
|
|
@@ -237,7 +237,7 @@ NotImplementedError if the implementation does not support retrieval.
|
|
|
237
237
|
|
|
238
238
|
***
|
|
239
239
|
|
|
240
|
-
### queryValues()
|
|
240
|
+
### queryValues() {#queryvalues}
|
|
241
241
|
|
|
242
242
|
> **queryValues**(`id`, `timeStart?`, `timeEnd?`, `cursor?`, `limit?`): `Promise`\<\{ `metric`: `ITelemetryMetric`; `entities`: `ITelemetryMetricValue`[]; `cursor?`: `string`; \}\>
|
|
243
243
|
|
package/docs/reference/index.md
CHANGED
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Classes
|
|
4
4
|
|
|
5
|
+
- [MetricsCollectorService](classes/MetricsCollectorService.md)
|
|
5
6
|
- [TelemetryService](classes/TelemetryService.md)
|
|
6
7
|
|
|
7
8
|
## Interfaces
|
|
8
9
|
|
|
10
|
+
- [IMetricsCollectorServiceConfig](interfaces/IMetricsCollectorServiceConfig.md)
|
|
11
|
+
- [IMetricsCollectorServiceConstructorOptions](interfaces/IMetricsCollectorServiceConstructorOptions.md)
|
|
9
12
|
- [ITelemetryServiceConstructorOptions](interfaces/ITelemetryServiceConstructorOptions.md)
|
|
10
13
|
|
|
11
14
|
## Variables
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: IMetricsCollectorServiceConfig
|
|
2
|
+
|
|
3
|
+
The options for the metrics collector service config.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### intervalMs? {#intervalms}
|
|
8
|
+
|
|
9
|
+
> `optional` **intervalMs?**: `number`
|
|
10
|
+
|
|
11
|
+
Polling interval in milliseconds.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
60000
|
|
17
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Interface: IMetricsCollectorServiceConstructorOptions
|
|
2
|
+
|
|
3
|
+
The options for the metrics collector service constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### loggingComponentType? {#loggingcomponenttype}
|
|
8
|
+
|
|
9
|
+
> `optional` **loggingComponentType?**: `string`
|
|
10
|
+
|
|
11
|
+
The type of the logging component to use.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
logging
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### config? {#config}
|
|
22
|
+
|
|
23
|
+
> `optional` **config?**: [`IMetricsCollectorServiceConfig`](IMetricsCollectorServiceConfig.md)
|
|
24
|
+
|
|
25
|
+
The configuration options for the metrics collector service.
|
|
@@ -4,9 +4,9 @@ The options for the telemetry service constructor.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### telemetryConnectorType?
|
|
7
|
+
### telemetryConnectorType? {#telemetryconnectortype}
|
|
8
8
|
|
|
9
|
-
> `optional` **telemetryConnectorType
|
|
9
|
+
> `optional` **telemetryConnectorType?**: `string`
|
|
10
10
|
|
|
11
11
|
The type of the telemetry connector to use.
|
|
12
12
|
|
package/locales/en.json
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/telemetry-service",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "Telemetry
|
|
3
|
+
"version": "0.0.3-next.10",
|
|
4
|
+
"description": "Telemetry service implementation with REST entry points.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/iotaledger/telemetry.git",
|
|
8
8
|
"directory": "packages/telemetry-service"
|
|
9
9
|
},
|
|
10
10
|
"author": "martyn.janes@iota.org",
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
"@twin.org/api-models": "next",
|
|
18
18
|
"@twin.org/core": "next",
|
|
19
19
|
"@twin.org/entity": "next",
|
|
20
|
+
"@twin.org/logging-models": "next",
|
|
20
21
|
"@twin.org/nameof": "next",
|
|
21
|
-
"@twin.org/telemetry-models": "0.0.3-next.
|
|
22
|
+
"@twin.org/telemetry-models": "0.0.3-next.10",
|
|
22
23
|
"@twin.org/web": "next"
|
|
23
24
|
},
|
|
24
25
|
"main": "./dist/es/index.js",
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
"business-logic"
|
|
50
51
|
],
|
|
51
52
|
"bugs": {
|
|
52
|
-
"url": "git+https://github.com/
|
|
53
|
+
"url": "git+https://github.com/iotaledger/telemetry/issues"
|
|
53
54
|
},
|
|
54
55
|
"homepage": "https://twindev.org"
|
|
55
56
|
}
|