@twin.org/telemetry-service 0.0.2-next.3 → 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.
Files changed (34) hide show
  1. package/README.md +1 -1
  2. package/dist/es/index.js +10 -0
  3. package/dist/es/index.js.map +1 -0
  4. package/dist/es/metricsCollectorService.js +114 -0
  5. package/dist/es/metricsCollectorService.js.map +1 -0
  6. package/dist/es/models/IMetricsCollectorServiceConfig.js +4 -0
  7. package/dist/es/models/IMetricsCollectorServiceConfig.js.map +1 -0
  8. package/dist/es/models/IMetricsCollectorServiceConstructorOptions.js +2 -0
  9. package/dist/es/models/IMetricsCollectorServiceConstructorOptions.js.map +1 -0
  10. package/dist/es/models/ITelemetryServiceConstructorOptions.js +4 -0
  11. package/dist/es/models/ITelemetryServiceConstructorOptions.js.map +1 -0
  12. package/dist/es/restEntryPoints.js +10 -0
  13. package/dist/es/restEntryPoints.js.map +1 -0
  14. package/dist/{esm/index.mjs → es/telemetryRoutes.js} +14 -125
  15. package/dist/es/telemetryRoutes.js.map +1 -0
  16. package/dist/es/telemetryService.js +109 -0
  17. package/dist/es/telemetryService.js.map +1 -0
  18. package/dist/types/index.d.ts +7 -4
  19. package/dist/types/metricsCollectorService.d.ts +38 -0
  20. package/dist/types/models/IMetricsCollectorServiceConfig.d.ts +10 -0
  21. package/dist/types/models/IMetricsCollectorServiceConstructorOptions.d.ts +15 -0
  22. package/dist/types/telemetryService.d.ts +8 -3
  23. package/docs/changelog.md +190 -22
  24. package/docs/examples.md +83 -1
  25. package/docs/open-api/spec.json +40 -50
  26. package/docs/reference/classes/MetricsCollectorService.md +98 -0
  27. package/docs/reference/classes/TelemetryService.md +28 -10
  28. package/docs/reference/index.md +3 -0
  29. package/docs/reference/interfaces/IMetricsCollectorServiceConfig.md +17 -0
  30. package/docs/reference/interfaces/IMetricsCollectorServiceConstructorOptions.md +25 -0
  31. package/docs/reference/interfaces/ITelemetryServiceConstructorOptions.md +2 -2
  32. package/locales/en.json +7 -1
  33. package/package.json +10 -11
  34. package/dist/cjs/index.cjs +0 -582
