@mark1russell7/otel-ts 0.8.5 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -0
- package/dist/error-record.d.ts +127 -0
- package/dist/error-record.d.ts.map +1 -0
- package/dist/error-record.js +227 -0
- package/dist/error-record.js.map +1 -0
- package/dist/error-view.d.ts +91 -0
- package/dist/error-view.d.ts.map +1 -0
- package/dist/error-view.js +339 -0
- package/dist/error-view.js.map +1 -0
- package/dist/init.js +7 -2
- package/dist/init.js.map +1 -1
- package/package.json +10 -1
- package/src/error-record.ts +306 -0
- package/src/error-view.ts +387 -0
- package/src/init.ts +8 -2
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The entry `@mark1russell7/otel-ts/error-view`: one view of an error record, as a custom element with no framework.
|
|
3
|
+
*
|
|
4
|
+
* The element shows the record of `@mark1russell7/otel-ts/error`:
|
|
5
|
+
* - the message in plain words, the procedure and the time;
|
|
6
|
+
* - the actions: retry, copy the whole record, report it, and open its trace;
|
|
7
|
+
* - the details: each id, the context keys and the cause chain.
|
|
8
|
+
*
|
|
9
|
+
* The element does no network call. Retry and report are events: the page decides what they do. Copy writes the
|
|
10
|
+
* text of `errorRecordText()` to the clipboard. The trace link comes from the attribute `trace-url`, a template with
|
|
11
|
+
* `{traceId}` and `{spanId}`.
|
|
12
|
+
*
|
|
13
|
+
* The import registers nothing. Call `defineErrorView()` one time, or register `ErrorViewElement` with a name of
|
|
14
|
+
* your own.
|
|
15
|
+
*
|
|
16
|
+
* Colors follow the `color-scheme` of the page, with `light-dark()`. A page sets the custom properties
|
|
17
|
+
* `--otel-error-*` to use its own colors.
|
|
18
|
+
*
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
import { errorRecordText, redactErrorRecord } from "./error-record.js";
|
|
22
|
+
/** The default name of the element */
|
|
23
|
+
export const ERROR_VIEW_TAG = "otel-error";
|
|
24
|
+
/**
|
|
25
|
+
* The link of a trace from a template, for example `https://grafana.example/explore?trace={traceId}`. It gives
|
|
26
|
+
* undefined with no trace id, and for a link that is not `http:` or `https:`.
|
|
27
|
+
*/
|
|
28
|
+
export function traceLink(template, record, base) {
|
|
29
|
+
if (!template || record.traceId === undefined)
|
|
30
|
+
return undefined;
|
|
31
|
+
const href = template
|
|
32
|
+
.replaceAll("{traceId}", encodeURIComponent(record.traceId))
|
|
33
|
+
.replaceAll("{spanId}", encodeURIComponent(record.spanId ?? ""));
|
|
34
|
+
try {
|
|
35
|
+
const url = base === undefined ? new URL(href) : new URL(href, base);
|
|
36
|
+
return url.protocol === "https:" || url.protocol === "http:" ? url.href : undefined;
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const STYLE = `
|
|
43
|
+
:host {
|
|
44
|
+
--_bg: var(--otel-error-bg, light-dark(#fff7f7, #241417));
|
|
45
|
+
--_ink: var(--otel-error-ink, light-dark(#1b1d24, #f1e9ea));
|
|
46
|
+
--_muted: var(--otel-error-muted, light-dark(#5b5f6b, #b9adb0));
|
|
47
|
+
--_rule: var(--otel-error-rule, light-dark(#efc9cb, #57323a));
|
|
48
|
+
--_accent: var(--otel-error-accent, light-dark(#b3261e, #ff8a85));
|
|
49
|
+
--_accent-ink: var(--otel-error-accent-ink, light-dark(#ffffff, #23090b));
|
|
50
|
+
--_focus: var(--otel-error-focus, light-dark(#2346c4, #93abff));
|
|
51
|
+
--_mono: var(--otel-error-mono, ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace);
|
|
52
|
+
display: block;
|
|
53
|
+
container-type: inline-size;
|
|
54
|
+
font: inherit;
|
|
55
|
+
color: var(--_ink);
|
|
56
|
+
}
|
|
57
|
+
:host([hidden]) { display: none; }
|
|
58
|
+
.box {
|
|
59
|
+
background: var(--_bg);
|
|
60
|
+
border: 1px solid var(--_rule);
|
|
61
|
+
border-inline-start: 4px solid var(--_accent);
|
|
62
|
+
border-radius: var(--otel-error-radius, 8px);
|
|
63
|
+
padding: 14px 16px;
|
|
64
|
+
display: grid;
|
|
65
|
+
gap: 10px;
|
|
66
|
+
}
|
|
67
|
+
.head { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
|
|
68
|
+
.icon { width: 22px; height: 22px; color: var(--_accent); flex: none; margin-top: 1px; }
|
|
69
|
+
.title { margin: 0; font-size: 1rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
|
|
70
|
+
.meta { margin: 2px 0 0; color: var(--_muted); font-size: 0.875rem; overflow-wrap: anywhere; }
|
|
71
|
+
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
|
|
72
|
+
button, a.trace {
|
|
73
|
+
font: inherit; font-size: 0.875rem; line-height: 1.2;
|
|
74
|
+
min-height: 36px; padding: 8px 14px; border-radius: 6px;
|
|
75
|
+
border: 1px solid var(--_rule); background: transparent; color: var(--_ink);
|
|
76
|
+
cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
|
|
77
|
+
}
|
|
78
|
+
button.primary { background: var(--_accent); border-color: var(--_accent); color: var(--_accent-ink); font-weight: 600; }
|
|
79
|
+
button:hover, a.trace:hover { border-color: var(--_accent); }
|
|
80
|
+
button:focus-visible, a.trace:focus-visible, summary:focus-visible, textarea:focus-visible { outline: 2px solid var(--_focus); outline-offset: 2px; }
|
|
81
|
+
button[aria-disabled="true"] { opacity: 0.6; cursor: progress; }
|
|
82
|
+
.status { margin: 0; min-height: 1.2em; font-size: 0.8125rem; color: var(--_muted); }
|
|
83
|
+
.status:empty { display: none; }
|
|
84
|
+
details { border-top: 1px solid var(--_rule); padding-top: 8px; }
|
|
85
|
+
summary { cursor: pointer; font-size: 0.875rem; color: var(--_muted); width: fit-content; border-radius: 4px; }
|
|
86
|
+
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 10px 0 0; font-size: 0.8125rem; }
|
|
87
|
+
dt { color: var(--_muted); }
|
|
88
|
+
dd { margin: 0; font-family: var(--_mono); overflow-wrap: anywhere; }
|
|
89
|
+
ol { margin: 10px 0 0; padding-inline-start: 20px; font-size: 0.8125rem; display: grid; gap: 4px; }
|
|
90
|
+
ol .via { color: var(--_muted); }
|
|
91
|
+
textarea {
|
|
92
|
+
width: 100%; box-sizing: border-box; margin-top: 10px; min-height: 8em; resize: vertical;
|
|
93
|
+
font: 0.75rem/1.4 var(--_mono); color: var(--_ink); background: transparent;
|
|
94
|
+
border: 1px solid var(--_rule); border-radius: 6px; padding: 8px;
|
|
95
|
+
}
|
|
96
|
+
@container (max-width: 420px) {
|
|
97
|
+
dl { grid-template-columns: 1fr; gap: 0; }
|
|
98
|
+
dd { margin-bottom: 6px; }
|
|
99
|
+
.actions > * { flex: 1 1 auto; justify-content: center; }
|
|
100
|
+
}
|
|
101
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
102
|
+
button, a.trace { transition: border-color 120ms ease; }
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
const ICON = '<svg class="icon" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9.5"/><path d="M12 7.5v5.5"/><path d="M12 16.5h.01"/></svg>';
|
|
106
|
+
/** A local time for people, with the ISO text as its title */
|
|
107
|
+
function timeText(at) {
|
|
108
|
+
const date = new Date(at);
|
|
109
|
+
if (Number.isNaN(date.getTime()))
|
|
110
|
+
return at;
|
|
111
|
+
return date.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit", second: "2-digit" });
|
|
112
|
+
}
|
|
113
|
+
/** The base class: `HTMLElement` in a browser, a stand-in in Node.js, so that an import on a server does not throw */
|
|
114
|
+
const ElementBase = globalThis.HTMLElement ?? class {
|
|
115
|
+
};
|
|
116
|
+
/** The element of one error record. Set `record` to show it. */
|
|
117
|
+
export class ErrorViewElement extends ElementBase {
|
|
118
|
+
static get observedAttributes() {
|
|
119
|
+
return ["trace-url", "trace-target", "retry", "report", "summary", "open"];
|
|
120
|
+
}
|
|
121
|
+
#record;
|
|
122
|
+
#busy = false;
|
|
123
|
+
#status = "";
|
|
124
|
+
#root;
|
|
125
|
+
constructor() {
|
|
126
|
+
super();
|
|
127
|
+
this.#root = this.attachShadow({ mode: "open" });
|
|
128
|
+
}
|
|
129
|
+
/** The record that the element shows */
|
|
130
|
+
get record() {
|
|
131
|
+
return this.#record;
|
|
132
|
+
}
|
|
133
|
+
/** The setter keeps the redacted copy of the record (`redactErrorRecord`), so the view, the copy and the report hold no secret. */
|
|
134
|
+
set record(record) {
|
|
135
|
+
this.#record = record === undefined ? undefined : redactErrorRecord(record);
|
|
136
|
+
this.#busy = false;
|
|
137
|
+
this.#status = "";
|
|
138
|
+
this.#render();
|
|
139
|
+
}
|
|
140
|
+
/** The text of the record, as the copy action gives it */
|
|
141
|
+
get text() {
|
|
142
|
+
return this.#record ? errorRecordText(this.#record) : "";
|
|
143
|
+
}
|
|
144
|
+
connectedCallback() {
|
|
145
|
+
if (!this.hasAttribute("role"))
|
|
146
|
+
this.setAttribute("role", "alert");
|
|
147
|
+
this.#render();
|
|
148
|
+
}
|
|
149
|
+
attributeChangedCallback() {
|
|
150
|
+
this.#render();
|
|
151
|
+
}
|
|
152
|
+
/** Copy the text of the record. It gives true when the clipboard took it. */
|
|
153
|
+
async copy() {
|
|
154
|
+
const record = this.#record;
|
|
155
|
+
if (!record)
|
|
156
|
+
return false;
|
|
157
|
+
const text = errorRecordText(record);
|
|
158
|
+
let copied = false;
|
|
159
|
+
try {
|
|
160
|
+
await navigator.clipboard.writeText(text);
|
|
161
|
+
copied = true;
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
copied = false;
|
|
165
|
+
}
|
|
166
|
+
this.#setStatus(copied ? "The details are on the clipboard." : "The clipboard is not available. Select the text below and copy it.");
|
|
167
|
+
if (!copied)
|
|
168
|
+
this.#showText();
|
|
169
|
+
this.dispatchEvent(new CustomEvent("otel-error-copy", { detail: { record, text, copied }, bubbles: true, composed: true }));
|
|
170
|
+
return copied;
|
|
171
|
+
}
|
|
172
|
+
#setStatus(text) {
|
|
173
|
+
this.#status = text;
|
|
174
|
+
const status = this.#root.querySelector(".status");
|
|
175
|
+
if (status)
|
|
176
|
+
status.textContent = text;
|
|
177
|
+
}
|
|
178
|
+
#showText() {
|
|
179
|
+
const details = this.#root.querySelector("details");
|
|
180
|
+
const area = this.#root.querySelector("textarea");
|
|
181
|
+
if (details)
|
|
182
|
+
details.open = true;
|
|
183
|
+
if (area) {
|
|
184
|
+
area.hidden = false;
|
|
185
|
+
area.focus();
|
|
186
|
+
area.select();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
#retry() {
|
|
190
|
+
const record = this.#record;
|
|
191
|
+
if (!record || this.#busy)
|
|
192
|
+
return;
|
|
193
|
+
let wait;
|
|
194
|
+
this.dispatchEvent(new CustomEvent("otel-error-retry", {
|
|
195
|
+
detail: { record, waitUntil: (promise) => void (wait = promise) },
|
|
196
|
+
bubbles: true,
|
|
197
|
+
composed: true,
|
|
198
|
+
}));
|
|
199
|
+
if (!wait)
|
|
200
|
+
return;
|
|
201
|
+
this.#busy = true;
|
|
202
|
+
this.#render();
|
|
203
|
+
const settle = () => {
|
|
204
|
+
// A new record during the retry already cleared the busy state
|
|
205
|
+
if (this.#record !== record)
|
|
206
|
+
return;
|
|
207
|
+
this.#busy = false;
|
|
208
|
+
this.#render();
|
|
209
|
+
};
|
|
210
|
+
wait.then(settle, settle);
|
|
211
|
+
}
|
|
212
|
+
#report() {
|
|
213
|
+
const record = this.#record;
|
|
214
|
+
if (!record)
|
|
215
|
+
return;
|
|
216
|
+
this.dispatchEvent(new CustomEvent("otel-error-report", { detail: { record, text: errorRecordText(record) }, bubbles: true, composed: true }));
|
|
217
|
+
}
|
|
218
|
+
#render() {
|
|
219
|
+
const root = this.#root;
|
|
220
|
+
const record = this.#record;
|
|
221
|
+
const wasOpen = root.querySelector("details")?.open ?? this.hasAttribute("open");
|
|
222
|
+
// A render keeps the focus on the same action, so a keyboard user does not lose the place
|
|
223
|
+
const focused = root.activeElement?.dataset?.["action"];
|
|
224
|
+
root.replaceChildren();
|
|
225
|
+
const style = document.createElement("style");
|
|
226
|
+
style.textContent = STYLE;
|
|
227
|
+
root.append(style);
|
|
228
|
+
if (!record)
|
|
229
|
+
return;
|
|
230
|
+
const make = (tag, props = {}, ...children) => {
|
|
231
|
+
const node = Object.assign(document.createElement(tag), props);
|
|
232
|
+
node.append(...children);
|
|
233
|
+
return node;
|
|
234
|
+
};
|
|
235
|
+
const box = make("div", { className: "box" });
|
|
236
|
+
box.setAttribute("part", "box");
|
|
237
|
+
const head = make("div", { className: "head" });
|
|
238
|
+
const icon = document.createElement("template");
|
|
239
|
+
icon.innerHTML = ICON;
|
|
240
|
+
const summary = this.getAttribute("summary");
|
|
241
|
+
const meta = [];
|
|
242
|
+
if (summary)
|
|
243
|
+
meta.push(record.message);
|
|
244
|
+
if (record.procedure)
|
|
245
|
+
meta.push(record.procedure.name);
|
|
246
|
+
meta.push(timeText(record.at));
|
|
247
|
+
if (record.code)
|
|
248
|
+
meta.push(record.code);
|
|
249
|
+
head.append(icon.content, make("div", {}, make("p", { className: "title", textContent: summary || record.message || record.name }), make("p", { className: "meta", textContent: meta.join(" · ") })));
|
|
250
|
+
box.append(head);
|
|
251
|
+
const actions = make("div", { className: "actions" });
|
|
252
|
+
if (this.hasAttribute("retry")) {
|
|
253
|
+
const retry = make("button", { type: "button", className: "primary", textContent: this.#busy ? "Retrying…" : "Retry" });
|
|
254
|
+
if (this.#busy)
|
|
255
|
+
retry.setAttribute("aria-disabled", "true");
|
|
256
|
+
retry.dataset["action"] = "retry";
|
|
257
|
+
retry.addEventListener("click", () => this.#retry());
|
|
258
|
+
actions.append(retry);
|
|
259
|
+
}
|
|
260
|
+
const copy = make("button", { type: "button", textContent: "Copy details" });
|
|
261
|
+
copy.dataset["action"] = "copy";
|
|
262
|
+
copy.addEventListener("click", () => void this.copy());
|
|
263
|
+
actions.append(copy);
|
|
264
|
+
if (this.hasAttribute("report")) {
|
|
265
|
+
const report = make("button", { type: "button", textContent: this.getAttribute("report") || "Report" });
|
|
266
|
+
report.dataset["action"] = "report";
|
|
267
|
+
report.addEventListener("click", () => this.#report());
|
|
268
|
+
actions.append(report);
|
|
269
|
+
}
|
|
270
|
+
const href = traceLink(this.getAttribute("trace-url"), record, document.baseURI);
|
|
271
|
+
if (href) {
|
|
272
|
+
// The default opens the trace in a new tab. `trace-target="_self"` opens it in the page, for example a view of the page.
|
|
273
|
+
const target = this.getAttribute("trace-target") || "_blank";
|
|
274
|
+
const link = make("a", { className: "trace", href, textContent: "Open the trace" });
|
|
275
|
+
if (target !== "_self")
|
|
276
|
+
Object.assign(link, { target, rel: "noopener noreferrer" });
|
|
277
|
+
link.dataset["action"] = "trace";
|
|
278
|
+
actions.append(link);
|
|
279
|
+
}
|
|
280
|
+
box.append(actions);
|
|
281
|
+
const status = make("p", { className: "status", textContent: this.#status });
|
|
282
|
+
status.setAttribute("role", "status");
|
|
283
|
+
box.append(status);
|
|
284
|
+
const rows = [
|
|
285
|
+
["Trace", record.traceId],
|
|
286
|
+
["Span", record.spanId],
|
|
287
|
+
["Procedure", record.procedure?.name],
|
|
288
|
+
["Input digest", record.procedure?.inputDigest],
|
|
289
|
+
...Object.entries(record.context),
|
|
290
|
+
...Object.entries(record.attributes ?? {}).map(([key, value]) => [key, String(value)]),
|
|
291
|
+
["Time", record.at],
|
|
292
|
+
["Record", record.id],
|
|
293
|
+
];
|
|
294
|
+
const list = make("dl");
|
|
295
|
+
for (const [label, value] of rows)
|
|
296
|
+
if (value !== undefined && value !== "")
|
|
297
|
+
list.append(make("dt", { textContent: label }), make("dd", { textContent: value }));
|
|
298
|
+
const details = make("details", { open: wasOpen }, make("summary", { textContent: "Details" }), list);
|
|
299
|
+
if (record.causes.length > 1) {
|
|
300
|
+
const causes = make("ol");
|
|
301
|
+
causes.setAttribute("aria-label", "The causes");
|
|
302
|
+
for (const cause of record.causes.slice(1))
|
|
303
|
+
causes.append(make("li", {}, `${cause.name}: ${cause.message}`, make("span", { className: "via", textContent: cause.via ? ` (${cause.via})` : "" })));
|
|
304
|
+
details.append(causes);
|
|
305
|
+
}
|
|
306
|
+
const area = make("textarea", { readOnly: true, hidden: true, value: errorRecordText(record) });
|
|
307
|
+
area.setAttribute("aria-label", "The details as text");
|
|
308
|
+
details.append(area);
|
|
309
|
+
box.append(details);
|
|
310
|
+
root.append(box);
|
|
311
|
+
if (focused)
|
|
312
|
+
root.querySelector(`[data-action="${focused}"]`)?.focus();
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/** Register the element under `name`, one time. A second call with the same name does nothing. */
|
|
316
|
+
export function defineErrorView(name = ERROR_VIEW_TAG) {
|
|
317
|
+
if (!customElements.get(name))
|
|
318
|
+
customElements.define(name, class extends ErrorViewElement {
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
/** Make an element for `record`. It registers the element first, when it is not registered. */
|
|
322
|
+
export function errorView(record, options = {}) {
|
|
323
|
+
const tag = options.tag ?? ERROR_VIEW_TAG;
|
|
324
|
+
defineErrorView(tag);
|
|
325
|
+
const element = document.createElement(tag);
|
|
326
|
+
if (options.retry)
|
|
327
|
+
element.setAttribute("retry", "");
|
|
328
|
+
if (options.report)
|
|
329
|
+
element.setAttribute("report", options.report === true ? "" : options.report);
|
|
330
|
+
if (options.traceUrl)
|
|
331
|
+
element.setAttribute("trace-url", options.traceUrl);
|
|
332
|
+
if (options.traceTarget)
|
|
333
|
+
element.setAttribute("trace-target", options.traceTarget);
|
|
334
|
+
if (options.summary)
|
|
335
|
+
element.setAttribute("summary", options.summary);
|
|
336
|
+
element.record = record;
|
|
337
|
+
return element;
|
|
338
|
+
}
|
|
339
|
+
//# sourceMappingURL=error-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-view.js","sourceRoot":"","sources":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QAAQ,CAAC,aAAa,CAAC,GAAG,CAAqB,CAAC;IAChE,IAAI,OAAO,CAAC,KAAK;QAAE,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACrD,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAClG,IAAI,OAAO,CAAC,QAAQ;QAAE,OAAO,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1E,IAAI,OAAO,CAAC,WAAW;QAAE,OAAO,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACnF,IAAI,OAAO,CAAC,OAAO;QAAE,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACtE,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/init.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { context, propagation, trace } from "@opentelemetry/api";
|
|
1
|
+
import { context, logs, propagation, trace } from "@opentelemetry/api";
|
|
2
2
|
import { MeterProvider } from "@opentelemetry/sdk-metrics";
|
|
3
3
|
import { LoggerProvider } from "@opentelemetry/sdk-logs";
|
|
4
4
|
import { buildResource } from "./resource.js";
|
|
@@ -91,7 +91,7 @@ export function initWith(managers, config) {
|
|
|
91
91
|
function releaseContext(releaseRegistration) {
|
|
92
92
|
if (!releaseRegistration)
|
|
93
93
|
return;
|
|
94
|
-
for (const api of [trace, propagation, context])
|
|
94
|
+
for (const api of [trace, propagation, context, logs])
|
|
95
95
|
api.disable();
|
|
96
96
|
releaseRegistration();
|
|
97
97
|
}
|
|
@@ -117,6 +117,11 @@ function startInstance(resolved, contextManager, releaseRegistration, providers)
|
|
|
117
117
|
? setupLogs(resource, resolved, getSessionId)
|
|
118
118
|
: new LoggerProvider();
|
|
119
119
|
providers.push(loggerProvider);
|
|
120
|
+
// The owner of the globals also registers its logger provider, so a library
|
|
121
|
+
// that logs through the API (for example reportError of /error) reaches it
|
|
122
|
+
if (releaseRegistration && resolved.logs) {
|
|
123
|
+
logs.setGlobalLoggerProvider(loggerProvider);
|
|
124
|
+
}
|
|
120
125
|
// After the tracing, so Faro reads the context of otel-ts
|
|
121
126
|
if (faroUrl) {
|
|
122
127
|
setupFaro(resolved, faroUrl);
|
package/dist/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EACL,oBAAoB,GAErB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC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|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@mark1russell7/otel-ts",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.7",
|
|
5
5
|
"description": "Frontend observability in one init() call — OpenTelemetry + Grafana Faro for any TypeScript web app",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Mark Russell (https://github.com/mark1russell7)",
|
|
@@ -55,6 +55,14 @@
|
|
|
55
55
|
"./pull": {
|
|
56
56
|
"types": "./dist/pull.d.ts",
|
|
57
57
|
"import": "./dist/pull.js"
|
|
58
|
+
},
|
|
59
|
+
"./error": {
|
|
60
|
+
"types": "./dist/error-record.d.ts",
|
|
61
|
+
"import": "./dist/error-record.js"
|
|
62
|
+
},
|
|
63
|
+
"./error-view": {
|
|
64
|
+
"types": "./dist/error-view.d.ts",
|
|
65
|
+
"import": "./dist/error-view.js"
|
|
58
66
|
}
|
|
59
67
|
},
|
|
60
68
|
"files": [
|
|
@@ -64,6 +72,7 @@
|
|
|
64
72
|
],
|
|
65
73
|
"sideEffects": false,
|
|
66
74
|
"dependencies": {
|
|
75
|
+
"@mark1russell7/text": "^0.0.18",
|
|
67
76
|
"@grafana/faro-web-sdk": "^2.13.0",
|
|
68
77
|
"@opentelemetry/api": "^1.10.0",
|
|
69
78
|
"@opentelemetry/auto-instrumentations-web": "^0.70.1",
|