@ogcio/o11y-sdk-node 0.1.0-beta.4 → 0.1.0-beta.6

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 (38) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/lib/index.d.ts +11 -0
  3. package/dist/lib/instrumentation.node.js +12 -1
  4. package/dist/lib/url-sampler.d.ts +9 -0
  5. package/dist/lib/url-sampler.js +28 -0
  6. package/dist/package.json +4 -5
  7. package/dist/vitest.config.js +1 -1
  8. package/lib/index.ts +12 -0
  9. package/lib/instrumentation.node.ts +12 -1
  10. package/lib/url-sampler.ts +53 -0
  11. package/package.json +3 -4
  12. package/test/integration/README.md +26 -0
  13. package/test/integration/integration.test.ts +37 -0
  14. package/test/integration/run.sh +85 -0
  15. package/test/utils/alloy-log-parser.ts +46 -0
  16. package/vitest.config.ts +1 -1
  17. package/coverage/cobertura-coverage.xml +0 -310
  18. package/coverage/lcov-report/base.css +0 -224
  19. package/coverage/lcov-report/block-navigation.js +0 -87
  20. package/coverage/lcov-report/favicon.png +0 -0
  21. package/coverage/lcov-report/index.html +0 -131
  22. package/coverage/lcov-report/prettify.css +0 -1
  23. package/coverage/lcov-report/prettify.js +0 -2
  24. package/coverage/lcov-report/sdk-node/index.html +0 -116
  25. package/coverage/lcov-report/sdk-node/index.ts.html +0 -112
  26. package/coverage/lcov-report/sdk-node/lib/console.ts.html +0 -130
  27. package/coverage/lcov-report/sdk-node/lib/grpc.ts.html +0 -178
  28. package/coverage/lcov-report/sdk-node/lib/http.ts.html +0 -190
  29. package/coverage/lcov-report/sdk-node/lib/index.html +0 -221
  30. package/coverage/lcov-report/sdk-node/lib/index.ts.html +0 -256
  31. package/coverage/lcov-report/sdk-node/lib/instrumentation.node.ts.html +0 -334
  32. package/coverage/lcov-report/sdk-node/lib/metrics.ts.html +0 -295
  33. package/coverage/lcov-report/sdk-node/lib/options.ts.html +0 -106
  34. package/coverage/lcov-report/sdk-node/lib/utils.ts.html +0 -115
  35. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  36. package/coverage/lcov-report/sorter.js +0 -196
  37. package/coverage/lcov.info +0 -312
  38. package/test-report.xml +0 -71
