@logbrew/sdk 0.1.38 → 0.1.39
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/automatic-delivery.cjs +271 -0
- package/batch-sender.cjs +164 -0
- package/bounded-number.cjs +34 -0
- package/browser-breadcrumbs.cjs +346 -136
- package/capture-support.cjs +100 -0
- package/client-options.cjs +292 -0
- package/client-report.cjs +232 -0
- package/client.cjs +447 -0
- package/console-arguments.cjs +151 -0
- package/console-capture.cjs +194 -0
- package/core.cjs +30 -2810
- package/delivery-health.cjs +133 -0
- package/error-causes.cjs +130 -0
- package/error-details.cjs +124 -0
- package/error-issue.cjs +187 -0
- package/event-clone.cjs +55 -0
- package/event-metadata.cjs +40 -0
- package/event-pipeline.cjs +325 -0
- package/event-queue.cjs +306 -0
- package/event-store.cjs +237 -0
- package/event-validation.cjs +159 -0
- package/examples/agent-timeline.cjs +57 -46
- package/examples/agent-timeline.mjs +41 -35
- package/examples/index.mjs +122 -94
- package/examples/readme-example.cjs +36 -27
- package/examples/readme-example.mjs +21 -17
- package/examples/real-user-smoke.cjs +41 -32
- package/examples/real-user-smoke.mjs +26 -22
- package/exception-chain.cjs +205 -0
- package/index.d.ts +144 -1076
- package/index.js +1 -1
- package/issue-exception.cjs +13 -8
- package/metric-validation.cjs +95 -0
- package/network-milestone.cjs +155 -0
- package/null-value.cjs +4 -0
- package/opentelemetry-bridge.cjs +330 -0
- package/opentelemetry-context.cjs +245 -0
- package/opentelemetry-exceptions.cjs +69 -0
- package/opentelemetry-keys.cjs +183 -0
- package/opentelemetry-span.cjs +286 -0
- package/opentelemetry-summary.cjs +213 -0
- package/opentelemetry-time.cjs +131 -0
- package/opentelemetry.cjs +99 -1068
- package/package.json +55 -1
- package/pino-destination.cjs +108 -0
- package/pino-record.cjs +237 -0
- package/product-action.cjs +163 -0
- package/provided-breadcrumbs.cjs +117 -0
- package/random-hex.cjs +29 -0
- package/react-native.js +1 -1
- package/recording-transport.cjs +68 -0
- package/release-artifacts-build.cjs +263 -84
- package/release-artifacts-common.js +347 -66
- package/release-artifacts-debug-id.js +178 -0
- package/release-artifacts-inspect.js +213 -0
- package/release-artifacts-issue-event.js +99 -0
- package/release-artifacts-manifest-artifact.js +107 -0
- package/release-artifacts-manifest.js +77 -0
- package/release-artifacts-mappings.js +265 -0
- package/release-artifacts-prepare.js +297 -0
- package/release-artifacts-source-context.js +210 -0
- package/release-artifacts-symbolication.js +272 -421
- package/release-artifacts-upload-files.js +122 -0
- package/release-artifacts-upload-request.js +246 -0
- package/release-artifacts-upload.js +155 -300
- package/release-artifacts-urls.js +49 -0
- package/release-artifacts.js +189 -662
- package/retry-delay.cjs +32 -0
- package/span-validation.cjs +191 -0
- package/stored-events.cjs +243 -0
- package/types/client.d.ts +67 -0
- package/types/delivery.d.ts +125 -0
- package/types/issues.d.ts +249 -0
- package/types/logging.d.ts +175 -0
- package/types/opentelemetry.d.ts +205 -0
- package/types/product.d.ts +128 -0
- package/types/recording-transport.d.ts +15 -0
- package/types/sdk-error.d.ts +9 -0
- package/types/telemetry.d.ts +171 -0
- package/types/trace-context.d.ts +110 -0
- package/types/transport-error.d.ts +10 -0
- package/utf8.cjs +37 -0
- package/validation.cjs +49 -1
- package/vite-release-artifacts-config.cjs +120 -0
- package/vite-release-artifacts.cjs +199 -99
- package/vite-release-artifacts.d.cts +65 -40
- package/vite-release-artifacts.d.ts +65 -40
- package/vite-release-artifacts.js +2 -2
- package/winston-info.cjs +205 -0
- package/winston.cjs +189 -289
package/examples/index.mjs
CHANGED
|
@@ -8,131 +8,159 @@ const installedHelperPrefix = "npm --prefix node_modules/@logbrew/sdk/examples r
|
|
|
8
8
|
const installedPnpmHelperPrefix = "pnpm --dir node_modules/@logbrew/sdk/examples run";
|
|
9
9
|
const installedLauncherPrefix = "node node_modules/@logbrew/sdk/examples/index.mjs";
|
|
10
10
|
const repoLauncherPrefix = "node examples/index.mjs";
|
|
11
|
+
const defaultExample = "real-user-smoke";
|
|
12
|
+
const FIRST_ARGUMENT = 2;
|
|
13
|
+
const EXIT_OK = 0;
|
|
14
|
+
const EXIT_UNKNOWN_EXAMPLE = 1;
|
|
11
15
|
|
|
12
|
-
const
|
|
13
|
-
"agent-timeline"
|
|
14
|
-
"agent-timeline:esm"
|
|
15
|
-
"agent-timeline:cjs"
|
|
16
|
-
"readme-example"
|
|
17
|
-
"readme-example:esm"
|
|
18
|
-
"readme-example:cjs"
|
|
19
|
-
"real-user-smoke"
|
|
20
|
-
"real-user-smoke:esm"
|
|
21
|
-
"real-user-smoke:cjs"
|
|
22
|
-
|
|
16
|
+
const exampleNames = Object.freeze([
|
|
17
|
+
"agent-timeline",
|
|
18
|
+
"agent-timeline:esm",
|
|
19
|
+
"agent-timeline:cjs",
|
|
20
|
+
"readme-example",
|
|
21
|
+
"readme-example:esm",
|
|
22
|
+
"readme-example:cjs",
|
|
23
|
+
"real-user-smoke",
|
|
24
|
+
"real-user-smoke:esm",
|
|
25
|
+
"real-user-smoke:cjs"
|
|
26
|
+
]);
|
|
23
27
|
|
|
28
|
+
/**
|
|
29
|
+
* @param {string} name
|
|
30
|
+
* @returns {URL}
|
|
31
|
+
*/
|
|
32
|
+
function exampleUrl(name) {
|
|
33
|
+
const [file = name, format = "esm"] = name.split(":");
|
|
34
|
+
return new URL(`${file}.${format === "cjs" ? "cjs" : "mjs"}`, import.meta.url);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const examples = new Map(exampleNames.map((name) => [name, exampleUrl(name)]));
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} name
|
|
41
|
+
* @param {string} command
|
|
42
|
+
* @returns {readonly [string, string]}
|
|
43
|
+
*/
|
|
44
|
+
function commandEntry(name, command) {
|
|
45
|
+
return [name, command];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @returns {boolean}
|
|
50
|
+
*/
|
|
24
51
|
function isInstalledPackageContext() {
|
|
25
52
|
return import.meta.url.includes("/node_modules/@logbrew/sdk/examples/");
|
|
26
53
|
}
|
|
27
54
|
|
|
55
|
+
/**
|
|
56
|
+
* @returns {readonly (readonly [string, string])[]}
|
|
57
|
+
*/
|
|
28
58
|
function exampleCommands() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"readme-example": `${repoPrefix} && ${repoLauncherPrefix} readme-example`,
|
|
35
|
-
"readme-example:esm": `${repoPrefix} && ${repoLauncherPrefix} readme-example:esm`,
|
|
36
|
-
"readme-example:cjs": `${repoPrefix} && ${repoLauncherPrefix} readme-example:cjs`,
|
|
37
|
-
"real-user-smoke": `${repoPrefix} && ${repoLauncherPrefix} real-user-smoke`,
|
|
38
|
-
"real-user-smoke:esm": `${repoPrefix} && ${repoLauncherPrefix} real-user-smoke:esm`,
|
|
39
|
-
"real-user-smoke:cjs": `${repoPrefix} && ${repoLauncherPrefix} real-user-smoke:cjs`,
|
|
40
|
-
"default (real-user-smoke)": `${repoPrefix} && ${repoLauncherPrefix}`
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
"agent-timeline": `${installedLauncherPrefix} agent-timeline`,
|
|
46
|
-
"agent-timeline:esm": `${installedLauncherPrefix} agent-timeline:esm`,
|
|
47
|
-
"agent-timeline:cjs": `${installedLauncherPrefix} agent-timeline:cjs`,
|
|
48
|
-
"readme-example": `${installedLauncherPrefix} readme-example`,
|
|
49
|
-
"readme-example:esm": `${installedLauncherPrefix} readme-example:esm`,
|
|
50
|
-
"readme-example:cjs": `${installedLauncherPrefix} readme-example:cjs`,
|
|
51
|
-
"real-user-smoke": `${installedLauncherPrefix} real-user-smoke`,
|
|
52
|
-
"real-user-smoke:esm": `${installedLauncherPrefix} real-user-smoke:esm`,
|
|
53
|
-
"real-user-smoke:cjs": `${installedLauncherPrefix} real-user-smoke:cjs`,
|
|
54
|
-
"default (real-user-smoke)": installedLauncherPrefix
|
|
55
|
-
};
|
|
59
|
+
const launcher = isInstalledPackageContext() ? installedLauncherPrefix : `${repoPrefix} && ${repoLauncherPrefix}`;
|
|
60
|
+
return [
|
|
61
|
+
...exampleNames.map((name) => commandEntry(name, `${launcher} ${name}`)),
|
|
62
|
+
commandEntry(`default (${defaultExample})`, launcher)
|
|
63
|
+
];
|
|
56
64
|
}
|
|
57
65
|
|
|
66
|
+
/**
|
|
67
|
+
* @returns {readonly (readonly [string, string])[]}
|
|
68
|
+
*/
|
|
58
69
|
function helperCommands() {
|
|
59
|
-
if (
|
|
60
|
-
return {
|
|
61
|
-
"agent-timeline": `${repoExamplesPrefix} && ${repoNpmHelperPrefix} agent-timeline | ${repoExamplesPrefix} && ${repoPnpmHelperPrefix} agent-timeline`,
|
|
62
|
-
"agent-timeline:esm": `${repoExamplesPrefix} && ${repoNpmHelperPrefix} agent-timeline:esm | ${repoExamplesPrefix} && ${repoPnpmHelperPrefix} agent-timeline:esm`,
|
|
63
|
-
"agent-timeline:cjs": `${repoExamplesPrefix} && ${repoNpmHelperPrefix} agent-timeline:cjs | ${repoExamplesPrefix} && ${repoPnpmHelperPrefix} agent-timeline:cjs`,
|
|
64
|
-
"readme-example": `${repoExamplesPrefix} && ${repoNpmHelperPrefix} readme-example | ${repoExamplesPrefix} && ${repoPnpmHelperPrefix} readme-example`,
|
|
65
|
-
"readme-example:esm": `${repoExamplesPrefix} && ${repoNpmHelperPrefix} readme-example:esm | ${repoExamplesPrefix} && ${repoPnpmHelperPrefix} readme-example:esm`,
|
|
66
|
-
"readme-example:cjs": `${repoExamplesPrefix} && ${repoNpmHelperPrefix} readme-example:cjs | ${repoExamplesPrefix} && ${repoPnpmHelperPrefix} readme-example:cjs`,
|
|
67
|
-
"real-user-smoke": `${repoExamplesPrefix} && ${repoNpmHelperPrefix} real-user-smoke | ${repoExamplesPrefix} && ${repoPnpmHelperPrefix} real-user-smoke`,
|
|
68
|
-
"real-user-smoke:esm": `${repoExamplesPrefix} && ${repoNpmHelperPrefix} real-user-smoke:esm | ${repoExamplesPrefix} && ${repoPnpmHelperPrefix} real-user-smoke:esm`,
|
|
69
|
-
"real-user-smoke:cjs": `${repoExamplesPrefix} && ${repoNpmHelperPrefix} real-user-smoke:cjs | ${repoExamplesPrefix} && ${repoPnpmHelperPrefix} real-user-smoke:cjs`
|
|
70
|
-
};
|
|
70
|
+
if (isInstalledPackageContext()) {
|
|
71
|
+
return exampleNames.map((name) => commandEntry(name, `${installedHelperPrefix} ${name} | ${installedPnpmHelperPrefix} ${name}`));
|
|
71
72
|
}
|
|
73
|
+
return exampleNames.map((name) => commandEntry(
|
|
74
|
+
name,
|
|
75
|
+
`${repoExamplesPrefix} && ${repoNpmHelperPrefix} ${name} | ${repoExamplesPrefix} && ${repoPnpmHelperPrefix} ${name}`
|
|
76
|
+
));
|
|
77
|
+
}
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"readme-example:cjs": `${installedHelperPrefix} readme-example:cjs | ${installedPnpmHelperPrefix} readme-example:cjs`,
|
|
80
|
-
"real-user-smoke": `${installedHelperPrefix} real-user-smoke | ${installedPnpmHelperPrefix} real-user-smoke`,
|
|
81
|
-
"real-user-smoke:esm": `${installedHelperPrefix} real-user-smoke:esm | ${installedPnpmHelperPrefix} real-user-smoke:esm`,
|
|
82
|
-
"real-user-smoke:cjs": `${installedHelperPrefix} real-user-smoke:cjs | ${installedPnpmHelperPrefix} real-user-smoke:cjs`
|
|
83
|
-
};
|
|
79
|
+
/**
|
|
80
|
+
* @param {string} line
|
|
81
|
+
* @returns {void}
|
|
82
|
+
*/
|
|
83
|
+
function print(line) {
|
|
84
|
+
process.stdout.write(`${line}\n`);
|
|
84
85
|
}
|
|
85
86
|
|
|
87
|
+
/**
|
|
88
|
+
* @returns {void}
|
|
89
|
+
*/
|
|
86
90
|
function printList() {
|
|
87
|
-
for (const [name, command] of
|
|
88
|
-
|
|
91
|
+
for (const [name, command] of exampleCommands()) {
|
|
92
|
+
print(`${name} -> ${command}`);
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
95
|
|
|
92
|
-
|
|
96
|
+
/**
|
|
97
|
+
* @returns {void}
|
|
98
|
+
*/
|
|
99
|
+
function printUsage() {
|
|
93
100
|
if (isInstalledPackageContext()) {
|
|
94
|
-
|
|
95
|
-
|
|
101
|
+
print("Usage: node node_modules/@logbrew/sdk/examples/index.mjs [--list] [example]");
|
|
102
|
+
print("Run the packaged LogBrew SDK JavaScript examples that ship with the installed package.");
|
|
96
103
|
} else {
|
|
97
|
-
|
|
98
|
-
|
|
104
|
+
print("Usage: node examples/index.mjs [--list] [example]");
|
|
105
|
+
print("Run the repo-checkout LogBrew SDK JavaScript examples before install.");
|
|
99
106
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @param {string} title
|
|
111
|
+
* @param {readonly (readonly [string, string])[]} commands
|
|
112
|
+
* @returns {void}
|
|
113
|
+
*/
|
|
114
|
+
function printSection(title, commands) {
|
|
115
|
+
print("");
|
|
116
|
+
print(title);
|
|
117
|
+
for (const [name, command] of commands) {
|
|
118
|
+
print(` ${name} -> ${command}`);
|
|
104
119
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @returns {void}
|
|
124
|
+
*/
|
|
125
|
+
function printHelp() {
|
|
126
|
+
printUsage();
|
|
127
|
+
printSection("Launcher commands:", exampleCommands());
|
|
128
|
+
printSection("Package-manager helper commands:", helperCommands());
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @param {string} example
|
|
133
|
+
* @returns {Promise<number>}
|
|
134
|
+
*/
|
|
135
|
+
async function runExample(example) {
|
|
136
|
+
const target = examples.get(example);
|
|
137
|
+
if (target === undefined) {
|
|
138
|
+
process.stderr.write(`unknown example: ${example}\n`);
|
|
139
|
+
printHelp();
|
|
140
|
+
return EXIT_UNKNOWN_EXAMPLE;
|
|
109
141
|
}
|
|
142
|
+
await import(target.href);
|
|
143
|
+
return EXIT_OK;
|
|
110
144
|
}
|
|
111
145
|
|
|
112
|
-
|
|
146
|
+
/**
|
|
147
|
+
* @param {readonly string[]} argv
|
|
148
|
+
* @returns {Promise<number>}
|
|
149
|
+
*/
|
|
150
|
+
async function main(argv) {
|
|
113
151
|
if (argv.includes("--help") || argv.includes("-h")) {
|
|
114
152
|
printHelp();
|
|
115
|
-
return
|
|
153
|
+
return EXIT_OK;
|
|
116
154
|
}
|
|
117
|
-
|
|
118
155
|
if (argv.includes("--list")) {
|
|
119
156
|
printList();
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const [example = "real-user-smoke"] = argv;
|
|
124
|
-
const target = examples[example];
|
|
125
|
-
if (!target) {
|
|
126
|
-
console.error(`unknown example: ${example}`);
|
|
127
|
-
printHelp();
|
|
128
|
-
return 1;
|
|
157
|
+
return EXIT_OK;
|
|
129
158
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return 0;
|
|
159
|
+
const [example = defaultExample] = argv;
|
|
160
|
+
return runExample(example);
|
|
133
161
|
}
|
|
134
162
|
|
|
135
|
-
const exitCode = await main();
|
|
136
|
-
if (exitCode !==
|
|
137
|
-
process.
|
|
163
|
+
const exitCode = await main(process.argv.slice(FIRST_ARGUMENT));
|
|
164
|
+
if (exitCode !== EXIT_OK) {
|
|
165
|
+
process.exitCode = exitCode;
|
|
138
166
|
}
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} catch (error) {
|
|
5
|
-
if (error && error.code === "MODULE_NOT_FOUND") {
|
|
6
|
-
sdk = require("../index.cjs");
|
|
7
|
-
} else {
|
|
8
|
-
throw error;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
const { LogBrewClient, RecordingTransport } = require("../index.cjs");
|
|
2
|
+
const { inspect } = require("node:util");
|
|
3
|
+
const process = require("node:process");
|
|
11
4
|
|
|
12
|
-
const
|
|
5
|
+
const QUEUED_EVENTS = 6;
|
|
13
6
|
|
|
14
7
|
const client = LogBrewClient.create({
|
|
15
8
|
apiKey: "LOGBREW_API_KEY",
|
|
@@ -18,42 +11,58 @@ const client = LogBrewClient.create({
|
|
|
18
11
|
});
|
|
19
12
|
|
|
20
13
|
client.release("evt_release_001", "2026-06-02T10:00:00Z", {
|
|
21
|
-
version: "1.2.3",
|
|
22
14
|
commit: "abc123def456",
|
|
23
|
-
notes: "Public release marker"
|
|
15
|
+
notes: "Public release marker",
|
|
16
|
+
version: "1.2.3"
|
|
24
17
|
});
|
|
25
18
|
client.environment("evt_environment_001", "2026-06-02T10:00:01Z", {
|
|
26
19
|
name: "production",
|
|
27
20
|
region: "global"
|
|
28
21
|
});
|
|
29
22
|
client.issue("evt_issue_001", "2026-06-02T10:00:02Z", {
|
|
30
|
-
title: "Checkout timeout",
|
|
31
23
|
level: "error",
|
|
32
|
-
message: "Request timed out after retry budget"
|
|
24
|
+
message: "Request timed out after retry budget",
|
|
25
|
+
title: "Checkout timeout"
|
|
33
26
|
});
|
|
34
27
|
client.log("evt_log_001", "2026-06-02T10:00:03Z", {
|
|
35
|
-
message: "worker started",
|
|
36
28
|
level: "info",
|
|
37
|
-
logger: "job-runner"
|
|
29
|
+
logger: "job-runner",
|
|
30
|
+
message: "worker started"
|
|
38
31
|
});
|
|
39
32
|
client.span("evt_span_001", "2026-06-02T10:00:04Z", {
|
|
33
|
+
durationMs: 12.5,
|
|
40
34
|
name: "GET /health",
|
|
41
|
-
traceId: "trace_001",
|
|
42
35
|
spanId: "span_001",
|
|
43
36
|
status: "ok",
|
|
44
|
-
|
|
37
|
+
traceId: "trace_001"
|
|
45
38
|
});
|
|
46
39
|
client.action("evt_action_001", "2026-06-02T10:00:05Z", {
|
|
47
40
|
name: "deploy",
|
|
48
41
|
status: "success"
|
|
49
42
|
});
|
|
50
43
|
|
|
51
|
-
|
|
44
|
+
process.stdout.write(`${client.previewJson()}\n`);
|
|
52
45
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
/**
|
|
47
|
+
* @returns {Promise<void>}
|
|
48
|
+
*/
|
|
49
|
+
async function deliver() {
|
|
50
|
+
try {
|
|
51
|
+
const transport = RecordingTransport.alwaysAccept();
|
|
52
|
+
const response = await client.shutdown(transport);
|
|
53
|
+
process.stderr.write(`${JSON.stringify({
|
|
54
|
+
ok: true,
|
|
55
|
+
|
|
56
|
+
status: response.statusCode,
|
|
57
|
+
|
|
58
|
+
attempts: response.attempts,
|
|
59
|
+
|
|
60
|
+
events: QUEUED_EVENTS
|
|
61
|
+
})}\n`);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
process.stderr.write(`${inspect(error)}\n`);
|
|
64
|
+
process.exitCode = 1;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
void deliver();
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return import("../index.js");
|
|
4
|
-
}
|
|
5
|
-
throw error;
|
|
6
|
-
});
|
|
1
|
+
import { LogBrewClient, RecordingTransport } from "../index.js";
|
|
2
|
+
import process from "node:process";
|
|
7
3
|
|
|
8
|
-
const
|
|
4
|
+
const QUEUED_EVENTS = 6;
|
|
9
5
|
|
|
10
6
|
const client = LogBrewClient.create({
|
|
11
7
|
apiKey: "LOGBREW_API_KEY",
|
|
@@ -14,38 +10,46 @@ const client = LogBrewClient.create({
|
|
|
14
10
|
});
|
|
15
11
|
|
|
16
12
|
client.release("evt_release_001", "2026-06-02T10:00:00Z", {
|
|
17
|
-
version: "1.2.3",
|
|
18
13
|
commit: "abc123def456",
|
|
19
|
-
notes: "Public release marker"
|
|
14
|
+
notes: "Public release marker",
|
|
15
|
+
version: "1.2.3"
|
|
20
16
|
});
|
|
21
17
|
client.environment("evt_environment_001", "2026-06-02T10:00:01Z", {
|
|
22
18
|
name: "production",
|
|
23
19
|
region: "global"
|
|
24
20
|
});
|
|
25
21
|
client.issue("evt_issue_001", "2026-06-02T10:00:02Z", {
|
|
26
|
-
title: "Checkout timeout",
|
|
27
22
|
level: "error",
|
|
28
|
-
message: "Request timed out after retry budget"
|
|
23
|
+
message: "Request timed out after retry budget",
|
|
24
|
+
title: "Checkout timeout"
|
|
29
25
|
});
|
|
30
26
|
client.log("evt_log_001", "2026-06-02T10:00:03Z", {
|
|
31
|
-
message: "worker started",
|
|
32
27
|
level: "info",
|
|
33
|
-
logger: "job-runner"
|
|
28
|
+
logger: "job-runner",
|
|
29
|
+
message: "worker started"
|
|
34
30
|
});
|
|
35
31
|
client.span("evt_span_001", "2026-06-02T10:00:04Z", {
|
|
32
|
+
durationMs: 12.5,
|
|
36
33
|
name: "GET /health",
|
|
37
|
-
traceId: "trace_001",
|
|
38
34
|
spanId: "span_001",
|
|
39
35
|
status: "ok",
|
|
40
|
-
|
|
36
|
+
traceId: "trace_001"
|
|
41
37
|
});
|
|
42
38
|
client.action("evt_action_001", "2026-06-02T10:00:05Z", {
|
|
43
39
|
name: "deploy",
|
|
44
40
|
status: "success"
|
|
45
41
|
});
|
|
46
42
|
|
|
47
|
-
|
|
43
|
+
process.stdout.write(`${client.previewJson()}\n`);
|
|
48
44
|
|
|
49
45
|
const transport = RecordingTransport.alwaysAccept();
|
|
50
46
|
const response = await client.shutdown(transport);
|
|
51
|
-
|
|
47
|
+
process.stderr.write(`${JSON.stringify({
|
|
48
|
+
ok: true,
|
|
49
|
+
|
|
50
|
+
status: response.statusCode,
|
|
51
|
+
|
|
52
|
+
attempts: response.attempts,
|
|
53
|
+
|
|
54
|
+
events: QUEUED_EVENTS
|
|
55
|
+
})}\n`);
|
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} catch (error) {
|
|
5
|
-
if (error && error.code === "MODULE_NOT_FOUND") {
|
|
6
|
-
sdk = require("../index.cjs");
|
|
7
|
-
} else {
|
|
8
|
-
throw error;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
const { LogBrewClient, RecordingTransport, createTraceContextHeaders, createTraceparentHeaders } = require("../index.cjs");
|
|
2
|
+
const { inspect } = require("node:util");
|
|
3
|
+
const process = require("node:process");
|
|
11
4
|
|
|
12
|
-
const
|
|
5
|
+
const QUEUED_EVENTS = 6;
|
|
13
6
|
|
|
14
7
|
const outgoingHeaders = createTraceparentHeaders({
|
|
15
|
-
traceId: "4bf92f3577b34da6a3ce929d0e0e4736",
|
|
16
8
|
spanId: "b7ad6b7169203331",
|
|
17
|
-
traceFlags: "01"
|
|
9
|
+
traceFlags: "01",
|
|
10
|
+
traceId: "4bf92f3577b34da6a3ce929d0e0e4736"
|
|
18
11
|
});
|
|
19
12
|
if (outgoingHeaders.traceparent !== "00-4bf92f3577b34da6a3ce929d0e0e4736-b7ad6b7169203331-01") {
|
|
20
13
|
throw new Error("createTraceparentHeaders produced an unexpected carrier");
|
|
21
14
|
}
|
|
22
15
|
const outgoingContextHeaders = createTraceContextHeaders({
|
|
23
|
-
|
|
16
|
+
baggage: [{ key: "release", value: "checkout@1.2.3" }],
|
|
24
17
|
spanId: "b7ad6b7169203331",
|
|
25
18
|
traceFlags: "01",
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
traceId: "4bf92f3577b34da6a3ce929d0e0e4736",
|
|
20
|
+
tracestate: [{ key: "rojo", value: "00f067aa0ba902b7" }]
|
|
28
21
|
});
|
|
29
22
|
if (
|
|
30
23
|
outgoingContextHeaders.traceparent !== outgoingHeaders.traceparent
|
|
@@ -41,42 +34,58 @@ const client = LogBrewClient.create({
|
|
|
41
34
|
});
|
|
42
35
|
|
|
43
36
|
client.release("evt_release_001", "2026-06-02T10:00:00Z", {
|
|
44
|
-
version: "1.2.3",
|
|
45
37
|
commit: "abc123def456",
|
|
46
|
-
notes: "Public release marker"
|
|
38
|
+
notes: "Public release marker",
|
|
39
|
+
version: "1.2.3"
|
|
47
40
|
});
|
|
48
41
|
client.environment("evt_environment_001", "2026-06-02T10:00:01Z", {
|
|
49
42
|
name: "production",
|
|
50
43
|
region: "global"
|
|
51
44
|
});
|
|
52
45
|
client.issue("evt_issue_001", "2026-06-02T10:00:02Z", {
|
|
53
|
-
title: "Checkout timeout",
|
|
54
46
|
level: "error",
|
|
55
|
-
message: "Request timed out after retry budget"
|
|
47
|
+
message: "Request timed out after retry budget",
|
|
48
|
+
title: "Checkout timeout"
|
|
56
49
|
});
|
|
57
50
|
client.log("evt_log_001", "2026-06-02T10:00:03Z", {
|
|
58
|
-
message: "worker started",
|
|
59
51
|
level: "info",
|
|
60
|
-
logger: "job-runner"
|
|
52
|
+
logger: "job-runner",
|
|
53
|
+
message: "worker started"
|
|
61
54
|
});
|
|
62
55
|
client.span("evt_span_001", "2026-06-02T10:00:04Z", {
|
|
56
|
+
durationMs: 12.5,
|
|
63
57
|
name: "GET /health",
|
|
64
|
-
traceId: "trace_001",
|
|
65
58
|
spanId: "span_001",
|
|
66
59
|
status: "ok",
|
|
67
|
-
|
|
60
|
+
traceId: "trace_001"
|
|
68
61
|
});
|
|
69
62
|
client.action("evt_action_001", "2026-06-02T10:00:05Z", {
|
|
70
63
|
name: "deploy",
|
|
71
64
|
status: "success"
|
|
72
65
|
});
|
|
73
66
|
|
|
74
|
-
|
|
67
|
+
process.stdout.write(`${client.previewJson()}\n`);
|
|
75
68
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
69
|
+
/**
|
|
70
|
+
* @returns {Promise<void>}
|
|
71
|
+
*/
|
|
72
|
+
async function deliver() {
|
|
73
|
+
try {
|
|
74
|
+
const transport = RecordingTransport.alwaysAccept();
|
|
75
|
+
const response = await client.shutdown(transport);
|
|
76
|
+
process.stderr.write(`${JSON.stringify({
|
|
77
|
+
ok: true,
|
|
78
|
+
|
|
79
|
+
status: response.statusCode,
|
|
80
|
+
|
|
81
|
+
attempts: response.attempts,
|
|
82
|
+
|
|
83
|
+
events: QUEUED_EVENTS
|
|
84
|
+
})}\n`);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
process.stderr.write(`${inspect(error)}\n`);
|
|
87
|
+
process.exitCode = 1;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
void deliver();
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return import("../index.js");
|
|
4
|
-
}
|
|
5
|
-
throw error;
|
|
6
|
-
});
|
|
1
|
+
import { LogBrewClient, RecordingTransport, createTraceContextHeaders, createTraceparentHeaders } from "../index.js";
|
|
2
|
+
import process from "node:process";
|
|
7
3
|
|
|
8
|
-
const
|
|
4
|
+
const QUEUED_EVENTS = 6;
|
|
9
5
|
|
|
10
6
|
const outgoingHeaders = createTraceparentHeaders({
|
|
11
|
-
traceId: "4bf92f3577b34da6a3ce929d0e0e4736",
|
|
12
7
|
spanId: "b7ad6b7169203331",
|
|
13
|
-
traceFlags: "01"
|
|
8
|
+
traceFlags: "01",
|
|
9
|
+
traceId: "4bf92f3577b34da6a3ce929d0e0e4736"
|
|
14
10
|
});
|
|
15
11
|
if (outgoingHeaders.traceparent !== "00-4bf92f3577b34da6a3ce929d0e0e4736-b7ad6b7169203331-01") {
|
|
16
12
|
throw new Error("createTraceparentHeaders produced an unexpected carrier");
|
|
17
13
|
}
|
|
18
14
|
const outgoingContextHeaders = createTraceContextHeaders({
|
|
19
|
-
|
|
15
|
+
baggage: [{ key: "release", value: "checkout@1.2.3" }],
|
|
20
16
|
spanId: "b7ad6b7169203331",
|
|
21
17
|
traceFlags: "01",
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
traceId: "4bf92f3577b34da6a3ce929d0e0e4736",
|
|
19
|
+
tracestate: [{ key: "rojo", value: "00f067aa0ba902b7" }]
|
|
24
20
|
});
|
|
25
21
|
if (
|
|
26
22
|
outgoingContextHeaders.traceparent !== outgoingHeaders.traceparent
|
|
@@ -37,38 +33,46 @@ const client = LogBrewClient.create({
|
|
|
37
33
|
});
|
|
38
34
|
|
|
39
35
|
client.release("evt_release_001", "2026-06-02T10:00:00Z", {
|
|
40
|
-
version: "1.2.3",
|
|
41
36
|
commit: "abc123def456",
|
|
42
|
-
notes: "Public release marker"
|
|
37
|
+
notes: "Public release marker",
|
|
38
|
+
version: "1.2.3"
|
|
43
39
|
});
|
|
44
40
|
client.environment("evt_environment_001", "2026-06-02T10:00:01Z", {
|
|
45
41
|
name: "production",
|
|
46
42
|
region: "global"
|
|
47
43
|
});
|
|
48
44
|
client.issue("evt_issue_001", "2026-06-02T10:00:02Z", {
|
|
49
|
-
title: "Checkout timeout",
|
|
50
45
|
level: "error",
|
|
51
|
-
message: "Request timed out after retry budget"
|
|
46
|
+
message: "Request timed out after retry budget",
|
|
47
|
+
title: "Checkout timeout"
|
|
52
48
|
});
|
|
53
49
|
client.log("evt_log_001", "2026-06-02T10:00:03Z", {
|
|
54
|
-
message: "worker started",
|
|
55
50
|
level: "info",
|
|
56
|
-
logger: "job-runner"
|
|
51
|
+
logger: "job-runner",
|
|
52
|
+
message: "worker started"
|
|
57
53
|
});
|
|
58
54
|
client.span("evt_span_001", "2026-06-02T10:00:04Z", {
|
|
55
|
+
durationMs: 12.5,
|
|
59
56
|
name: "GET /health",
|
|
60
|
-
traceId: "trace_001",
|
|
61
57
|
spanId: "span_001",
|
|
62
58
|
status: "ok",
|
|
63
|
-
|
|
59
|
+
traceId: "trace_001"
|
|
64
60
|
});
|
|
65
61
|
client.action("evt_action_001", "2026-06-02T10:00:05Z", {
|
|
66
62
|
name: "deploy",
|
|
67
63
|
status: "success"
|
|
68
64
|
});
|
|
69
65
|
|
|
70
|
-
|
|
66
|
+
process.stdout.write(`${client.previewJson()}\n`);
|
|
71
67
|
|
|
72
68
|
const transport = RecordingTransport.alwaysAccept();
|
|
73
69
|
const response = await client.shutdown(transport);
|
|
74
|
-
|
|
70
|
+
process.stderr.write(`${JSON.stringify({
|
|
71
|
+
ok: true,
|
|
72
|
+
|
|
73
|
+
status: response.statusCode,
|
|
74
|
+
|
|
75
|
+
attempts: response.attempts,
|
|
76
|
+
|
|
77
|
+
events: QUEUED_EVENTS
|
|
78
|
+
})}\n`);
|