@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
package/docs/changelog.md
CHANGED
|
@@ -1,24 +1,165 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.0.3-next.
|
|
3
|
+
## [0.0.3-next.10](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.3-next.9...telemetry-service-v0.0.3-next.10) (2026-05-20)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **telemetry-service:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/telemetry-models bumped from 0.0.3-next.9 to 0.0.3-next.10
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.9](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.3-next.8...telemetry-service-v0.0.3-next.9) (2026-05-20)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add helper and command types ([7166013](https://github.com/iotaledger/twin-telemetry/commit/7166013f8a0693a1d92101cb600c37a1aba66417))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/telemetry-models bumped from 0.0.3-next.8 to 0.0.3-next.9
|
|
30
|
+
|
|
31
|
+
## [0.0.3-next.8](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.3-next.7...telemetry-service-v0.0.3-next.8) (2026-05-19)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Miscellaneous Chores
|
|
35
|
+
|
|
36
|
+
* **telemetry-service:** Synchronize repo versions
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Dependencies
|
|
40
|
+
|
|
41
|
+
* The following workspace dependencies were updated
|
|
42
|
+
* dependencies
|
|
43
|
+
* @twin.org/telemetry-models bumped from 0.0.3-next.7 to 0.0.3-next.8
|
|
44
|
+
|
|
45
|
+
## [0.0.3-next.7](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.3-next.6...telemetry-service-v0.0.3-next.7) (2026-05-19)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
* add metrics producer infrastructure ([#30](https://github.com/iotaledger/twin-telemetry/issues/30)) ([8990b99](https://github.com/iotaledger/twin-telemetry/commit/8990b990d22f331d44562c2781c9b6ddf846db88))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Dependencies
|
|
54
|
+
|
|
55
|
+
* The following workspace dependencies were updated
|
|
56
|
+
* dependencies
|
|
57
|
+
* @twin.org/telemetry-models bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
58
|
+
|
|
59
|
+
## [0.0.3-next.6](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.3-next.5...telemetry-service-v0.0.3-next.6) (2026-05-11)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Miscellaneous Chores
|
|
63
|
+
|
|
64
|
+
* **telemetry-service:** Synchronize repo versions
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Dependencies
|
|
68
|
+
|
|
69
|
+
* The following workspace dependencies were updated
|
|
70
|
+
* dependencies
|
|
71
|
+
* @twin.org/telemetry-models bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
72
|
+
|
|
73
|
+
## [0.0.3-next.5](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.3-next.4...telemetry-service-v0.0.3-next.5) (2026-05-11)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Features
|
|
77
|
+
|
|
78
|
+
* add context id features ([#19](https://github.com/iotaledger/twin-telemetry/issues/19)) ([5942442](https://github.com/iotaledger/twin-telemetry/commit/5942442991fa7ad7afa9d8b7c4583326a8c4c9ae))
|
|
79
|
+
* add validate-locales ([24ed804](https://github.com/iotaledger/twin-telemetry/commit/24ed804f7ebc47036f323722bc18452729860c92))
|
|
80
|
+
* eslint migration to flat config ([69ac91a](https://github.com/iotaledger/twin-telemetry/commit/69ac91a89d0b5bc63374a0bd314f770b557dabb4))
|
|
81
|
+
* remove unused namespace ([54939fa](https://github.com/iotaledger/twin-telemetry/commit/54939faac3790dc1b51aa96a54005a03c99f98da))
|
|
82
|
+
* remove unused namespace ([02dcabb](https://github.com/iotaledger/twin-telemetry/commit/02dcabbe00f5b03d5e4b2c12e655efac50409acf))
|
|
83
|
+
* typescript 6 update ([0acecc2](https://github.com/iotaledger/twin-telemetry/commit/0acecc2692b174fbaec6a8a89bd9277fa3530b5f))
|
|
84
|
+
* update dependencies ([0e55c48](https://github.com/iotaledger/twin-telemetry/commit/0e55c48de4139c6fe66b823101ca17973e60847c))
|
|
85
|
+
* update framework core ([4b10bcd](https://github.com/iotaledger/twin-telemetry/commit/4b10bcd4d3101151671bdcf9aef7c54f5937fc2a))
|
|
86
|
+
* use shared store mechanism ([#7](https://github.com/iotaledger/twin-telemetry/issues/7)) ([806fe2c](https://github.com/iotaledger/twin-telemetry/commit/806fe2c2b7653d6b949c27ebf57bd13c3e040242))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Bug Fixes
|
|
90
|
+
|
|
91
|
+
* api data types ([2edc5ac](https://github.com/iotaledger/twin-telemetry/commit/2edc5ac665b996a1b29173cac3b389fa3ceafa34))
|
|
92
|
+
* query params force coercion ([ec7999e](https://github.com/iotaledger/twin-telemetry/commit/ec7999eadb66c65585efa19f3ce4cabb50eed761))
|
|
93
|
+
* Update metric endpoint paths by removing trailing slashes and query type as string ([#3](https://github.com/iotaledger/twin-telemetry/issues/3)) ([b386ca5](https://github.com/iotaledger/twin-telemetry/commit/b386ca55404aa933ad8917f82a7f0e588593fcc8))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Dependencies
|
|
97
|
+
|
|
98
|
+
* The following workspace dependencies were updated
|
|
99
|
+
* dependencies
|
|
100
|
+
* @twin.org/telemetry-models bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
101
|
+
|
|
102
|
+
## [0.0.3-next.4](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.3-next.3...telemetry-service-v0.0.3-next.4) (2026-05-11)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Features
|
|
106
|
+
|
|
107
|
+
* typescript 6 update ([0acecc2](https://github.com/iotaledger/twin-telemetry/commit/0acecc2692b174fbaec6a8a89bd9277fa3530b5f))
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### Dependencies
|
|
111
|
+
|
|
112
|
+
* The following workspace dependencies were updated
|
|
113
|
+
* dependencies
|
|
114
|
+
* @twin.org/telemetry-models bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
115
|
+
|
|
116
|
+
## [0.0.3-next.3](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.3-next.2...telemetry-service-v0.0.3-next.3) (2026-05-06)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
### Miscellaneous Chores
|
|
120
|
+
|
|
121
|
+
* **telemetry-service:** Synchronize repo versions
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### Dependencies
|
|
125
|
+
|
|
126
|
+
* The following workspace dependencies were updated
|
|
127
|
+
* dependencies
|
|
128
|
+
* @twin.org/telemetry-models bumped from 0.0.3-next.2 to 0.0.3-next.3
|
|
129
|
+
|
|
130
|
+
## [0.0.3-next.2](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.3-next.1...telemetry-service-v0.0.3-next.2) (2026-03-02)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
### Bug Fixes
|
|
134
|
+
|
|
135
|
+
* api data types ([2edc5ac](https://github.com/iotaledger/twin-telemetry/commit/2edc5ac665b996a1b29173cac3b389fa3ceafa34))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
### Dependencies
|
|
139
|
+
|
|
140
|
+
* The following workspace dependencies were updated
|
|
141
|
+
* dependencies
|
|
142
|
+
* @twin.org/telemetry-models bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
143
|
+
|
|
144
|
+
## [0.0.3-next.1](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.3-next.0...telemetry-service-v0.0.3-next.1) (2025-11-11)
|
|
4
145
|
|
|
5
146
|
|
|
6
147
|
### Features
|
|
7
148
|
|
|
8
|
-
* add context id features ([#19](https://github.com/
|
|
9
|
-
* add validate-locales ([24ed804](https://github.com/
|
|
10
|
-
* eslint migration to flat config ([69ac91a](https://github.com/
|
|
11
|
-
* remove unused namespace ([54939fa](https://github.com/
|
|
12
|
-
* remove unused namespace ([02dcabb](https://github.com/
|
|
13
|
-
* update dependencies ([0e55c48](https://github.com/
|
|
14
|
-
* update framework core ([4b10bcd](https://github.com/
|
|
15
|
-
* use shared store mechanism ([#7](https://github.com/
|
|
149
|
+
* add context id features ([#19](https://github.com/iotaledger/twin-telemetry/issues/19)) ([5942442](https://github.com/iotaledger/twin-telemetry/commit/5942442991fa7ad7afa9d8b7c4583326a8c4c9ae))
|
|
150
|
+
* add validate-locales ([24ed804](https://github.com/iotaledger/twin-telemetry/commit/24ed804f7ebc47036f323722bc18452729860c92))
|
|
151
|
+
* eslint migration to flat config ([69ac91a](https://github.com/iotaledger/twin-telemetry/commit/69ac91a89d0b5bc63374a0bd314f770b557dabb4))
|
|
152
|
+
* remove unused namespace ([54939fa](https://github.com/iotaledger/twin-telemetry/commit/54939faac3790dc1b51aa96a54005a03c99f98da))
|
|
153
|
+
* remove unused namespace ([02dcabb](https://github.com/iotaledger/twin-telemetry/commit/02dcabbe00f5b03d5e4b2c12e655efac50409acf))
|
|
154
|
+
* update dependencies ([0e55c48](https://github.com/iotaledger/twin-telemetry/commit/0e55c48de4139c6fe66b823101ca17973e60847c))
|
|
155
|
+
* update framework core ([4b10bcd](https://github.com/iotaledger/twin-telemetry/commit/4b10bcd4d3101151671bdcf9aef7c54f5937fc2a))
|
|
156
|
+
* use shared store mechanism ([#7](https://github.com/iotaledger/twin-telemetry/issues/7)) ([806fe2c](https://github.com/iotaledger/twin-telemetry/commit/806fe2c2b7653d6b949c27ebf57bd13c3e040242))
|
|
16
157
|
|
|
17
158
|
|
|
18
159
|
### Bug Fixes
|
|
19
160
|
|
|
20
|
-
* query params force coercion ([ec7999e](https://github.com/
|
|
21
|
-
* Update metric endpoint paths by removing trailing slashes and query type as string ([#3](https://github.com/
|
|
161
|
+
* query params force coercion ([ec7999e](https://github.com/iotaledger/twin-telemetry/commit/ec7999eadb66c65585efa19f3ce4cabb50eed761))
|
|
162
|
+
* Update metric endpoint paths by removing trailing slashes and query type as string ([#3](https://github.com/iotaledger/twin-telemetry/issues/3)) ([b386ca5](https://github.com/iotaledger/twin-telemetry/commit/b386ca55404aa933ad8917f82a7f0e588593fcc8))
|
|
22
163
|
|
|
23
164
|
|
|
24
165
|
### Dependencies
|
|
@@ -27,12 +168,12 @@
|
|
|
27
168
|
* dependencies
|
|
28
169
|
* @twin.org/telemetry-models bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
29
170
|
|
|
30
|
-
## [0.0.2-next.3](https://github.com/
|
|
171
|
+
## [0.0.2-next.3](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.2-next.2...telemetry-service-v0.0.2-next.3) (2025-10-09)
|
|
31
172
|
|
|
32
173
|
|
|
33
174
|
### Features
|
|
34
175
|
|
|
35
|
-
* add validate-locales ([24ed804](https://github.com/
|
|
176
|
+
* add validate-locales ([24ed804](https://github.com/iotaledger/twin-telemetry/commit/24ed804f7ebc47036f323722bc18452729860c92))
|
|
36
177
|
|
|
37
178
|
|
|
38
179
|
### Dependencies
|
|
@@ -41,12 +182,12 @@
|
|
|
41
182
|
* dependencies
|
|
42
183
|
* @twin.org/telemetry-models bumped from 0.0.2-next.2 to 0.0.2-next.3
|
|
43
184
|
|
|
44
|
-
## [0.0.2-next.2](https://github.com/
|
|
185
|
+
## [0.0.2-next.2](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.2-next.1...telemetry-service-v0.0.2-next.2) (2025-08-29)
|
|
45
186
|
|
|
46
187
|
|
|
47
188
|
### Features
|
|
48
189
|
|
|
49
|
-
* eslint migration to flat config ([69ac91a](https://github.com/
|
|
190
|
+
* eslint migration to flat config ([69ac91a](https://github.com/iotaledger/twin-telemetry/commit/69ac91a89d0b5bc63374a0bd314f770b557dabb4))
|
|
50
191
|
|
|
51
192
|
|
|
52
193
|
### Dependencies
|
|
@@ -55,22 +196,22 @@
|
|
|
55
196
|
* dependencies
|
|
56
197
|
* @twin.org/telemetry-models bumped from 0.0.2-next.1 to 0.0.2-next.2
|
|
57
198
|
|
|
58
|
-
## [0.0.2-next.1](https://github.com/
|
|
199
|
+
## [0.0.2-next.1](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.2-next.0...telemetry-service-v0.0.2-next.1) (2025-08-20)
|
|
59
200
|
|
|
60
201
|
|
|
61
202
|
### Features
|
|
62
203
|
|
|
63
|
-
* remove unused namespace ([54939fa](https://github.com/
|
|
64
|
-
* remove unused namespace ([02dcabb](https://github.com/
|
|
65
|
-
* update dependencies ([0e55c48](https://github.com/
|
|
66
|
-
* update framework core ([4b10bcd](https://github.com/
|
|
67
|
-
* use shared store mechanism ([#7](https://github.com/
|
|
204
|
+
* remove unused namespace ([54939fa](https://github.com/iotaledger/twin-telemetry/commit/54939faac3790dc1b51aa96a54005a03c99f98da))
|
|
205
|
+
* remove unused namespace ([02dcabb](https://github.com/iotaledger/twin-telemetry/commit/02dcabbe00f5b03d5e4b2c12e655efac50409acf))
|
|
206
|
+
* update dependencies ([0e55c48](https://github.com/iotaledger/twin-telemetry/commit/0e55c48de4139c6fe66b823101ca17973e60847c))
|
|
207
|
+
* update framework core ([4b10bcd](https://github.com/iotaledger/twin-telemetry/commit/4b10bcd4d3101151671bdcf9aef7c54f5937fc2a))
|
|
208
|
+
* use shared store mechanism ([#7](https://github.com/iotaledger/twin-telemetry/issues/7)) ([806fe2c](https://github.com/iotaledger/twin-telemetry/commit/806fe2c2b7653d6b949c27ebf57bd13c3e040242))
|
|
68
209
|
|
|
69
210
|
|
|
70
211
|
### Bug Fixes
|
|
71
212
|
|
|
72
|
-
* query params force coercion ([ec7999e](https://github.com/
|
|
73
|
-
* Update metric endpoint paths by removing trailing slashes and query type as string ([#3](https://github.com/
|
|
213
|
+
* query params force coercion ([ec7999e](https://github.com/iotaledger/twin-telemetry/commit/ec7999eadb66c65585efa19f3ce4cabb50eed761))
|
|
214
|
+
* Update metric endpoint paths by removing trailing slashes and query type as string ([#3](https://github.com/iotaledger/twin-telemetry/issues/3)) ([b386ca5](https://github.com/iotaledger/twin-telemetry/commit/b386ca55404aa933ad8917f82a7f0e588593fcc8))
|
|
74
215
|
|
|
75
216
|
|
|
76
217
|
### Dependencies
|
|
@@ -84,7 +225,7 @@
|
|
|
84
225
|
|
|
85
226
|
### Features
|
|
86
227
|
|
|
87
|
-
* release to production ([df2151d](https://github.com/
|
|
228
|
+
* release to production ([df2151d](https://github.com/iotaledger/twin-telemetry/commit/df2151d24844fd2c3e6092ce3a6f888ac16219a0))
|
|
88
229
|
|
|
89
230
|
|
|
90
231
|
### Dependencies
|
|
@@ -93,12 +234,12 @@
|
|
|
93
234
|
* dependencies
|
|
94
235
|
* @twin.org/telemetry-models bumped from ^0.0.0 to ^0.0.1
|
|
95
236
|
|
|
96
|
-
## [0.0.1-next.18](https://github.com/
|
|
237
|
+
## [0.0.1-next.18](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.1-next.17...telemetry-service-v0.0.1-next.18) (2025-06-20)
|
|
97
238
|
|
|
98
239
|
|
|
99
240
|
### Bug Fixes
|
|
100
241
|
|
|
101
|
-
* query params force coercion ([ec7999e](https://github.com/
|
|
242
|
+
* query params force coercion ([ec7999e](https://github.com/iotaledger/twin-telemetry/commit/ec7999eadb66c65585efa19f3ce4cabb50eed761))
|
|
102
243
|
|
|
103
244
|
|
|
104
245
|
### Dependencies
|
|
@@ -107,12 +248,12 @@
|
|
|
107
248
|
* dependencies
|
|
108
249
|
* @twin.org/telemetry-models bumped from 0.0.1-next.17 to 0.0.1-next.18
|
|
109
250
|
|
|
110
|
-
## [0.0.1-next.17](https://github.com/
|
|
251
|
+
## [0.0.1-next.17](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.1-next.16...telemetry-service-v0.0.1-next.17) (2025-06-12)
|
|
111
252
|
|
|
112
253
|
|
|
113
254
|
### Features
|
|
114
255
|
|
|
115
|
-
* update dependencies ([0e55c48](https://github.com/
|
|
256
|
+
* update dependencies ([0e55c48](https://github.com/iotaledger/twin-telemetry/commit/0e55c48de4139c6fe66b823101ca17973e60847c))
|
|
116
257
|
|
|
117
258
|
|
|
118
259
|
### Dependencies
|
|
@@ -121,12 +262,12 @@
|
|
|
121
262
|
* dependencies
|
|
122
263
|
* @twin.org/telemetry-models bumped from 0.0.1-next.16 to 0.0.1-next.17
|
|
123
264
|
|
|
124
|
-
## [0.0.1-next.16](https://github.com/
|
|
265
|
+
## [0.0.1-next.16](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.1-next.15...telemetry-service-v0.0.1-next.16) (2025-04-17)
|
|
125
266
|
|
|
126
267
|
|
|
127
268
|
### Features
|
|
128
269
|
|
|
129
|
-
* use shared store mechanism ([#7](https://github.com/
|
|
270
|
+
* use shared store mechanism ([#7](https://github.com/iotaledger/twin-telemetry/issues/7)) ([806fe2c](https://github.com/iotaledger/twin-telemetry/commit/806fe2c2b7653d6b949c27ebf57bd13c3e040242))
|
|
130
271
|
|
|
131
272
|
|
|
132
273
|
### Dependencies
|
|
@@ -135,12 +276,12 @@
|
|
|
135
276
|
* dependencies
|
|
136
277
|
* @twin.org/telemetry-models bumped from 0.0.1-next.15 to 0.0.1-next.16
|
|
137
278
|
|
|
138
|
-
## [0.0.1-next.15](https://github.com/
|
|
279
|
+
## [0.0.1-next.15](https://github.com/iotaledger/twin-telemetry/compare/telemetry-service-v0.0.1-next.14...telemetry-service-v0.0.1-next.15) (2025-03-28)
|
|
139
280
|
|
|
140
281
|
|
|
141
282
|
### Bug Fixes
|
|
142
283
|
|
|
143
|
-
* Update metric endpoint paths by removing trailing slashes and query type as string ([#3](https://github.com/
|
|
284
|
+
* Update metric endpoint paths by removing trailing slashes and query type as string ([#3](https://github.com/iotaledger/twin-telemetry/issues/3)) ([b386ca5](https://github.com/iotaledger/twin-telemetry/commit/b386ca55404aa933ad8917f82a7f0e588593fcc8))
|
|
144
285
|
|
|
145
286
|
|
|
146
287
|
### Dependencies
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,83 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Telemetry Service Examples
|
|
2
|
+
|
|
3
|
+
These examples show how to wire a service to a registered connector and expose telemetry operations in your application layer.
|
|
4
|
+
|
|
5
|
+
## TelemetryService
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import {
|
|
9
|
+
MetricType,
|
|
10
|
+
SilentTelemetryConnector,
|
|
11
|
+
TelemetryConnectorFactory
|
|
12
|
+
} from '@twin.org/telemetry-models';
|
|
13
|
+
import { TelemetryService } from '@twin.org/telemetry-service';
|
|
14
|
+
|
|
15
|
+
TelemetryConnectorFactory.register('silent', () => new SilentTelemetryConnector());
|
|
16
|
+
|
|
17
|
+
const service = new TelemetryService({
|
|
18
|
+
telemetryConnectorType: 'silent'
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
console.log(service.className()); // telemetryService
|
|
22
|
+
|
|
23
|
+
await service.createMetric({
|
|
24
|
+
id: 'requests-per-minute',
|
|
25
|
+
label: 'Requests Per Minute',
|
|
26
|
+
description: 'Request throughput sampled once per minute',
|
|
27
|
+
unit: 'rpm',
|
|
28
|
+
type: MetricType.Gauge
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
await service.updateMetric({
|
|
32
|
+
id: 'requests-per-minute',
|
|
33
|
+
label: 'RPM',
|
|
34
|
+
description: 'Request throughput',
|
|
35
|
+
unit: 'rpm'
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const valueId = await service.addMetricValue('requests-per-minute', 118.7, {
|
|
39
|
+
region: 'eu-west-1'
|
|
40
|
+
});
|
|
41
|
+
console.log(valueId.length === 0); // true
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import {
|
|
46
|
+
MetricType,
|
|
47
|
+
SilentTelemetryConnector,
|
|
48
|
+
TelemetryConnectorFactory
|
|
49
|
+
} from '@twin.org/telemetry-models';
|
|
50
|
+
import { TelemetryService } from '@twin.org/telemetry-service';
|
|
51
|
+
|
|
52
|
+
TelemetryConnectorFactory.register('silent', () => new SilentTelemetryConnector());
|
|
53
|
+
|
|
54
|
+
const service = new TelemetryService({ telemetryConnectorType: 'silent' });
|
|
55
|
+
|
|
56
|
+
const metric = await service.getMetric('requests-per-minute');
|
|
57
|
+
console.log(metric.metric.id); // requests-per-minute
|
|
58
|
+
|
|
59
|
+
const metricPage = await service.query(MetricType.Gauge, undefined, 100);
|
|
60
|
+
console.log(metricPage.entities.length); // 1
|
|
61
|
+
|
|
62
|
+
const valuePage = await service.queryValues(
|
|
63
|
+
'requests-per-minute',
|
|
64
|
+
Date.now() - 3_600_000,
|
|
65
|
+
Date.now(),
|
|
66
|
+
undefined,
|
|
67
|
+
60
|
|
68
|
+
);
|
|
69
|
+
console.log(valuePage.entities.length); // 60
|
|
70
|
+
|
|
71
|
+
await service.removeMetric('requests-per-minute');
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## generateRestRoutesTelemetry
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { generateRestRoutesTelemetry } from '@twin.org/telemetry-service';
|
|
78
|
+
|
|
79
|
+
const routes = generateRestRoutesTelemetry('/api', 'telemetry');
|
|
80
|
+
|
|
81
|
+
console.log(routes.length); // 7
|
|
82
|
+
console.log(routes[0].operationId); // telemetryCreateMetric
|
|
83
|
+
```
|