@@ -1,196 +0,0 @@
1
- /* eslint-disable */
2
- var addSorting = (function() {
3
- 'use strict';
4
- var cols,
5
- currentSort = {
6
- index: 0,
7
- desc: false
8
- };
9
-
10
- // returns the summary table element
11
- function getTable() {
12
- return document.querySelector('.coverage-summary');
13
- }
14
- // returns the thead element of the summary table
15
- function getTableHeader() {
16
- return getTable().querySelector('thead tr');
17
- }
18
- // returns the tbody element of the summary table
19
- function getTableBody() {
20
- return getTable().querySelector('tbody');
21
- }
22
- // returns the th element for nth column
23
- function getNthColumn(n) {
24
- return getTableHeader().querySelectorAll('th')[n];
25
- }
26
-
27
- function onFilterInput() {
28
- const searchValue = document.getElementById('fileSearch').value;
29
- const rows = document.getElementsByTagName('tbody')[0].children;
30
- for (let i = 0; i < rows.length; i++) {
31
- const row = rows[i];
32
- if (
33
- row.textContent
34
- .toLowerCase()
35
- .includes(searchValue.toLowerCase())
36
- ) {
37
- row.style.display = '';
38
- } else {
39
- row.style.display = 'none';
40
- }
41
- }
42
- }
43
-
44
- // loads the search box
45
- function addSearchBox() {
46
- var template = document.getElementById('filterTemplate');
47
- var templateClone = template.content.cloneNode(true);
48
- templateClone.getElementById('fileSearch').oninput = onFilterInput;
49
- template.parentElement.appendChild(templateClone);
50
- }
51
-
52
- // loads all columns
53
- function loadColumns() {
54
- var colNodes = getTableHeader().querySelectorAll('th'),
55
- colNode,
56
- cols = [],
57
- col,
58
- i;
59
-
60
- for (i = 0; i < colNodes.length; i += 1) {
61
- colNode = colNodes[i];
62
- col = {
63
- key: colNode.getAttribute('data-col'),
64
- sortable: !colNode.getAttribute('data-nosort'),
65
- type: colNode.getAttribute('data-type') || 'string'
66
- };
67
- cols.push(col);
68
- if (col.sortable) {
69
- col.defaultDescSort = col.type === 'number';
70
- colNode.innerHTML =
71
- colNode.innerHTML + '<span class="sorter"></span>';
72
- }
73
- }
74
- return cols;
75
- }
76
- // attaches a data attribute to every tr element with an object
77
- // of data values keyed by column name
78
- function loadRowData(tableRow) {
79
- var tableCols = tableRow.querySelectorAll('td'),
80
- colNode,
81
- col,
82
- data = {},
83
- i,
84
- val;
85
- for (i = 0; i < tableCols.length; i += 1) {
86
- colNode = tableCols[i];
87
- col = cols[i];
88
- val = colNode.getAttribute('data-value');
89
- if (col.type === 'number') {
90
- val = Number(val);
91
- }
92
- data[col.key] = val;
93
- }
94
- return data;
95
- }
96
- // loads all row data
97
- function loadData() {
98
- var rows = getTableBody().querySelectorAll('tr'),
99
- i;
100
-
101
- for (i = 0; i < rows.length; i += 1) {
102
- rows[i].data = loadRowData(rows[i]);
103
- }
104
- }
105
- // sorts the table using the data for the ith column
106
- function sortByIndex(index, desc) {
107
- var key = cols[index].key,
108
- sorter = function(a, b) {
109
- a = a.data[key];
110
- b = b.data[key];
111
- return a < b ? -1 : a > b ? 1 : 0;
112
- },
113
- finalSorter = sorter,
114
- tableBody = document.querySelector('.coverage-summary tbody'),
115
- rowNodes = tableBody.querySelectorAll('tr'),
116
- rows = [],
117
- i;
118
-
119
- if (desc) {
120
- finalSorter = function(a, b) {
121
- return -1 * sorter(a, b);
122
- };
123
- }
124
-
125
- for (i = 0; i < rowNodes.length; i += 1) {
126
- rows.push(rowNodes[i]);
127
- tableBody.removeChild(rowNodes[i]);
128
- }
129
-
130
- rows.sort(finalSorter);
131
-
132
- for (i = 0; i < rows.length; i += 1) {
133
- tableBody.appendChild(rows[i]);
134
- }
135
- }
136
- // removes sort indicators for current column being sorted
137
- function removeSortIndicators() {
138
- var col = getNthColumn(currentSort.index),
139
- cls = col.className;
140
-
141
- cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
142
- col.className = cls;
143
- }
144
- // adds sort indicators for current column being sorted
145
- function addSortIndicators() {
146
- getNthColumn(currentSort.index).className += currentSort.desc
147
- ? ' sorted-desc'
148
- : ' sorted';
149
- }
150
- // adds event listeners for all sorter widgets
151
- function enableUI() {
152
- var i,
153
- el,
154
- ithSorter = function ithSorter(i) {
155
- var col = cols[i];
156
-
157
- return function() {
158
- var desc = col.defaultDescSort;
159
-
160
- if (currentSort.index === i) {
161
- desc = !currentSort.desc;
162
- }
163
- sortByIndex(i, desc);
164
- removeSortIndicators();
165
- currentSort.index = i;
166
- currentSort.desc = desc;
167
- addSortIndicators();
168
- };
169
- };
170
- for (i = 0; i < cols.length; i += 1) {
171
- if (cols[i].sortable) {
172
- // add the click event handler on the th so users
173
- // dont have to click on those tiny arrows
174
- el = getNthColumn(i).querySelector('.sorter').parentElement;
175
- if (el.addEventListener) {
176
- el.addEventListener('click', ithSorter(i));
177
- } else {
178
- el.attachEvent('onclick', ithSorter(i));
179
- }
180
- }
181
- }
182
- }
183
- // adds sorting functionality to the UI
184
- return function() {
185
- if (!getTable()) {
186
- return;
187
- }
188
- cols = loadColumns();
189
- loadData();
190
- addSearchBox();
191
- addSortIndicators();
192
- enableUI();
193
- };
194
- })();
195
-
196
- window.addEventListener('load', addSorting);
@@ -1,312 +0,0 @@
1
- TN:
2
- SF:index.ts
3
- FNF:0
4
- FNH:0
5
- DA:1,1
6
- LF:1
7
- LH:1
8
- BRF:0
9
- BRH:0
10
- end_of_record
11
- TN:
12
- SF:lib/console.ts
13
- FN:5,buildConsoleExporters
14
- FNF:1
15
- FNH:1
16
- FNDA:1,buildConsoleExporters
17
- DA:1,1
18
- DA:5,1
19
- DA:6,1
20
- DA:7,1
21
- DA:8,1
22
- DA:9,1
23
- DA:10,1
24
- DA:11,1
25
- DA:12,1
26
- DA:13,1
27
- DA:14,1
28
- DA:15,1
29
- LF:12
30
- LH:12
31
- BRDA:5,0,0,1
32
- BRF:1
33
- BRH:1
34
- end_of_record
35
- TN:
36
- SF:lib/grpc.ts
37
- FN:10,buildGrpcExporters
38
- FNF:1
39
- FNH:1
40
- FNDA:3,buildGrpcExporters
41
- DA:1,1
42
- DA:10,3
43
- DA:11,3
44
- DA:12,3
45
- DA:13,3
46
- DA:14,3
47
- DA:15,3
48
- DA:16,3
49
- DA:17,3
50
- DA:18,3
51
- DA:19,3
52
- DA:20,3
53
- DA:21,3
54
- DA:22,3
55
- DA:23,3
56
- DA:24,3
57
- DA:25,3
58
- DA:26,3
59
- DA:27,3
60
- DA:28,3
61
- DA:29,3
62
- DA:30,3
63
- DA:31,3
64
- LF:23
65
- LH:23
66
- BRDA:10,0,0,3
67
- BRDA:23,1,0,2
68
- BRF:2
69
- BRH:2
70
- end_of_record
71
- TN:
72
- SF:lib/http.ts
73
- FN:10,buildHttpExporters
74
- FNF:1
75
- FNH:1
76
- FNDA:2,buildHttpExporters
77
- DA:1,1
78
- DA:10,2
79
- DA:11,2
80
- DA:12,1
81
- DA:13,1
82
- DA:15,2
83
- DA:16,2
84
- DA:17,2
85
- DA:18,2
86
- DA:19,2
87
- DA:20,2
88
- DA:21,2
89
- DA:22,2
90
- DA:23,2
91
- DA:24,2
92
- DA:25,2
93
- DA:26,2
94
- DA:27,2
95
- DA:28,2
96
- DA:29,2
97
- DA:30,2
98
- DA:31,2
99
- DA:32,2
100
- DA:33,2
101
- DA:34,2
102
- DA:35,2
103
- LF:26
104
- LH:26
105
- BRDA:10,0,0,2
106
- BRDA:11,1,0,1
107
- BRF:2
108
- BRH:2
109
- end_of_record
110
- TN:
111
- SF:lib/index.ts
112
- FN:1,(empty-report)
113
- FNF:1
114
- FNH:1
115
- FNDA:1,(empty-report)
116
- LF:0
117
- LH:0
118
- BRDA:1,0,0,1
119
- BRF:1
120
- BRH:1
121
- end_of_record
122
- TN:
123
- SF:lib/instrumentation.node.ts
124
- FN:13,buildNodeInstrumentation
125
- FNF:1
126
- FNH:1
127
- FNDA:8,buildNodeInstrumentation
128
- DA:1,1
129
- DA:13,8
130
- DA:14,8
131
- DA:15,8
132
- DA:16,8
133
- DA:17,1
134
- DA:18,1
135
- DA:19,1
136
- DA:20,1
137
- DA:21,1
138
- DA:23,8
139
- DA:24,1
140
- DA:25,1
141
- DA:26,1
142
- DA:27,1
143
- DA:28,1
144
- DA:30,8
145
- DA:31,1
146
- DA:32,1
147
- DA:33,1
148
- DA:34,1
149
- DA:35,1
150
- DA:37,5
151
- DA:39,8
152
- DA:40,1
153
- DA:41,8
154
- DA:42,1
155
- DA:43,4
156
- DA:44,3
157
- DA:45,3
158
- DA:47,5
159
- DA:48,5
160
- DA:49,5
161
- DA:50,5
162
- DA:51,4
163
- DA:52,1
164
- DA:53,8
165
- DA:55,8
166
- DA:56,8
167
- DA:57,8
168
- DA:58,8
169
- DA:59,8
170
- DA:60,8
171
- DA:61,8
172
- DA:62,8
173
- DA:63,8
174
- DA:64,8
175
- DA:65,8
176
- DA:66,8
177
- DA:67,8
178
- DA:68,8
179
- DA:69,8
180
- DA:70,8
181
- DA:71,8
182
- DA:72,8
183
- DA:74,8
184
- DA:75,8
185
- DA:76,8
186
- DA:77,8
187
- DA:78,1
188
- DA:79,1
189
- DA:80,1
190
- DA:81,1
191
- DA:82,1
192
- DA:83,8
193
- LF:65
194
- LH:65
195
- BRDA:13,0,0,8
196
- BRDA:16,1,0,1
197
- BRDA:21,2,0,7
198
- BRDA:23,3,0,1
199
- BRDA:28,4,0,6
200
- BRDA:30,5,0,5
201
- BRDA:30,6,0,1
202
- BRDA:39,7,0,1
203
- BRDA:41,8,0,4
204
- BRDA:41,9,0,1
205
- BRDA:43,10,0,3
206
- BRDA:45,11,0,5
207
- BRDA:50,12,0,4
208
- BRDA:51,13,0,1
209
- BRDA:68,14,0,5
210
- BRDA:77,15,0,1
211
- BRF:16
212
- BRH:16
213
- end_of_record
214
- TN:
215
- SF:lib/metrics.ts
216
- FN:33,gauge
217
- FN:34,histogram
218
- FN:35,counter
219
- FN:36,updowncounter
220
- FN:37,async-counter
221
- FN:38,async-updowncounter
222
- FN:39,async-gauge
223
- FN:48,getMeter
224
- FN:59,getMetric
225
- FNF:9
226
- FNH:9
227
- FNDA:1,gauge
228
- FNDA:1,histogram
229
- FNDA:1,counter
230
- FNDA:1,updowncounter
231
- FNDA:1,async-counter
232
- FNDA:1,async-updowncounter
233
- FNDA:2,async-gauge
234
- FNDA:9,getMeter
235
- FNDA:9,getMetric
236
- DA:1,1
237
- DA:28,1
238
- DA:32,1
239
- DA:33,1
240
- DA:34,1
241
- DA:35,1
242
- DA:36,1
243
- DA:37,1
244
- DA:38,1
245
- DA:39,1
246
- DA:40,1
247
- DA:48,9
248
- DA:49,9
249
- DA:50,9
250
- DA:51,1
251
- DA:52,1
252
- DA:53,9
253
- DA:54,8
254
- DA:55,8
255
- DA:56,9
256
- DA:57,9
257
- DA:59,1
258
- DA:60,9
259
- DA:61,9
260
- DA:62,9
261
- DA:63,9
262
- DA:65,9
263
- DA:66,1
264
- DA:67,1
265
- DA:69,8
266
- DA:70,8
267
- LF:31
268
- LH:31
269
- BRDA:33,0,0,1
270
- BRDA:34,1,0,1
271
- BRDA:35,2,0,1
272
- BRDA:36,3,0,1
273
- BRDA:37,4,0,1
274
- BRDA:38,5,0,1
275
- BRDA:39,6,0,2
276
- BRDA:48,7,0,9
277
- BRDA:50,8,0,8
278
- BRDA:50,9,0,1
279
- BRDA:53,10,0,8
280
- BRDA:59,11,0,9
281
- BRDA:65,12,0,1
282
- BRDA:67,13,0,8
283
- BRF:14
284
- BRH:14
285
- end_of_record
286
- TN:
287
- SF:lib/options.ts
288
- FN:1,(empty-report)
289
- FNF:1
290
- FNH:1
291
- FNDA:1,(empty-report)
292
- LF:0
293
- LH:0
294
- BRDA:1,0,0,1
295
- BRF:1
296
- BRH:1
297
- end_of_record
298
- TN:
299
- SF:lib/utils.ts
300
- FNF:0
301
- FNH:0
302
- DA:1,1
303
- DA:4,1
304
- DA:7,1
305
- DA:8,1
306
- DA:9,1
307
- DA:10,1
308
- LF:6
309
- LH:6
310
- BRF:0
311
- BRH:0
312
- end_of_record
package/test-report.xml DELETED
@@ -1,71 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" ?>
2
- <testsuites name="vitest tests" tests="20" failures="0" errors="0" time="0.189321701">
3
- <testsuite name="test/index.test.ts" timestamp="2025-01-28T15:28:22.386Z" hostname="fv-az367-418" tests="2" failures="0" errors="0" skipped="0" time="0.008525973">
4
- <testcase classname="test/index.test.ts" name="instrumentNode &gt; should call buildNodeInstrumentation with the provided config" time="0.004943385">
5
- </testcase>
6
- <testcase classname="test/index.test.ts" name="instrumentNode &gt; should not throw when called without arguments" time="0.001780995">
7
- </testcase>
8
- </testsuite>
9
- <testsuite name="test/metrics.test.ts" timestamp="2025-01-28T15:28:22.388Z" hostname="fv-az367-418" tests="9" failures="0" errors="0" skipped="0" time="0.016880947">
10
- <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createGauge when type is &apos;gauge&apos;" time="0.005396083">
11
- </testcase>
12
- <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createHistogram when type is &apos;histogram&apos;" time="0.000557498">
13
- </testcase>
14
- <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createCounter when type is &apos;counter&apos;" time="0.000447099">
15
- </testcase>
16
- <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createUpDownCounter when type is &apos;updowncounter&apos;" time="0.000433999">
17
- </testcase>
18
- <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createObservableCounter when type is &apos;async-counter&apos;" time="0.000520098">
19
- </testcase>
20
- <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createObservableUpDownCounter when type is &apos;async-updowncounter&apos;" time="0.000518598">
21
- </testcase>
22
- <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createObservableGauge when type is &apos;async-gauge&apos;" time="0.000397299">
23
- </testcase>
24
- <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should throw an error for unsupported metric types" time="0.001743294">
25
- </testcase>
26
- <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should return noop metric fallback for null config" time="0.004466986">
27
- <system-err>
28
- Invaid metric configuration!
29
-
30
- </system-err>
31
- </testcase>
32
- </testsuite>
33
- <testsuite name="test/node-config.test.ts" timestamp="2025-01-28T15:28:22.391Z" hostname="fv-az367-418" tests="5" failures="0" errors="0" skipped="0" time="0.146814435">
34
- <testcase classname="test/node-config.test.ts" name="verify config settings &gt; grpc config" time="0.056207422">
35
- <system-out>
36
- NodeJS OpenTelemetry instrumentation started successfully.
37
-
38
- </system-out>
39
- </testcase>
40
- <testcase classname="test/node-config.test.ts" name="verify config settings &gt; http config" time="0.04112677">
41
- <system-out>
42
- NodeJS OpenTelemetry instrumentation started successfully.
43
-
44
- </system-out>
45
- </testcase>
46
- <testcase classname="test/node-config.test.ts" name="verify config settings &gt; console - console config" time="0.01881204">
47
- <system-out>
48
- NodeJS OpenTelemetry instrumentation started successfully.
49
-
50
- </system-out>
51
- </testcase>
52
- <testcase classname="test/node-config.test.ts" name="verify config settings &gt; single log sending config" time="0.027214414">
53
- <system-out>
54
- NodeJS OpenTelemetry instrumentation started successfully.
55
-
56
- </system-out>
57
- </testcase>
58
- <testcase classname="test/node-config.test.ts" name="verify config settings &gt; check if clear base endpoint final slash" time="0.001299795">
59
- </testcase>
60
- </testsuite>
61
- <testsuite name="test/validation.test.ts" timestamp="2025-01-28T15:28:22.394Z" hostname="fv-az367-418" tests="4" failures="0" errors="0" skipped="0" time="0.017100346">
62
- <testcase classname="test/validation.test.ts" name="validation config: should return without breaking the execution &gt; should call buildNodeInstrumentation without config and skip instrumentation" time="0.005204683">
63
- </testcase>
64
- <testcase classname="test/validation.test.ts" name="validation config: should return without breaking the execution &gt; node instrumentation: url undefined" time="0.002382393">
65
- </testcase>
66
- <testcase classname="test/validation.test.ts" name="validation config: should return without breaking the execution &gt; node instrumentation: invalid url" time="0.000839897">
67
- </testcase>
68
- <testcase classname="test/validation.test.ts" name="validation config: should return without breaking the execution &gt; node instrumentation: verify no instrumentation if exception occurs" time="0.006574379">
69
- </testcase>
70
- </testsuite>
71
- </testsuites>