@@ -0,0 +1,38 @@
1
+ import { type IMetricsCollectorComponent } from "@twin.org/telemetry-models";
2
+ import type { IMetricsCollectorServiceConstructorOptions } from "./models/IMetricsCollectorServiceConstructorOptions.js";
3
+ /**
4
+ * Collects metrics from registered producers at a fixed interval.
5
+ */
6
+ export declare class MetricsCollectorService implements IMetricsCollectorComponent {
7
+ /**
8
+ * Runtime name for the class.
9
+ */
10
+ static readonly CLASS_NAME: string;
11
+ /**
12
+ * Resolved logging component for internal use.
13
+ */
14
+ private readonly _loggingComponent?;
15
+ /**
16
+ * Create a new instance of MetricsCollectorService.
17
+ * @param options The options for the service.
18
+ */
19
+ constructor(options?: IMetricsCollectorServiceConstructorOptions);
20
+ /**
21
+ * Returns the class name of the component.
22
+ * @returns The class name of the component.
23
+ */
24
+ className(): string;
25
+ /**
26
+ * Start the service: register all producers and begin the polling cycle.
27
+ */
28
+ start(): Promise<void>;
29
+ /**
30
+ * Stop the service and cancel the pending timer.
31
+ */
32
+ stop(): Promise<void>;
33
+ /**
34
+ * One collection cycle across all registered producers.
35
+ * Public so tests can drive it deterministically.
36
+ */
37
+ tick(): Promise<void>;
38
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The options for the metrics collector service config.
3
+ */
4
+ export interface IMetricsCollectorServiceConfig {
5
+ /**
6
+ * Polling interval in milliseconds.
7
+ * @default 60000
8
+ */
9
+ intervalMs?: number;
10
+ }
@@ -0,0 +1,15 @@
1
+ import type { IMetricsCollectorServiceConfig } from "./IMetricsCollectorServiceConfig.js";
2
+ /**
3
+ * The options for the metrics collector service constructor.
4
+ */
5
+ export interface IMetricsCollectorServiceConstructorOptions {
6
+ /**
7
+ * The type of the logging component to use.
8
+ * @default logging
9
+ */
10
+ loggingComponentType?: string;
11
+ /**
12
+ * The configuration options for the metrics collector service.
13
+ */
14
+ config?: IMetricsCollectorServiceConfig;
15
+ }
@@ -1,5 +1,5 @@
1
- import { type ITelemetryComponent, type ITelemetryMetric, type ITelemetryMetricValue, type MetricType } from "@twin.org/telemetry-models";
2
- import type { ITelemetryServiceConstructorOptions } from "./models/ITelemetryServiceConstructorOptions";
1
+ import { type ITelemetryComponent, type ITelemetryMetric, type ITelemetryMetricValue, type MetricCounterOperation, type MetricType } from "@twin.org/telemetry-models";
2
+ import type { ITelemetryServiceConstructorOptions } from "./models/ITelemetryServiceConstructorOptions.js";
3
3
  /**
4
4
  * Service for performing telemetry operations to a connector.
5
5
  */
@@ -13,6 +13,11 @@ export declare class TelemetryService implements ITelemetryComponent {
13
13
  * @param options The options for the connector.
14
14
  */
15
15
  constructor(options?: ITelemetryServiceConstructorOptions);
16
+ /**
17
+ * Returns the class name of the component.
18
+ * @returns The class name of the component.
19
+ */
20
+ className(): string;
16
21
  /**
17
22
  * Create a new metric.
18
23
  * @param metric The metric details.
@@ -41,7 +46,7 @@ export declare class TelemetryService implements ITelemetryComponent {
41
46
  * @param customData The custom data for the add operation.
42
47
  * @returns The created metric value id.
43
48
  */
44
- addMetricValue(id: string, value: "inc" | "dec" | number, customData?: {
49
+ addMetricValue(id: string, value: MetricCounterOperation | number, customData?: {
45
50
  [key: string]: unknown;
46
51
  }): Promise<string>;
47
52
  /**
package/docs/changelog.md CHANGED
@@ -1,11 +1,179 @@
1
- # @twin.org/telemetry-service - Changelog
1
+ # Changelog
2
2
 
3
- ## [0.0.2-next.3](https://github.com/twinfoundation/telemetry/compare/telemetry-service-v0.0.2-next.2...telemetry-service-v0.0.2-next.3) (2025-10-09)
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)
145
+
146
+
147
+ ### Features
148
+
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))
157
+
158
+
159
+ ### Bug Fixes
160
+
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))
163
+
164
+
165
+ ### Dependencies
166
+
167
+ * The following workspace dependencies were updated
168
+ * dependencies
169
+ * @twin.org/telemetry-models bumped from 0.0.3-next.0 to 0.0.3-next.1
170
+
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)
4
172
 
5
173
 
6
174
  ### Features
7
175
 
8
- * add validate-locales ([24ed804](https://github.com/twinfoundation/telemetry/commit/24ed804f7ebc47036f323722bc18452729860c92))
176
+ * add validate-locales ([24ed804](https://github.com/iotaledger/twin-telemetry/commit/24ed804f7ebc47036f323722bc18452729860c92))
9
177
 
10
178
 
11
179
  ### Dependencies
@@ -14,12 +182,12 @@
14
182
  * dependencies
15
183
  * @twin.org/telemetry-models bumped from 0.0.2-next.2 to 0.0.2-next.3
16
184
 
17
- ## [0.0.2-next.2](https://github.com/twinfoundation/telemetry/compare/telemetry-service-v0.0.2-next.1...telemetry-service-v0.0.2-next.2) (2025-08-29)
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)
18
186
 
19
187
 
20
188
  ### Features
21
189
 
22
- * eslint migration to flat config ([69ac91a](https://github.com/twinfoundation/telemetry/commit/69ac91a89d0b5bc63374a0bd314f770b557dabb4))
190
+ * eslint migration to flat config ([69ac91a](https://github.com/iotaledger/twin-telemetry/commit/69ac91a89d0b5bc63374a0bd314f770b557dabb4))
23
191
 
24
192
 
25
193
  ### Dependencies
@@ -28,22 +196,22 @@
28
196
  * dependencies
29
197
  * @twin.org/telemetry-models bumped from 0.0.2-next.1 to 0.0.2-next.2
30
198
 
31
- ## [0.0.2-next.1](https://github.com/twinfoundation/telemetry/compare/telemetry-service-v0.0.2-next.0...telemetry-service-v0.0.2-next.1) (2025-08-20)
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)
32
200
 
33
201
 
34
202
  ### Features
35
203
 
36
- * remove unused namespace ([54939fa](https://github.com/twinfoundation/telemetry/commit/54939faac3790dc1b51aa96a54005a03c99f98da))
37
- * remove unused namespace ([02dcabb](https://github.com/twinfoundation/telemetry/commit/02dcabbe00f5b03d5e4b2c12e655efac50409acf))
38
- * update dependencies ([0e55c48](https://github.com/twinfoundation/telemetry/commit/0e55c48de4139c6fe66b823101ca17973e60847c))
39
- * update framework core ([4b10bcd](https://github.com/twinfoundation/telemetry/commit/4b10bcd4d3101151671bdcf9aef7c54f5937fc2a))
40
- * use shared store mechanism ([#7](https://github.com/twinfoundation/telemetry/issues/7)) ([806fe2c](https://github.com/twinfoundation/telemetry/commit/806fe2c2b7653d6b949c27ebf57bd13c3e040242))
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))
41
209
 
42
210
 
43
211
  ### Bug Fixes
44
212
 
45
- * query params force coercion ([ec7999e](https://github.com/twinfoundation/telemetry/commit/ec7999eadb66c65585efa19f3ce4cabb50eed761))
46
- * Update metric endpoint paths by removing trailing slashes and query type as string ([#3](https://github.com/twinfoundation/telemetry/issues/3)) ([b386ca5](https://github.com/twinfoundation/telemetry/commit/b386ca55404aa933ad8917f82a7f0e588593fcc8))
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))
47
215
 
48
216
 
49
217
  ### Dependencies
@@ -57,7 +225,7 @@
57
225
 
58
226
  ### Features
59
227
 
60
- * release to production ([df2151d](https://github.com/twinfoundation/telemetry/commit/df2151d24844fd2c3e6092ce3a6f888ac16219a0))
228
+ * release to production ([df2151d](https://github.com/iotaledger/twin-telemetry/commit/df2151d24844fd2c3e6092ce3a6f888ac16219a0))
61
229
 
62
230
 
63
231
  ### Dependencies
@@ -66,12 +234,12 @@
66
234
  * dependencies
67
235
  * @twin.org/telemetry-models bumped from ^0.0.0 to ^0.0.1
68
236
 
69
- ## [0.0.1-next.18](https://github.com/twinfoundation/telemetry/compare/telemetry-service-v0.0.1-next.17...telemetry-service-v0.0.1-next.18) (2025-06-20)
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)
70
238
 
71
239
 
72
240
  ### Bug Fixes
73
241
 
74
- * query params force coercion ([ec7999e](https://github.com/twinfoundation/telemetry/commit/ec7999eadb66c65585efa19f3ce4cabb50eed761))
242
+ * query params force coercion ([ec7999e](https://github.com/iotaledger/twin-telemetry/commit/ec7999eadb66c65585efa19f3ce4cabb50eed761))
75
243
 
76
244
 
77
245
  ### Dependencies
@@ -80,12 +248,12 @@
80
248
  * dependencies
81
249
  * @twin.org/telemetry-models bumped from 0.0.1-next.17 to 0.0.1-next.18
82
250
 
83
- ## [0.0.1-next.17](https://github.com/twinfoundation/telemetry/compare/telemetry-service-v0.0.1-next.16...telemetry-service-v0.0.1-next.17) (2025-06-12)
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)
84
252
 
85
253
 
86
254
  ### Features
87
255
 
88
- * update dependencies ([0e55c48](https://github.com/twinfoundation/telemetry/commit/0e55c48de4139c6fe66b823101ca17973e60847c))
256
+ * update dependencies ([0e55c48](https://github.com/iotaledger/twin-telemetry/commit/0e55c48de4139c6fe66b823101ca17973e60847c))
89
257
 
90
258
 
91
259
  ### Dependencies
@@ -94,12 +262,12 @@
94
262
  * dependencies
95
263
  * @twin.org/telemetry-models bumped from 0.0.1-next.16 to 0.0.1-next.17
96
264
 
97
- ## [0.0.1-next.16](https://github.com/twinfoundation/telemetry/compare/telemetry-service-v0.0.1-next.15...telemetry-service-v0.0.1-next.16) (2025-04-17)
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)
98
266
 
99
267
 
100
268
  ### Features
101
269
 
102
- * use shared store mechanism ([#7](https://github.com/twinfoundation/telemetry/issues/7)) ([806fe2c](https://github.com/twinfoundation/telemetry/commit/806fe2c2b7653d6b949c27ebf57bd13c3e040242))
270
+ * use shared store mechanism ([#7](https://github.com/iotaledger/twin-telemetry/issues/7)) ([806fe2c](https://github.com/iotaledger/twin-telemetry/commit/806fe2c2b7653d6b949c27ebf57bd13c3e040242))
103
271
 
104
272
 
105
273
  ### Dependencies
@@ -108,12 +276,12 @@
108
276
  * dependencies
109
277
  * @twin.org/telemetry-models bumped from 0.0.1-next.15 to 0.0.1-next.16
110
278
 
111
- ## [0.0.1-next.15](https://github.com/twinfoundation/telemetry/compare/telemetry-service-v0.0.1-next.14...telemetry-service-v0.0.1-next.15) (2025-03-28)
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)
112
280
 
113
281
 
114
282
  ### Bug Fixes
115
283
 
116
- * Update metric endpoint paths by removing trailing slashes and query type as string ([#3](https://github.com/twinfoundation/telemetry/issues/3)) ([b386ca5](https://github.com/twinfoundation/telemetry/commit/b386ca55404aa933ad8917f82a7f0e588593fcc8))
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))
117
285
 
118
286
 
119
287
  ### Dependencies
package/docs/examples.md CHANGED
@@ -1 +1,83 @@
1
- # @twin.org/telemetry-service - Examples
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
+ ```