@pydantic/logfire-browser 0.12.3 → 0.14.0
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/dist/index.cjs +1 -1
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +107 -98
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var L=Object.defineProperty;var
|
|
1
|
+
"use strict";var L=Object.defineProperty;var m=(r,e,t)=>e in r?L(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var d=(r,e,t)=>m(r,typeof e!="symbol"?e+"":e,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@opentelemetry/api"),R=require("@opentelemetry/instrumentation"),w=require("@opentelemetry/resources"),l=require("@opentelemetry/sdk-trace-web"),s=require("@opentelemetry/semantic-conventions"),u=require("@opentelemetry/semantic-conventions/incubating"),o=require("logfire"),E=require("@opentelemetry/core"),T=require("@opentelemetry/otlp-exporter-base"),_=require("@opentelemetry/otlp-exporter-base/browser-http"),v=require("@opentelemetry/otlp-transformer"),A="target_xpath",D="event_type",C={1:"trace",5:"debug",9:"info",10:"notice",13:"warning",17:"error",21:"fatal"},S={debug:"#E3E3E3",error:"#EA4335",fatal:"#EA4335",info:"#9EC1FB",notice:"#A5D490","on-debug":"#636262","on-error":"#FFEDE9","on-fatal":"#FFEDE9","on-info":"#063175","on-notice":"#222222","on-trace":"#636262","on-warning":"#613A0D",trace:"#E3E3E3",warning:"#EFB77A"};class x{export(e,t){this.sendSpans(e,t)}forceFlush(){return Promise.resolve()}shutdown(){return this.sendSpans([]),this.forceFlush()}exportInfo(e){var t;return{attributes:e.attributes,duration:E.hrTimeToMicroseconds(e.duration),events:e.events,id:e.spanContext().spanId,instrumentationScope:e.instrumentationScope,kind:e.kind,links:e.links,name:e.name,parentSpanContext:e.parentSpanContext,resource:{attributes:e.resource.attributes},status:e.status,timestamp:E.hrTimeToMicroseconds(e.startTime),traceId:e.spanContext().traceId,traceState:(t=e.spanContext().traceState)==null?void 0:t.serialize()}}sendSpans(e,t){for(const i of e){const n=C[i.attributes["logfire.level_num"]]??"info",{attributes:a,name:f,...g}=this.exportInfo(i);console.log(`%cLogfire %c${n}`,"background-color: #E520E9; color: #FFFFFF",`background-color: ${S[`on-${n}`]}; color: ${S[n]}`,f,a,g)}t&&t({code:E.ExportResultCode.SUCCESS})}}class P{constructor(e,t){d(this,"console");d(this,"wrapped");t&&(this.console=new l.SimpleSpanProcessor(new x)),this.wrapped=e}async forceFlush(){var e;return await((e=this.console)==null?void 0:e.forceFlush()),this.wrapped.forceFlush()}onEnd(e){var t;(t=this.console)==null||t.onEnd(e),this.wrapped.onEnd(e)}onStart(e,t){var i;if(u.ATTR_HTTP_URL in e.attributes){const n=new URL(e.attributes[u.ATTR_HTTP_URL]);Reflect.set(e,"name",`${e.name} ${n.pathname}`)}A in e.attributes&&Reflect.set(e,"name",`${e.attributes[D]??"unknown"} ${e.attributes[A]??""}`),(i=this.console)==null||i.onStart(e,t),this.wrapped.onStart(e,t)}async shutdown(){var e;return await((e=this.console)==null?void 0:e.shutdown()),this.wrapped.shutdown()}}class F extends T.OTLPExporterBase{constructor(e,t){const n={...T.mergeOtlpSharedConfigurationWithDefaults({compression:e.compression,concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis},{},T.getSharedConfigurationDefaults()),agentOptions:{keepAlive:!0},headers:async()=>({"Content-Type":"application/json",...typeof e.headers=="function"?await e.headers():e.headers??{},...(t==null?void 0:t())??{}}),url:e.url??"http://localhost:4318/v1/traces"};super(_.createOtlpXhrExportDelegate(n,v.JsonTraceSerializer))}}function O(){return{}}function h(r){var g,b;r.diagLogLevel!==void 0&&c.diag.setLogger(new c.DiagConsoleLogger,r.diagLogLevel),o.configureLogfireApi({errorFingerprinting:r.errorFingerprinting??!1,scrubbing:r.scrubbing});const e=w.resourceFromAttributes({[u.ATTR_BROWSER_LANGUAGE]:navigator.language,[s.ATTR_SERVICE_NAME]:r.serviceName??"logfire-browser",[s.ATTR_SERVICE_VERSION]:r.serviceVersion??"0.0.1",[s.ATTR_TELEMETRY_SDK_LANGUAGE]:s.TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS,[s.ATTR_TELEMETRY_SDK_NAME]:"logfire-browser",...r.environment?{[u.ATTR_DEPLOYMENT_ENVIRONMENT_NAME]:r.environment}:{},[s.ATTR_TELEMETRY_SDK_VERSION]:"0.14.0",...navigator.userAgentData?{[u.ATTR_BROWSER_BRANDS]:navigator.userAgentData.brands.map(p=>`${p.brand} ${p.version}`),[u.ATTR_BROWSER_MOBILE]:navigator.userAgentData.mobile,[u.ATTR_BROWSER_PLATFORM]:navigator.userAgentData.platform}:{[s.ATTR_USER_AGENT_ORIGINAL]:navigator.userAgent}});c.diag.info("logfire-browser: starting");const t=(g=r.sampling)==null?void 0:g.head,i=t!==void 0&&t<1?new l.ParentBasedSampler({root:new l.TraceIdRatioBasedSampler(t)}):void 0;let n=new P(new l.BatchSpanProcessor(new F({...r.traceExporterConfig,url:r.traceUrl},r.traceExporterHeaders??O),r.batchSpanProcessorConfig),!!r.console);(b=r.sampling)!=null&&b.tail&&(n=new o.TailSamplingProcessor(n,r.sampling.tail));const a=new l.WebTracerProvider({idGenerator:new o.ULIDGenerator,resource:e,...i?{sampler:i}:{},spanProcessors:[n]});a.register({contextManager:r.contextManager??new l.StackContextManager});const f=R.registerInstrumentations({instrumentations:r.instrumentations??[],tracerProvider:a});return async()=>{c.diag.info("logfire-browser: shutting down"),f(),await a.forceFlush(),await a.shutdown(),c.diag.info("logfire-browser: shut down complete")}}const M={configure:h,configureLogfireApi:o.configureLogfireApi,debug:o.debug,DiagLogLevel:c.DiagLogLevel,error:o.error,fatal:o.fatal,info:o.info,Level:o.Level,log:o.log,logfireApiConfig:o.logfireApiConfig,LogfireAttributeScrubber:o.LogfireAttributeScrubber,NoopAttributeScrubber:o.NoopAttributeScrubber,notice:o.notice,reportError:o.reportError,resolveBaseUrl:o.resolveBaseUrl,resolveSendToLogfire:o.resolveSendToLogfire,serializeAttributes:o.serializeAttributes,span:o.span,startSpan:o.startSpan,trace:o.trace,ULIDGenerator:o.ULIDGenerator,warning:o.warning};Object.defineProperty(exports,"DiagLogLevel",{enumerable:!0,get:()=>c.DiagLogLevel});exports.configure=h;exports.default=M;Object.keys(o).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(exports,r)&&Object.defineProperty(exports,r,{enumerable:!0,get:()=>o[r]})});
|
package/dist/index.d.cts
CHANGED
|
@@ -16,6 +16,7 @@ import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
|
16
16
|
import { reportError as reportError_2 } from 'logfire';
|
|
17
17
|
import { resolveBaseUrl } from 'logfire';
|
|
18
18
|
import { resolveSendToLogfire } from 'logfire';
|
|
19
|
+
import { SamplingOptions } from 'logfire';
|
|
19
20
|
import { ScrubbingOptions } from 'logfire';
|
|
20
21
|
import { serializeAttributes } from 'logfire';
|
|
21
22
|
import { span } from 'logfire';
|
|
@@ -84,10 +85,26 @@ export declare interface LogfireConfigOptions {
|
|
|
84
85
|
* Defaults to the `LOGFIRE_ENVIRONMENT` environment variable.
|
|
85
86
|
*/
|
|
86
87
|
environment?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Whether to compute fingerprints for errors reported via reportError().
|
|
90
|
+
* Defaults to false for browser since minified code produces unstable fingerprints.
|
|
91
|
+
*/
|
|
92
|
+
errorFingerprinting?: boolean;
|
|
87
93
|
/**
|
|
88
94
|
* The instrumentations to register - a common one [is the fetch instrumentation](https://www.npmjs.com/package/@opentelemetry/instrumentation-fetch).
|
|
89
95
|
*/
|
|
90
96
|
instrumentations?: (Instrumentation | Instrumentation[])[];
|
|
97
|
+
/**
|
|
98
|
+
* Sampling options for controlling which traces are exported.
|
|
99
|
+
* `head` sets a probabilistic sample rate (0.0-1.0) at trace creation time.
|
|
100
|
+
* `tail` provides a callback evaluated on every span to decide whether to keep the trace.
|
|
101
|
+
*
|
|
102
|
+
* Note: Tail sampling buffers all spans in a trace in memory until either a span meets the
|
|
103
|
+
* sampling criteria or the root span ends. In long-lived browser sessions, this can lead to
|
|
104
|
+
* significant memory usage. Consider using head sampling alone for long-running traces, or
|
|
105
|
+
* ensure tail callbacks accept traces quickly (e.g., on the first error-level span).
|
|
106
|
+
*/
|
|
107
|
+
sampling?: SamplingOptions;
|
|
91
108
|
/**
|
|
92
109
|
* Options for scrubbing sensitive data. Set to False to disable.
|
|
93
110
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
|
16
16
|
import { reportError as reportError_2 } from 'logfire';
|
|
17
17
|
import { resolveBaseUrl } from 'logfire';
|
|
18
18
|
import { resolveSendToLogfire } from 'logfire';
|
|
19
|
+
import { SamplingOptions } from 'logfire';
|
|
19
20
|
import { ScrubbingOptions } from 'logfire';
|
|
20
21
|
import { serializeAttributes } from 'logfire';
|
|
21
22
|
import { span } from 'logfire';
|
|
@@ -84,10 +85,26 @@ export declare interface LogfireConfigOptions {
|
|
|
84
85
|
* Defaults to the `LOGFIRE_ENVIRONMENT` environment variable.
|
|
85
86
|
*/
|
|
86
87
|
environment?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Whether to compute fingerprints for errors reported via reportError().
|
|
90
|
+
* Defaults to false for browser since minified code produces unstable fingerprints.
|
|
91
|
+
*/
|
|
92
|
+
errorFingerprinting?: boolean;
|
|
87
93
|
/**
|
|
88
94
|
* The instrumentations to register - a common one [is the fetch instrumentation](https://www.npmjs.com/package/@opentelemetry/instrumentation-fetch).
|
|
89
95
|
*/
|
|
90
96
|
instrumentations?: (Instrumentation | Instrumentation[])[];
|
|
97
|
+
/**
|
|
98
|
+
* Sampling options for controlling which traces are exported.
|
|
99
|
+
* `head` sets a probabilistic sample rate (0.0-1.0) at trace creation time.
|
|
100
|
+
* `tail` provides a callback evaluated on every span to decide whether to keep the trace.
|
|
101
|
+
*
|
|
102
|
+
* Note: Tail sampling buffers all spans in a trace in memory until either a span meets the
|
|
103
|
+
* sampling criteria or the root span ends. In long-lived browser sessions, this can lead to
|
|
104
|
+
* significant memory usage. Consider using head sampling alone for long-running traces, or
|
|
105
|
+
* ensure tail callbacks accept traces quickly (e.g., on the first error-level span).
|
|
106
|
+
*/
|
|
107
|
+
sampling?: SamplingOptions;
|
|
91
108
|
/**
|
|
92
109
|
* Options for scrubbing sensitive data. Set to False to disable.
|
|
93
110
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { DiagLogLevel as
|
|
5
|
-
import { DiagLogLevel as
|
|
6
|
-
import { registerInstrumentations as
|
|
7
|
-
import { resourceFromAttributes as
|
|
8
|
-
import { SimpleSpanProcessor as
|
|
9
|
-
import { TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS as
|
|
10
|
-
import { ATTR_HTTP_URL as
|
|
11
|
-
import { warning as
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var A = (t, e, r) => e in t ? h(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var l = (t, e, r) => A(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { DiagLogLevel as S, diag as s, DiagConsoleLogger as R } from "@opentelemetry/api";
|
|
5
|
+
import { DiagLogLevel as Oe } from "@opentelemetry/api";
|
|
6
|
+
import { registerInstrumentations as w } from "@opentelemetry/instrumentation";
|
|
7
|
+
import { resourceFromAttributes as _ } from "@opentelemetry/resources";
|
|
8
|
+
import { SimpleSpanProcessor as b, ParentBasedSampler as L, TraceIdRatioBasedSampler as v, BatchSpanProcessor as x, WebTracerProvider as C, StackContextManager as D } from "@opentelemetry/sdk-trace-web";
|
|
9
|
+
import { TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS as F, ATTR_USER_AGENT_ORIGINAL as N, ATTR_TELEMETRY_SDK_VERSION as P, ATTR_TELEMETRY_SDK_NAME as M, ATTR_TELEMETRY_SDK_LANGUAGE as I, ATTR_SERVICE_VERSION as O, ATTR_SERVICE_NAME as B } from "@opentelemetry/semantic-conventions";
|
|
10
|
+
import { ATTR_HTTP_URL as f, ATTR_BROWSER_PLATFORM as y, ATTR_BROWSER_MOBILE as G, ATTR_BROWSER_BRANDS as U, ATTR_DEPLOYMENT_ENVIRONMENT_NAME as $, ATTR_BROWSER_LANGUAGE as k } from "@opentelemetry/semantic-conventions/incubating";
|
|
11
|
+
import { warning as V, ULIDGenerator as T, trace as W, startSpan as Y, span as K, serializeAttributes as z, resolveSendToLogfire as H, resolveBaseUrl as J, reportError as X, notice as j, NoopAttributeScrubber as q, LogfireAttributeScrubber as Q, logfireApiConfig as Z, log as ee, Level as re, info as te, fatal as oe, error as ne, debug as ae, configureLogfireApi as p, TailSamplingProcessor as ie } from "logfire";
|
|
12
12
|
export * from "logfire";
|
|
13
|
-
import { hrTimeToMicroseconds as
|
|
14
|
-
import { OTLPExporterBase as
|
|
15
|
-
import { createOtlpXhrExportDelegate as
|
|
16
|
-
import { JsonTraceSerializer as
|
|
17
|
-
const
|
|
13
|
+
import { hrTimeToMicroseconds as E, ExportResultCode as se } from "@opentelemetry/core";
|
|
14
|
+
import { OTLPExporterBase as ce, mergeOtlpSharedConfigurationWithDefaults as le, getSharedConfigurationDefaults as ue } from "@opentelemetry/otlp-exporter-base";
|
|
15
|
+
import { createOtlpXhrExportDelegate as ge } from "@opentelemetry/otlp-exporter-base/browser-http";
|
|
16
|
+
import { JsonTraceSerializer as fe } from "@opentelemetry/otlp-transformer";
|
|
17
|
+
const m = "target_xpath", Ee = "event_type", me = {
|
|
18
18
|
1: "trace",
|
|
19
19
|
5: "debug",
|
|
20
20
|
9: "info",
|
|
@@ -22,7 +22,7 @@ const l = "target_xpath", ce = "event_type", ue = {
|
|
|
22
22
|
13: "warning",
|
|
23
23
|
17: "error",
|
|
24
24
|
21: "fatal"
|
|
25
|
-
},
|
|
25
|
+
}, d = {
|
|
26
26
|
debug: "#E3E3E3",
|
|
27
27
|
error: "#EA4335",
|
|
28
28
|
fatal: "#EA4335",
|
|
@@ -38,7 +38,7 @@ const l = "target_xpath", ce = "event_type", ue = {
|
|
|
38
38
|
trace: "#E3E3E3",
|
|
39
39
|
warning: "#EFB77A"
|
|
40
40
|
};
|
|
41
|
-
class
|
|
41
|
+
class de {
|
|
42
42
|
export(e, r) {
|
|
43
43
|
this.sendSpans(e, r);
|
|
44
44
|
}
|
|
@@ -56,7 +56,7 @@ class le {
|
|
|
56
56
|
var r;
|
|
57
57
|
return {
|
|
58
58
|
attributes: e.attributes,
|
|
59
|
-
duration:
|
|
59
|
+
duration: E(e.duration),
|
|
60
60
|
events: e.events,
|
|
61
61
|
id: e.spanContext().spanId,
|
|
62
62
|
instrumentationScope: e.instrumentationScope,
|
|
@@ -68,31 +68,31 @@ class le {
|
|
|
68
68
|
attributes: e.resource.attributes
|
|
69
69
|
},
|
|
70
70
|
status: e.status,
|
|
71
|
-
timestamp:
|
|
71
|
+
timestamp: E(e.startTime),
|
|
72
72
|
traceId: e.spanContext().traceId,
|
|
73
73
|
traceState: (r = e.spanContext().traceState) == null ? void 0 : r.serialize()
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
sendSpans(e, r) {
|
|
77
77
|
for (const n of e) {
|
|
78
|
-
const o =
|
|
78
|
+
const o = me[n.attributes["logfire.level_num"]] ?? "info", { attributes: a, name: c, ...i } = this.exportInfo(n);
|
|
79
79
|
console.log(
|
|
80
80
|
`%cLogfire %c${o}`,
|
|
81
81
|
"background-color: #E520E9; color: #FFFFFF",
|
|
82
|
-
`background-color: ${
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
`background-color: ${d[`on-${o}`]}; color: ${d[o]}`,
|
|
83
|
+
c,
|
|
84
|
+
a,
|
|
85
|
+
i
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
|
-
r && r({ code:
|
|
88
|
+
r && r({ code: se.SUCCESS });
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
class
|
|
91
|
+
class Te {
|
|
92
92
|
constructor(e, r) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
r && (this.console = new
|
|
93
|
+
l(this, "console");
|
|
94
|
+
l(this, "wrapped");
|
|
95
|
+
r && (this.console = new b(new de())), this.wrapped = e;
|
|
96
96
|
}
|
|
97
97
|
async forceFlush() {
|
|
98
98
|
var e;
|
|
@@ -104,28 +104,28 @@ class fe {
|
|
|
104
104
|
}
|
|
105
105
|
onStart(e, r) {
|
|
106
106
|
var n;
|
|
107
|
-
if (
|
|
108
|
-
const o = new URL(e.attributes[
|
|
107
|
+
if (f in e.attributes) {
|
|
108
|
+
const o = new URL(e.attributes[f]);
|
|
109
109
|
Reflect.set(e, "name", `${e.name} ${o.pathname}`);
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
m in e.attributes && Reflect.set(e, "name", `${e.attributes[Ee] ?? "unknown"} ${e.attributes[m] ?? ""}`), (n = this.console) == null || n.onStart(e, r), this.wrapped.onStart(e, r);
|
|
112
112
|
}
|
|
113
113
|
async shutdown() {
|
|
114
114
|
var e;
|
|
115
115
|
return await ((e = this.console) == null ? void 0 : e.shutdown()), this.wrapped.shutdown();
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
class
|
|
118
|
+
class pe extends ce {
|
|
119
119
|
constructor(e, r) {
|
|
120
120
|
const o = {
|
|
121
|
-
...
|
|
121
|
+
...le(
|
|
122
122
|
{
|
|
123
123
|
compression: e.compression,
|
|
124
124
|
concurrencyLimit: e.concurrencyLimit,
|
|
125
125
|
timeoutMillis: e.timeoutMillis
|
|
126
126
|
},
|
|
127
127
|
{},
|
|
128
|
-
|
|
128
|
+
ue()
|
|
129
129
|
),
|
|
130
130
|
agentOptions: { keepAlive: !0 },
|
|
131
131
|
headers: async () => ({
|
|
@@ -135,86 +135,95 @@ class Ee extends oe {
|
|
|
135
135
|
}),
|
|
136
136
|
url: e.url ?? "http://localhost:4318/v1/traces"
|
|
137
137
|
};
|
|
138
|
-
super(
|
|
138
|
+
super(ge(o, fe));
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function he() {
|
|
142
142
|
return {};
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
[
|
|
152
|
-
|
|
144
|
+
function Ae(t) {
|
|
145
|
+
var i, u;
|
|
146
|
+
t.diagLogLevel !== void 0 && s.setLogger(new R(), t.diagLogLevel), p({
|
|
147
|
+
errorFingerprinting: t.errorFingerprinting ?? !1,
|
|
148
|
+
scrubbing: t.scrubbing
|
|
149
|
+
});
|
|
150
|
+
const e = _({
|
|
151
|
+
[k]: navigator.language,
|
|
152
|
+
[B]: t.serviceName ?? "logfire-browser",
|
|
153
|
+
[O]: t.serviceVersion ?? "0.0.1",
|
|
154
|
+
[I]: F,
|
|
155
|
+
[M]: "logfire-browser",
|
|
156
|
+
...t.environment ? { [$]: t.environment } : {},
|
|
153
157
|
// eslint-disable-next-line no-undef
|
|
154
|
-
[
|
|
158
|
+
[P]: "0.14.0",
|
|
155
159
|
...navigator.userAgentData ? {
|
|
156
|
-
[
|
|
157
|
-
[
|
|
158
|
-
[
|
|
160
|
+
[U]: navigator.userAgentData.brands.map((g) => `${g.brand} ${g.version}`),
|
|
161
|
+
[G]: navigator.userAgentData.mobile,
|
|
162
|
+
[y]: navigator.userAgentData.platform
|
|
159
163
|
} : {
|
|
160
|
-
[
|
|
164
|
+
[N]: navigator.userAgent
|
|
161
165
|
}
|
|
162
166
|
});
|
|
163
|
-
|
|
164
|
-
const r = new
|
|
165
|
-
|
|
167
|
+
s.info("logfire-browser: starting");
|
|
168
|
+
const r = (i = t.sampling) == null ? void 0 : i.head, n = r !== void 0 && r < 1 ? new L({ root: new v(r) }) : void 0;
|
|
169
|
+
let o = new Te(
|
|
170
|
+
new x(
|
|
171
|
+
new pe(
|
|
172
|
+
{ ...t.traceExporterConfig, url: t.traceUrl },
|
|
173
|
+
t.traceExporterHeaders ?? he
|
|
174
|
+
),
|
|
175
|
+
t.batchSpanProcessorConfig
|
|
176
|
+
),
|
|
177
|
+
!!t.console
|
|
178
|
+
);
|
|
179
|
+
(u = t.sampling) != null && u.tail && (o = new ie(
|
|
180
|
+
o,
|
|
181
|
+
t.sampling.tail
|
|
182
|
+
));
|
|
183
|
+
const a = new C({
|
|
184
|
+
idGenerator: new T(),
|
|
166
185
|
resource: e,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
new w(
|
|
170
|
-
new Ee(
|
|
171
|
-
{ ...t.traceExporterConfig, url: t.traceUrl },
|
|
172
|
-
t.traceExporterHeaders ?? ge
|
|
173
|
-
),
|
|
174
|
-
t.batchSpanProcessorConfig
|
|
175
|
-
),
|
|
176
|
-
!!t.console
|
|
177
|
-
)
|
|
178
|
-
]
|
|
186
|
+
...n ? { sampler: n } : {},
|
|
187
|
+
spanProcessors: [o]
|
|
179
188
|
});
|
|
180
|
-
|
|
181
|
-
contextManager: t.contextManager ?? new
|
|
189
|
+
a.register({
|
|
190
|
+
contextManager: t.contextManager ?? new D()
|
|
182
191
|
});
|
|
183
|
-
const
|
|
192
|
+
const c = w({
|
|
184
193
|
instrumentations: t.instrumentations ?? [],
|
|
185
|
-
tracerProvider:
|
|
194
|
+
tracerProvider: a
|
|
186
195
|
});
|
|
187
196
|
return async () => {
|
|
188
|
-
|
|
197
|
+
s.info("logfire-browser: shutting down"), c(), await a.forceFlush(), await a.shutdown(), s.info("logfire-browser: shut down complete");
|
|
189
198
|
};
|
|
190
199
|
}
|
|
191
|
-
const
|
|
192
|
-
configure:
|
|
193
|
-
configureLogfireApi:
|
|
194
|
-
debug:
|
|
195
|
-
DiagLogLevel:
|
|
196
|
-
error:
|
|
197
|
-
fatal:
|
|
198
|
-
info:
|
|
200
|
+
const Pe = {
|
|
201
|
+
configure: Ae,
|
|
202
|
+
configureLogfireApi: p,
|
|
203
|
+
debug: ae,
|
|
204
|
+
DiagLogLevel: S,
|
|
205
|
+
error: ne,
|
|
206
|
+
fatal: oe,
|
|
207
|
+
info: te,
|
|
199
208
|
// Re-export all from logfire
|
|
200
|
-
Level:
|
|
201
|
-
log:
|
|
202
|
-
logfireApiConfig:
|
|
203
|
-
LogfireAttributeScrubber:
|
|
204
|
-
NoopAttributeScrubber:
|
|
205
|
-
notice:
|
|
206
|
-
reportError:
|
|
207
|
-
resolveBaseUrl:
|
|
208
|
-
resolveSendToLogfire:
|
|
209
|
-
serializeAttributes:
|
|
210
|
-
span:
|
|
211
|
-
startSpan:
|
|
212
|
-
trace:
|
|
213
|
-
ULIDGenerator:
|
|
214
|
-
warning:
|
|
209
|
+
Level: re,
|
|
210
|
+
log: ee,
|
|
211
|
+
logfireApiConfig: Z,
|
|
212
|
+
LogfireAttributeScrubber: Q,
|
|
213
|
+
NoopAttributeScrubber: q,
|
|
214
|
+
notice: j,
|
|
215
|
+
reportError: X,
|
|
216
|
+
resolveBaseUrl: J,
|
|
217
|
+
resolveSendToLogfire: H,
|
|
218
|
+
serializeAttributes: z,
|
|
219
|
+
span: K,
|
|
220
|
+
startSpan: Y,
|
|
221
|
+
trace: W,
|
|
222
|
+
ULIDGenerator: T,
|
|
223
|
+
warning: V
|
|
215
224
|
};
|
|
216
225
|
export {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
226
|
+
Oe as DiagLogLevel,
|
|
227
|
+
Ae as configure,
|
|
228
|
+
Pe as default
|
|
220
229
|
};
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"stats",
|
|
26
26
|
"monitoring"
|
|
27
27
|
],
|
|
28
|
-
"version": "0.
|
|
28
|
+
"version": "0.14.0",
|
|
29
29
|
"type": "module",
|
|
30
30
|
"main": "./dist/index.cjs",
|
|
31
31
|
"module": "./dist/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@opentelemetry/otlp-exporter-base": "^0.209.0",
|
|
51
51
|
"@opentelemetry/otlp-transformer": "^0.209.0",
|
|
52
52
|
"@opentelemetry/resources": "^2.0.1",
|
|
53
|
-
"logfire": "0.
|
|
53
|
+
"logfire": "0.13.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@opentelemetry/sdk-trace-web": "^2.0.1",
|