@agoric/telemetry 0.6.3-dev-803e785.0.803e785 → 0.6.3-dev-6727d47.0.6727d47
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/package.json +7 -4
- package/CHANGELOG.md +0 -161
- package/sample-otel-collector.yaml +0 -94
- package/scripts/ingest.sh +0 -30
- package/scripts/otelcol.sh +0 -14
- package/test/flight-recorder.test.js +0 -114
- package/test/import.test.js +0 -36
- package/test/prepare-test-env-ava.js +0 -4
- package/tsconfig.json +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/telemetry",
|
|
3
|
-
"version": "0.6.3-dev-
|
|
3
|
+
"version": "0.6.3-dev-6727d47.0.6727d47",
|
|
4
4
|
"description": "Agoric's telemetry implementation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://github.com/Agoric/agoric-sdk",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"author": "Agoric",
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agoric/internal": "0.3.3-dev-
|
|
26
|
-
"@agoric/store": "0.9.3-dev-
|
|
25
|
+
"@agoric/internal": "0.3.3-dev-6727d47.0.6727d47",
|
|
26
|
+
"@agoric/store": "0.9.3-dev-6727d47.0.6727d47",
|
|
27
27
|
"@endo/errors": "^1.2.13",
|
|
28
28
|
"@endo/init": "^1.1.12",
|
|
29
29
|
"@endo/marshal": "^1.8.0",
|
|
@@ -50,6 +50,9 @@
|
|
|
50
50
|
"c8": "^10.1.3",
|
|
51
51
|
"tmp": "^0.2.1"
|
|
52
52
|
},
|
|
53
|
+
"files": [
|
|
54
|
+
"src"
|
|
55
|
+
],
|
|
53
56
|
"publishConfig": {
|
|
54
57
|
"access": "public"
|
|
55
58
|
},
|
|
@@ -68,5 +71,5 @@
|
|
|
68
71
|
"typeCoverage": {
|
|
69
72
|
"atLeast": 89.28
|
|
70
73
|
},
|
|
71
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "6727d47e6970be1f992aa904cd964abdfef00a83"
|
|
72
75
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
### [0.6.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/telemetry@0.6.1...@agoric/telemetry@0.6.2) (2023-06-02)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @agoric/telemetry
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### [0.6.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/telemetry@0.6.0...@agoric/telemetry@0.6.1) (2023-05-24)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @agoric/telemetry
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## [0.6.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/telemetry@0.4.0...@agoric/telemetry@0.6.0) (2023-05-19)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Features
|
|
26
|
-
|
|
27
|
-
* **cosmic-swingset:** basic snapshot wiring ([b1072d8](https://github.com/Agoric/agoric-sdk/commit/b1072d8b1ddabbb5f2835eb503c945fed3b6b080))
|
|
28
|
-
* **telemetry:** add shutdown ([84757ff](https://github.com/Agoric/agoric-sdk/commit/84757ff63c7f603954af9c6e85ce7a819938e5b0))
|
|
29
|
-
* **telemetry:** do not carry span stack corruption across blocks ([16eaa99](https://github.com/Agoric/agoric-sdk/commit/16eaa99caef56b73159b321894aa2dca52846a29))
|
|
30
|
-
* **telemetry:** Expose send errors in forceFlush ([7a9a8c6](https://github.com/Agoric/agoric-sdk/commit/7a9a8c6165d3cb1bc89289faddf355bc04cc9c1f))
|
|
31
|
-
* **telemetry:** fail otel slog sender in more cases ([4549903](https://github.com/Agoric/agoric-sdk/commit/45499031cbb2417d58a50087b857600a96f87fe8))
|
|
32
|
-
* **telemetry:** SLOGSENDER_FAIL_ON_ERROR ([db79fca](https://github.com/Agoric/agoric-sdk/commit/db79fcad8bc784d300acfd994ceab9a2b9c2a567))
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
### Bug Fixes
|
|
36
|
-
|
|
37
|
-
* **telemetry:** do not propagate errors through queue ([601d63b](https://github.com/Agoric/agoric-sdk/commit/601d63b53722bac479ad570e2f7dfc1016dae9c7))
|
|
38
|
-
* **telemetry:** fix various edge cases ([c54d996](https://github.com/Agoric/agoric-sdk/commit/c54d9962deaaefec4f2c9680d58d625644ef9b69))
|
|
39
|
-
* **telemetry:** handle missing syscalls ([0b8475b](https://github.com/Agoric/agoric-sdk/commit/0b8475be8616d81661962c9845315554e58a7f96))
|
|
40
|
-
* **telemetry:** handle paging `create-vat` ([84a7557](https://github.com/Agoric/agoric-sdk/commit/84a75573520b5cc24ba7cc29e054a66d81f06339))
|
|
41
|
-
* **telemetry:** handle smallcaps ([1adc8ce](https://github.com/Agoric/agoric-sdk/commit/1adc8ced2c5d65db8de4992d2273824f79020a2c))
|
|
42
|
-
* **telemetry:** Missing after-commit rename from [#6881](https://github.com/Agoric/agoric-sdk/issues/6881) ([8e211f8](https://github.com/Agoric/agoric-sdk/commit/8e211f8862dea52b1d952c51760d6690a7604d30))
|
|
43
|
-
* **telemetry:** partially undo [#6684](https://github.com/Agoric/agoric-sdk/issues/6684) ([b9fa85b](https://github.com/Agoric/agoric-sdk/commit/b9fa85b7307124e50cc3a84d3b694307cde55f54))
|
|
44
|
-
* **telemetry:** silence pipe sender rejections ([e502f92](https://github.com/Agoric/agoric-sdk/commit/e502f9293ed92b8d705447271aa4f010c6c6dcb6))
|
|
45
|
-
* **telemetry:** upgrade otel deps ([dc48759](https://github.com/Agoric/agoric-sdk/commit/dc4875992937f9648381efae70818fa767d4b901))
|
|
46
|
-
* replace unsafe then with E.when ([#6684](https://github.com/Agoric/agoric-sdk/issues/6684)) ([d7a749e](https://github.com/Agoric/agoric-sdk/commit/d7a749eec4ddec9ba39bbc65434f03ec113cae7c))
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## [0.5.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/telemetry@0.4.0...@agoric/telemetry@0.5.0) (2023-02-17)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
### Features
|
|
54
|
-
|
|
55
|
-
* **telemetry:** do not carry span stack corruption across blocks ([e150320](https://github.com/Agoric/agoric-sdk/commit/e150320d88ade61b0a7fa0a0c4992988885ad34d))
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
### Bug Fixes
|
|
59
|
-
|
|
60
|
-
* **telemetry:** fix various edge cases ([2c65492](https://github.com/Agoric/agoric-sdk/commit/2c6549289d1c484aff861c061a7730c4b1f284e7))
|
|
61
|
-
* **telemetry:** handle paging `create-vat` ([c9bef2f](https://github.com/Agoric/agoric-sdk/commit/c9bef2f994ddaabf88dac6249f3adbc21fa6b4a0))
|
|
62
|
-
* **telemetry:** upgrade otel deps ([2c9b017](https://github.com/Agoric/agoric-sdk/commit/2c9b017d301048e5782b3b8cf684392e00419221))
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
## [0.4.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/telemetry@0.3.0...@agoric/telemetry@0.4.0) (2022-10-05)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
### Features
|
|
70
|
-
|
|
71
|
-
* **telemetry:** Support slog sender in subprocess ([9fa268f](https://github.com/Agoric/agoric-sdk/commit/9fa268fc9b59d9fb26d829300d7a9d5a768e47bc))
|
|
72
|
-
* **telemetry:** Support SLOGSENDER_AGENT_ env prefix ([e504005](https://github.com/Agoric/agoric-sdk/commit/e50400527a03d32fdf34a30fd29229f98e9baf5c))
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
### Bug Fixes
|
|
76
|
-
|
|
77
|
-
* cleanup, update, and refactor slog-to-otel converter ([225f1dd](https://github.com/Agoric/agoric-sdk/commit/225f1dda46ec99dbc47ba39b3a99e278a4c1adbb)), closes [#4585](https://github.com/Agoric/agoric-sdk/issues/4585)
|
|
78
|
-
* **telemetry:** forceFlush is async ([5cf56b9](https://github.com/Agoric/agoric-sdk/commit/5cf56b9d22a4e9436f1ce1b5020ea68071ef7f55))
|
|
79
|
-
* **telemetry:** further prevent duplication of slog senders ([c7a3fc4](https://github.com/Agoric/agoric-sdk/commit/c7a3fc46526b3ecf05b0f3b2b86983b788467423))
|
|
80
|
-
* **telemetry:** slog sender errors should never propagate ([593aaae](https://github.com/Agoric/agoric-sdk/commit/593aaae57489bb8bfd1217dc995d7d6e4d395ab4))
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
## [0.3.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/telemetry@0.2.1...@agoric/telemetry@0.3.0) (2022-09-20)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
### Features
|
|
88
|
-
|
|
89
|
-
* **cosmic-swingset:** add commit-block slog events ([8335928](https://github.com/Agoric/agoric-sdk/commit/8335928e933b96dc7db78a0895a7582b93ef4f73))
|
|
90
|
-
* **cosmic-swingset:** break up inbound queue processing ([e0d844d](https://github.com/Agoric/agoric-sdk/commit/e0d844da0cae132f63039404c42e5979c12977ce))
|
|
91
|
-
* **telemetry:** `otel-and-flight-recorder.js` for the best of both ([a191b34](https://github.com/Agoric/agoric-sdk/commit/a191b34bd6a4b14f7280b0886fcfd44b5a42b6b5))
|
|
92
|
-
* **telemetry:** flatten nested attributes ([2fc39ca](https://github.com/Agoric/agoric-sdk/commit/2fc39cab8ce3a080c96304af2d772943a653e420))
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
### Bug Fixes
|
|
96
|
-
|
|
97
|
-
* **telemetry:** handle missing slog events ([8e353da](https://github.com/Agoric/agoric-sdk/commit/8e353daf4eceac2eb90fddb6f651bc77f24d299c))
|
|
98
|
-
* Use new `||` assert style, but when TS confused use `if` instead ([#6174](https://github.com/Agoric/agoric-sdk/issues/6174)) ([94625d3](https://github.com/Agoric/agoric-sdk/commit/94625d38c3bb5333b00a69dd3086b1ac13490f62))
|
|
99
|
-
* **kv-string-store:** allow keys to overwrite ([c28b393](https://github.com/Agoric/agoric-sdk/commit/c28b39332c40d4e1def80fee9e7b70588d0c592a))
|
|
100
|
-
* **slog-to-otel:** more `methargs` parsing ([42a9bc0](https://github.com/Agoric/agoric-sdk/commit/42a9bc08dfa66f4653253a9cfc104307b44c908c))
|
|
101
|
-
* **Swingset:** add crank details to slog event ([be1f443](https://github.com/Agoric/agoric-sdk/commit/be1f443bdfd49325316607142f116ca3153e296f))
|
|
102
|
-
* **telemetry:** cleanup slot-to-otel output ([97c695f](https://github.com/Agoric/agoric-sdk/commit/97c695f60fce031bf9307fe8237d3df756d2a4e1))
|
|
103
|
-
* **telemetry:** close store iterator on has check ([6199337](https://github.com/Agoric/agoric-sdk/commit/6199337d40e42ffb4057f5a653f9cecfb21afe3f))
|
|
104
|
-
* **telemetry:** COMMIT should exit the txn ([36bf35c](https://github.com/Agoric/agoric-sdk/commit/36bf35c4daef7a42456aee7d917eba597abeb887))
|
|
105
|
-
* **telemetry:** do not mutate the original slog object ([#5705](https://github.com/Agoric/agoric-sdk/issues/5705)) ([4018a28](https://github.com/Agoric/agoric-sdk/commit/4018a28fcc9ea3ecd28d09e54e5c7cd2d64907b6))
|
|
106
|
-
* **telemetry:** ingest script should not skip lines on time backtrack ([785a5c0](https://github.com/Agoric/agoric-sdk/commit/785a5c0974ad8ed62501ad6e02245dd77d7c7815))
|
|
107
|
-
* **telemetry:** Use transactions for tmp telemetry DB ([dea1a2a](https://github.com/Agoric/agoric-sdk/commit/dea1a2ac31586cf16216e57162ad2951f07dc178))
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
### [0.2.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/telemetry@0.2.0...@agoric/telemetry@0.2.1) (2022-05-28)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
### Bug Fixes
|
|
115
|
-
|
|
116
|
-
* **slog-to-otel:** ignore `vatstoreGetAfter` syscall ([7baed8e](https://github.com/Agoric/agoric-sdk/commit/7baed8ea1c7513d57bd33edb8c4b6a80dd5182ed))
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
## [0.2.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/telemetry@0.1.1...@agoric/telemetry@0.2.0) (2022-04-18)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
### ⚠ BREAKING CHANGES
|
|
124
|
-
|
|
125
|
-
* consistent Node engine requirement (>=14.15.0)
|
|
126
|
-
|
|
127
|
-
### Features
|
|
128
|
-
|
|
129
|
-
* **telemetry:** `echo 2022-02-18T12:00:00Z | ./ingest.sh f.slog` ([bede363](https://github.com/Agoric/agoric-sdk/commit/bede363018656bad32b6764a5216acaaf2ca19bc))
|
|
130
|
-
* **telemetry:** upgrade to latest `[@opentelemetry](https://github.com/opentelemetry)` ([de82224](https://github.com/Agoric/agoric-sdk/commit/de82224eb08a40e139f20e74d6f1038e50fbfa40))
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
### Bug Fixes
|
|
134
|
-
|
|
135
|
-
* **telemetry:** clean up scripts and leave pointers ([1830c55](https://github.com/Agoric/agoric-sdk/commit/1830c55edeb814b79f25f9fbacdbebbac7c2a26f))
|
|
136
|
-
* **telemetry:** count work duration per block, not between blocks ([b95a124](https://github.com/Agoric/agoric-sdk/commit/b95a124d17fca6edf04232f8e3a7eeef196e5b43))
|
|
137
|
-
* **telemetry:** ingest rate limiting ([fd164c8](https://github.com/Agoric/agoric-sdk/commit/fd164c82d56f416309071b85c60da1af34af7821))
|
|
138
|
-
* **telemetry:** rework Prometheus metrics ([38a1922](https://github.com/Agoric/agoric-sdk/commit/38a1922ce2c21e4f31b4a1bedd634bbe627990f9))
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
### Miscellaneous Chores
|
|
142
|
-
|
|
143
|
-
* consistent Node engine requirement (>=14.15.0) ([ddc40fa](https://github.com/Agoric/agoric-sdk/commit/ddc40fa525f845ed900512c38b99f01458a3d131))
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
### 0.1.1 (2022-02-21)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
### Features
|
|
151
|
-
|
|
152
|
-
* **telemetry:** `frcat` script to extract `flight-recorder.bin` ([7ee4091](https://github.com/Agoric/agoric-sdk/commit/7ee409102269ab41a1f3f5d5a0bdd29b6eb12a36))
|
|
153
|
-
* **telemetry:** add `@agoric/telemetry/src/flight-recorder.js` ([b02b0c8](https://github.com/Agoric/agoric-sdk/commit/b02b0c8086136d8e780b687ae65df41796946eec))
|
|
154
|
-
* **telemetry:** introduce for opentelemetry.io integration ([4e382dc](https://github.com/Agoric/agoric-sdk/commit/4e382dcede81717a4c9941266b0377ad531b8b38))
|
|
155
|
-
* **telemetry:** use `makeSlogSenderFromModule` ([2892da9](https://github.com/Agoric/agoric-sdk/commit/2892da96eff902c5f616424d6fb9946aaaef1b0f))
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
### Bug Fixes
|
|
159
|
-
|
|
160
|
-
* Remove extraneous eslint globals ([17087e4](https://github.com/Agoric/agoric-sdk/commit/17087e4605db7d3b30dfccf2434b2850b45e3408))
|
|
161
|
-
* **telemetry:** make flight recorder big-endian on all platforms ([bfe877e](https://github.com/Agoric/agoric-sdk/commit/bfe877e8825d551b9ea6f80e2623fb450883dab0))
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
# Start with https://opentelemetry.io/docs/collector/
|
|
2
|
-
# Then, run ./scripts/otelcol.sh to start the collector and look in the ./data directory.
|
|
3
|
-
receivers:
|
|
4
|
-
# Data sources: metrics
|
|
5
|
-
hostmetrics:
|
|
6
|
-
scrapers:
|
|
7
|
-
cpu:
|
|
8
|
-
disk:
|
|
9
|
-
filesystem:
|
|
10
|
-
load:
|
|
11
|
-
memory:
|
|
12
|
-
network:
|
|
13
|
-
#process:
|
|
14
|
-
# mute_process_name_error: true
|
|
15
|
-
processes:
|
|
16
|
-
#swap:
|
|
17
|
-
|
|
18
|
-
docker_stats:
|
|
19
|
-
endpoint: unix:///var/run/docker.sock
|
|
20
|
-
|
|
21
|
-
# Data sources: traces, metrics, logs
|
|
22
|
-
otlp:
|
|
23
|
-
protocols:
|
|
24
|
-
grpc:
|
|
25
|
-
http:
|
|
26
|
-
|
|
27
|
-
prometheus:
|
|
28
|
-
config:
|
|
29
|
-
scrape_configs:
|
|
30
|
-
- job_name: 'agd-containers'
|
|
31
|
-
docker_sd_configs:
|
|
32
|
-
- host: unix:///var/run/docker.sock
|
|
33
|
-
refresh_interval: 5s
|
|
34
|
-
relabel_configs:
|
|
35
|
-
- source_labels: [__meta_docker_port_private]
|
|
36
|
-
regex: (26660|9464|9465)
|
|
37
|
-
action: keep
|
|
38
|
-
- source_labels: [__meta_docker_port_private]
|
|
39
|
-
regex: (26660|9464)
|
|
40
|
-
target_label: service_name
|
|
41
|
-
replacement: agd-cosmos
|
|
42
|
-
- source_labels: [__meta_docker_port_private]
|
|
43
|
-
regex: 9465
|
|
44
|
-
target_label: service_name
|
|
45
|
-
replacement: solo
|
|
46
|
-
- source_labels: [__meta_docker_container_name]
|
|
47
|
-
# Extract the SDK revision.
|
|
48
|
-
regex: .*-(.*)
|
|
49
|
-
target_label: service_version
|
|
50
|
-
scrape_interval: 5s
|
|
51
|
-
- job_name: 'otelcol'
|
|
52
|
-
scrape_interval: 5s
|
|
53
|
-
static_configs:
|
|
54
|
-
- targets: ['localhost:8888']
|
|
55
|
-
|
|
56
|
-
processors:
|
|
57
|
-
batch:
|
|
58
|
-
timeout: 10s
|
|
59
|
-
resourcedetection:
|
|
60
|
-
detectors: [system]
|
|
61
|
-
|
|
62
|
-
extensions:
|
|
63
|
-
zpages:
|
|
64
|
-
endpoint: :55679
|
|
65
|
-
health_check:
|
|
66
|
-
|
|
67
|
-
exporters:
|
|
68
|
-
file/data:
|
|
69
|
-
path: /data/otel-export.json
|
|
70
|
-
|
|
71
|
-
prometheus:
|
|
72
|
-
endpoint: '0.0.0.0:9411'
|
|
73
|
-
# namespace: "default"
|
|
74
|
-
resource_to_telemetry_conversion:
|
|
75
|
-
enabled: true
|
|
76
|
-
|
|
77
|
-
logging:
|
|
78
|
-
loglevel: debug
|
|
79
|
-
|
|
80
|
-
service:
|
|
81
|
-
# telemetry:
|
|
82
|
-
# logs:
|
|
83
|
-
# level: "debug"
|
|
84
|
-
extensions: [zpages, health_check]
|
|
85
|
-
pipelines:
|
|
86
|
-
# metrics:
|
|
87
|
-
# receivers: [hostmetrics, otlp, prometheus]
|
|
88
|
-
# processors: [batch, resourcedetection]
|
|
89
|
-
# exporters: [prometheus, otlp/uptrace, datadog/api]
|
|
90
|
-
traces:
|
|
91
|
-
receivers: [otlp]
|
|
92
|
-
processors: [batch, resourcedetection]
|
|
93
|
-
#exporters: [otlp/honeycomb, otlp/uptrace, datadog/api]
|
|
94
|
-
exporters: [file/data]
|
package/scripts/ingest.sh
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#! /bin/bash
|
|
2
|
-
# Send a `.slog` or `.slog.gz` to the OpenTelemetry Collector.
|
|
3
|
-
# Run with INGEST_START='' to start ingesting using slogfile timestamps.
|
|
4
|
-
|
|
5
|
-
set -ue
|
|
6
|
-
thisdir=$(dirname -- "${BASH_SOURCE[0]}")
|
|
7
|
-
|
|
8
|
-
# These three lines enable Agoric SDK's OpenTelemetry tracing.
|
|
9
|
-
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
|
|
10
|
-
export SLOGSENDER=@agoric/telemetry/src/otel-trace.js
|
|
11
|
-
export OTEL_RESOURCE_ATTRIBUTES=ingest.file="$1"
|
|
12
|
-
|
|
13
|
-
PROGRESS="$1.ingest-progress"
|
|
14
|
-
|
|
15
|
-
if [[ ! -s "$PROGRESS" ]]; then
|
|
16
|
-
if [[ "${INGEST_START+set}" != set ]]; then
|
|
17
|
-
read -e -r -p 'Target start time [default=actual from slog] (%Y-%m-%dT%H:%M:%SZ): ' INGEST_START
|
|
18
|
-
fi
|
|
19
|
-
if [[ -n "$INGEST_START" ]]; then
|
|
20
|
-
case "$1" in
|
|
21
|
-
*.Z | *.gz) firstline=$(zcat "$1" | head -1) ;;
|
|
22
|
-
*) firstline=$(head -1 "$1") ;;
|
|
23
|
-
esac
|
|
24
|
-
echo "$firstline" | jq --arg targetStart "$INGEST_START" \
|
|
25
|
-
'{virtualTimeOffset: (($targetStart | fromdate) - .time), lastSlogTime: 0}' \
|
|
26
|
-
> "$PROGRESS"
|
|
27
|
-
fi
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
time exec "$thisdir/../bin/ingest-slog" "$1"
|
package/scripts/otelcol.sh
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#! /bin/bash
|
|
2
|
-
# Have a look at ../sample-otel-collector.yaml for tips on configuration.
|
|
3
|
-
set -ueo pipefail
|
|
4
|
-
thisdir=$(dirname -- "${BASH_SOURCE[0]}")
|
|
5
|
-
|
|
6
|
-
# Make ./data to contain the otel-collector.yaml and any data file outputs.
|
|
7
|
-
mkdir -p data
|
|
8
|
-
OTELCOL_CONFIG="data/otel-collector.yaml"
|
|
9
|
-
test -f "$OTELCOL_CONFIG" || cp "$thisdir/../sample-otel-collector.yaml" "$OTELCOL_CONFIG"
|
|
10
|
-
|
|
11
|
-
# Run a Docker container to collect telemetry data.
|
|
12
|
-
docker run -p4318:4318 --rm -i -v"$PWD"/data:/data \
|
|
13
|
-
otel/opentelemetry-collector-contrib --config="/$OTELCOL_CONFIG"
|
|
14
|
-
#watch ls -l data
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import tmp from 'tmp';
|
|
3
|
-
import { test } from './prepare-test-env-ava.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
makeSimpleCircularBuffer,
|
|
7
|
-
makeSlogSenderFromBuffer,
|
|
8
|
-
} from '../src/flight-recorder.js';
|
|
9
|
-
|
|
10
|
-
// Factored this way to support multiple implementations, which at one point there were
|
|
11
|
-
const bufferTests = test.macro(
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param {*} t
|
|
15
|
-
* @param {{makeBuffer: typeof makeSimpleCircularBuffer}} input
|
|
16
|
-
*/
|
|
17
|
-
async (t, input) => {
|
|
18
|
-
const BUFFER_SIZE = 512;
|
|
19
|
-
|
|
20
|
-
const { name: tmpFile, removeCallback } = tmp.fileSync({
|
|
21
|
-
discardDescriptor: true,
|
|
22
|
-
});
|
|
23
|
-
t.teardown(removeCallback);
|
|
24
|
-
const { fileHandle, readCircBuf, writeCircBuf } = await input.makeBuffer({
|
|
25
|
-
circularBufferSize: BUFFER_SIZE,
|
|
26
|
-
circularBufferFilename: tmpFile,
|
|
27
|
-
});
|
|
28
|
-
const realSlogSender = makeSlogSenderFromBuffer({
|
|
29
|
-
fileHandle,
|
|
30
|
-
writeCircBuf,
|
|
31
|
-
});
|
|
32
|
-
let wasShutdown = false;
|
|
33
|
-
const shutdown = () => {
|
|
34
|
-
if (wasShutdown) return;
|
|
35
|
-
wasShutdown = true;
|
|
36
|
-
|
|
37
|
-
return realSlogSender.shutdown();
|
|
38
|
-
};
|
|
39
|
-
t.teardown(shutdown);
|
|
40
|
-
// To verify lack of attempted mutation by the consumer, send only hardened
|
|
41
|
-
// entries.
|
|
42
|
-
/** @type {typeof realSlogSender} */
|
|
43
|
-
const slogSender = Object.assign(
|
|
44
|
-
(obj, serialized) => realSlogSender(harden(obj), serialized),
|
|
45
|
-
realSlogSender,
|
|
46
|
-
);
|
|
47
|
-
slogSender({ type: 'start' });
|
|
48
|
-
await slogSender.forceFlush();
|
|
49
|
-
t.is(fs.readFileSync(tmpFile, { encoding: 'utf8' }).length, BUFFER_SIZE);
|
|
50
|
-
|
|
51
|
-
const len0 = new Uint8Array(BigUint64Array.BYTES_PER_ELEMENT);
|
|
52
|
-
const { done: done0 } = await readCircBuf(len0);
|
|
53
|
-
t.false(done0, 'readCircBuf should not be done');
|
|
54
|
-
const dv0 = new DataView(len0.buffer);
|
|
55
|
-
const buf0 = new Uint8Array(Number(dv0.getBigUint64(0)));
|
|
56
|
-
const { done: done0b } = await readCircBuf(buf0, len0.byteLength);
|
|
57
|
-
t.false(done0b, 'readCircBuf should not be done');
|
|
58
|
-
const buf0Str = new TextDecoder().decode(buf0);
|
|
59
|
-
t.is(buf0Str, `\n{"type":"start"}`, `start compare failed`);
|
|
60
|
-
|
|
61
|
-
const last = 500;
|
|
62
|
-
for (let i = 0; i < last; i += 1) {
|
|
63
|
-
slogSender({ type: 'iteration', iteration: i });
|
|
64
|
-
await slogSender.forceFlush();
|
|
65
|
-
t.is(
|
|
66
|
-
fs.readFileSync(tmpFile, { encoding: 'utf8' }).length,
|
|
67
|
-
BUFFER_SIZE,
|
|
68
|
-
`iteration ${i} length mismatch`,
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
let offset = 0;
|
|
73
|
-
const len1 = new Uint8Array(BigUint64Array.BYTES_PER_ELEMENT);
|
|
74
|
-
for (let i = 490; i < last; i += 1) {
|
|
75
|
-
const { done: done1 } = await readCircBuf(len1, offset);
|
|
76
|
-
offset += len1.byteLength;
|
|
77
|
-
t.false(done1, `readCircBuf ${i} should not be done`);
|
|
78
|
-
const dv1 = new DataView(len1.buffer);
|
|
79
|
-
const buf1 = new Uint8Array(Number(dv1.getBigUint64(0)));
|
|
80
|
-
const { done: done1b } = await readCircBuf(buf1, offset);
|
|
81
|
-
offset += buf1.byteLength;
|
|
82
|
-
t.false(done1b, `readCircBuf ${i} should not be done`);
|
|
83
|
-
const buf1Str = new TextDecoder().decode(buf1);
|
|
84
|
-
t.is(
|
|
85
|
-
buf1Str,
|
|
86
|
-
`\n{"type":"iteration","iteration":${i}}`,
|
|
87
|
-
`iteration ${i} compare failed`,
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const { done: done2 } = await readCircBuf(len1, offset);
|
|
92
|
-
t.assert(done2, `readCircBuf ${last} should be done`);
|
|
93
|
-
|
|
94
|
-
slogSender(null, 'PRE-SERIALIZED');
|
|
95
|
-
await slogSender.forceFlush();
|
|
96
|
-
t.truthy(fs.readFileSync(tmpFile).includes('PRE-SERIALIZED'));
|
|
97
|
-
|
|
98
|
-
slogSender(null, 'PRE_SHUTDOWN');
|
|
99
|
-
const shutdownP = shutdown();
|
|
100
|
-
slogSender(null, 'POST_SHUTDOWN');
|
|
101
|
-
await shutdownP;
|
|
102
|
-
slogSender(null, 'SHUTDOWN_COMPLETED');
|
|
103
|
-
|
|
104
|
-
const finalContent = fs.readFileSync(tmpFile);
|
|
105
|
-
|
|
106
|
-
t.truthy(finalContent.includes('PRE_SHUTDOWN'));
|
|
107
|
-
t.falsy(finalContent.includes('POST_SHUTDOWN'));
|
|
108
|
-
t.falsy(finalContent.includes('SHUTDOWN_COMPLETED'));
|
|
109
|
-
},
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
test('simple', bufferTests, {
|
|
113
|
-
makeBuffer: makeSimpleCircularBuffer,
|
|
114
|
-
});
|
package/test/import.test.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/* global setTimeout */
|
|
2
|
-
import { test } from './prepare-test-env-ava.js';
|
|
3
|
-
|
|
4
|
-
import { getTelemetryProviders } from '../src/index.js';
|
|
5
|
-
|
|
6
|
-
const sleep = timeoutMs =>
|
|
7
|
-
new Promise(resolve => setTimeout(resolve, timeoutMs));
|
|
8
|
-
|
|
9
|
-
test('get telemetry providers', async t => {
|
|
10
|
-
const logged = [];
|
|
11
|
-
const mockConsole = {
|
|
12
|
-
warn: (...args) => {
|
|
13
|
-
logged.push(args);
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
const providers = getTelemetryProviders({ console: mockConsole, env: {} });
|
|
17
|
-
t.is(providers.metricsProvider, undefined);
|
|
18
|
-
|
|
19
|
-
t.deepEqual(logged, []);
|
|
20
|
-
await sleep(250);
|
|
21
|
-
t.deepEqual(logged, []);
|
|
22
|
-
|
|
23
|
-
const providers2 = getTelemetryProviders({
|
|
24
|
-
console: mockConsole,
|
|
25
|
-
env: { OTEL_EXPORTER_PROMETHEUS_PORT: '9393' },
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
t.is(Object(providers2.metricsProvider), providers2.metricsProvider);
|
|
29
|
-
t.is(typeof providers2.metricsProvider, 'object');
|
|
30
|
-
|
|
31
|
-
t.deepEqual(logged, []);
|
|
32
|
-
await sleep(250);
|
|
33
|
-
t.deepEqual(logged, [
|
|
34
|
-
['Prometheus scrape endpoint: http://0.0.0.0:9393/metrics'],
|
|
35
|
-
]);
|
|
36
|
-
});
|