@pydantic/logfire-browser 0.10.0 → 0.11.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 +21 -21
- package/dist/index.d.ts +21 -21
- package/dist/index.js +4 -4
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var L=Object.defineProperty;var S=(r,e,t)=>e in r?L(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var l=(r,e,t)=>S(r,typeof e!="symbol"?e+"":e,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("@opentelemetry/api"),h=require("@opentelemetry/instrumentation"),_=require("@opentelemetry/resources"),u=require("@opentelemetry/sdk-trace-web"),a=require("@opentelemetry/semantic-conventions"),c=require("@opentelemetry/semantic-conventions/incubating"),o=require("
|
|
1
|
+
"use strict";var L=Object.defineProperty;var S=(r,e,t)=>e in r?L(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var l=(r,e,t)=>S(r,typeof e!="symbol"?e+"":e,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("@opentelemetry/api"),h=require("@opentelemetry/instrumentation"),_=require("@opentelemetry/resources"),u=require("@opentelemetry/sdk-trace-web"),a=require("@opentelemetry/semantic-conventions"),c=require("@opentelemetry/semantic-conventions/incubating"),o=require("logfire"),g=require("@opentelemetry/core"),f=require("@opentelemetry/otlp-exporter-base"),R=require("@opentelemetry/otlp-exporter-base/browser-http"),m=require("@opentelemetry/otlp-transformer"),E="target_xpath",w="event_type",v={1:"trace",5:"debug",9:"info",10:"notice",13:"warning",17:"error",21:"fatal"},d={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 D{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:g.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:g.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=v[i.attributes["logfire.level_num"]]??"info",{attributes:b,name:A,...p}=this.exportInfo(i);console.log(`%cLogfire %c${n}`,"background-color: #E520E9; color: #FFFFFF",`background-color: ${d[`on-${n}`]}; color: ${d[n]}`,A,b,p)}t&&t({code:g.ExportResultCode.SUCCESS})}}class C{constructor(e,t){l(this,"console");l(this,"wrapped");t&&(this.console=new u.SimpleSpanProcessor(new D)),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(c.ATTR_HTTP_URL in e.attributes){const n=new URL(e.attributes[c.ATTR_HTTP_URL]);Reflect.set(e,"name",`${e.name} ${n.pathname}`)}E in e.attributes&&Reflect.set(e,"name",`${e.attributes[w]??"unknown"} ${e.attributes[E]??""}`),(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 x extends f.OTLPExporterBase{constructor(e,t){const n={...f.mergeOtlpSharedConfigurationWithDefaults({compression:e.compression,concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis},{},f.getSharedConfigurationDefaults()),agentOptions:{keepAlive:!0},headers:()=>({"Content-Type":"application/json",...e.headers??{},...t?t():{}}),url:e.url??"http://localhost:4318/v1/traces"};super(R.createOtlpXhrExportDelegate(n,m.JsonTraceSerializer))}}function O(){return{}}function T(r){r.diagLogLevel!==void 0&&s.diag.setLogger(new s.DiagConsoleLogger,r.diagLogLevel),r.scrubbing!==void 0&&o.configureLogfireApi({scrubbing:r.scrubbing});const e=_.resourceFromAttributes({[c.ATTR_BROWSER_LANGUAGE]:navigator.language,[a.ATTR_SERVICE_NAME]:r.serviceName??"logfire-browser",[a.ATTR_SERVICE_VERSION]:r.serviceVersion??"0.0.1",[a.ATTR_TELEMETRY_SDK_LANGUAGE]:a.TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS,[a.ATTR_TELEMETRY_SDK_NAME]:"logfire-browser",...r.environment?{[c.ATTR_DEPLOYMENT_ENVIRONMENT_NAME]:r.environment}:{},[a.ATTR_TELEMETRY_SDK_VERSION]:"0.11.0",...navigator.userAgentData?{[c.ATTR_BROWSER_BRANDS]:navigator.userAgentData.brands.map(n=>`${n.brand} ${n.version}`),[c.ATTR_BROWSER_MOBILE]:navigator.userAgentData.mobile,[c.ATTR_BROWSER_PLATFORM]:navigator.userAgentData.platform}:{[a.ATTR_USER_AGENT_ORIGINAL]:navigator.userAgent}});s.diag.info("logfire-browser: starting");const t=new u.WebTracerProvider({idGenerator:new o.ULIDGenerator,resource:e,spanProcessors:[new C(new u.BatchSpanProcessor(new x({...r.traceExporterConfig,url:r.traceUrl},r.traceExporterHeaders??O),r.batchSpanProcessorConfig),!!r.console)]});t.register({contextManager:r.contextManager??new u.StackContextManager});const i=h.registerInstrumentations({instrumentations:r.instrumentations??[],tracerProvider:t});return async()=>{s.diag.info("logfire-browser: shutting down"),i(),await t.forceFlush(),await t.shutdown(),s.diag.info("logfire-browser: shut down complete")}}const F={configure:T,configureLogfireApi:o.configureLogfireApi,debug:o.debug,DiagLogLevel:s.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:()=>s.DiagLogLevel});exports.configure=T;exports.default=F;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
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { BufferConfig } from '@opentelemetry/sdk-trace-web';
|
|
2
|
-
import { configureLogfireApi } from '
|
|
2
|
+
import { configureLogfireApi } from 'logfire';
|
|
3
3
|
import { ContextManager } from '@opentelemetry/api';
|
|
4
|
-
import { debug } from '
|
|
4
|
+
import { debug } from 'logfire';
|
|
5
5
|
import { DiagLogLevel } from '@opentelemetry/api';
|
|
6
|
-
import { error } from '
|
|
7
|
-
import { fatal } from '
|
|
8
|
-
import { info } from '
|
|
6
|
+
import { error } from 'logfire';
|
|
7
|
+
import { fatal } from 'logfire';
|
|
8
|
+
import { info } from 'logfire';
|
|
9
9
|
import { Instrumentation } from '@opentelemetry/instrumentation';
|
|
10
|
-
import { log } from '
|
|
11
|
-
import { LogfireApiConfig } from '
|
|
12
|
-
import { LogfireAttributeScrubber } from '
|
|
13
|
-
import { NoopAttributeScrubber } from '
|
|
14
|
-
import { notice } from '
|
|
10
|
+
import { log } from 'logfire';
|
|
11
|
+
import { LogfireApiConfig } from 'logfire';
|
|
12
|
+
import { LogfireAttributeScrubber } from 'logfire';
|
|
13
|
+
import { NoopAttributeScrubber } from 'logfire';
|
|
14
|
+
import { notice } from 'logfire';
|
|
15
15
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
16
|
-
import { reportError as reportError_2 } from '
|
|
17
|
-
import { resolveBaseUrl } from '
|
|
18
|
-
import { resolveSendToLogfire } from '
|
|
19
|
-
import { ScrubbingOptions } from '
|
|
20
|
-
import { serializeAttributes } from '
|
|
21
|
-
import { span } from '
|
|
22
|
-
import { startSpan } from '
|
|
23
|
-
import { trace } from '
|
|
24
|
-
import { ULIDGenerator } from '
|
|
25
|
-
import { warning } from '
|
|
16
|
+
import { reportError as reportError_2 } from 'logfire';
|
|
17
|
+
import { resolveBaseUrl } from 'logfire';
|
|
18
|
+
import { resolveSendToLogfire } from 'logfire';
|
|
19
|
+
import { ScrubbingOptions } from 'logfire';
|
|
20
|
+
import { serializeAttributes } from 'logfire';
|
|
21
|
+
import { span } from 'logfire';
|
|
22
|
+
import { startSpan } from 'logfire';
|
|
23
|
+
import { trace } from 'logfire';
|
|
24
|
+
import { ULIDGenerator } from 'logfire';
|
|
25
|
+
import { warning } from 'logfire';
|
|
26
26
|
|
|
27
27
|
export declare function configure(options: LogfireConfigOptions): () => Promise<void>;
|
|
28
28
|
|
|
@@ -118,6 +118,6 @@ export declare interface LogfireConfigOptions {
|
|
|
118
118
|
declare type TraceExporterConfig = NonNullable<typeof OTLPTraceExporter extends new (config: infer T) => unknown ? T : never>;
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
export * from "
|
|
121
|
+
export * from "logfire";
|
|
122
122
|
|
|
123
123
|
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { BufferConfig } from '@opentelemetry/sdk-trace-web';
|
|
2
|
-
import { configureLogfireApi } from '
|
|
2
|
+
import { configureLogfireApi } from 'logfire';
|
|
3
3
|
import { ContextManager } from '@opentelemetry/api';
|
|
4
|
-
import { debug } from '
|
|
4
|
+
import { debug } from 'logfire';
|
|
5
5
|
import { DiagLogLevel } from '@opentelemetry/api';
|
|
6
|
-
import { error } from '
|
|
7
|
-
import { fatal } from '
|
|
8
|
-
import { info } from '
|
|
6
|
+
import { error } from 'logfire';
|
|
7
|
+
import { fatal } from 'logfire';
|
|
8
|
+
import { info } from 'logfire';
|
|
9
9
|
import { Instrumentation } from '@opentelemetry/instrumentation';
|
|
10
|
-
import { log } from '
|
|
11
|
-
import { LogfireApiConfig } from '
|
|
12
|
-
import { LogfireAttributeScrubber } from '
|
|
13
|
-
import { NoopAttributeScrubber } from '
|
|
14
|
-
import { notice } from '
|
|
10
|
+
import { log } from 'logfire';
|
|
11
|
+
import { LogfireApiConfig } from 'logfire';
|
|
12
|
+
import { LogfireAttributeScrubber } from 'logfire';
|
|
13
|
+
import { NoopAttributeScrubber } from 'logfire';
|
|
14
|
+
import { notice } from 'logfire';
|
|
15
15
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
16
|
-
import { reportError as reportError_2 } from '
|
|
17
|
-
import { resolveBaseUrl } from '
|
|
18
|
-
import { resolveSendToLogfire } from '
|
|
19
|
-
import { ScrubbingOptions } from '
|
|
20
|
-
import { serializeAttributes } from '
|
|
21
|
-
import { span } from '
|
|
22
|
-
import { startSpan } from '
|
|
23
|
-
import { trace } from '
|
|
24
|
-
import { ULIDGenerator } from '
|
|
25
|
-
import { warning } from '
|
|
16
|
+
import { reportError as reportError_2 } from 'logfire';
|
|
17
|
+
import { resolveBaseUrl } from 'logfire';
|
|
18
|
+
import { resolveSendToLogfire } from 'logfire';
|
|
19
|
+
import { ScrubbingOptions } from 'logfire';
|
|
20
|
+
import { serializeAttributes } from 'logfire';
|
|
21
|
+
import { span } from 'logfire';
|
|
22
|
+
import { startSpan } from 'logfire';
|
|
23
|
+
import { trace } from 'logfire';
|
|
24
|
+
import { ULIDGenerator } from 'logfire';
|
|
25
|
+
import { warning } from 'logfire';
|
|
26
26
|
|
|
27
27
|
export declare function configure(options: LogfireConfigOptions): () => Promise<void>;
|
|
28
28
|
|
|
@@ -118,6 +118,6 @@ export declare interface LogfireConfigOptions {
|
|
|
118
118
|
declare type TraceExporterConfig = NonNullable<typeof OTLPTraceExporter extends new (config: infer T) => unknown ? T : never>;
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
export * from "
|
|
121
|
+
export * from "logfire";
|
|
122
122
|
|
|
123
123
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import { resourceFromAttributes as b } from "@opentelemetry/resources";
|
|
|
8
8
|
import { SimpleSpanProcessor as R, WebTracerProvider as _, BatchSpanProcessor as L, StackContextManager as w } from "@opentelemetry/sdk-trace-web";
|
|
9
9
|
import { TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS as v, ATTR_USER_AGENT_ORIGINAL as x, ATTR_TELEMETRY_SDK_VERSION as C, ATTR_TELEMETRY_SDK_NAME as D, ATTR_TELEMETRY_SDK_LANGUAGE as F, ATTR_SERVICE_VERSION as N, ATTR_SERVICE_NAME as M } from "@opentelemetry/semantic-conventions";
|
|
10
10
|
import { ATTR_HTTP_URL as s, ATTR_BROWSER_PLATFORM as O, ATTR_BROWSER_MOBILE as I, ATTR_BROWSER_BRANDS as P, ATTR_DEPLOYMENT_ENVIRONMENT_NAME as B, ATTR_BROWSER_LANGUAGE as G } from "@opentelemetry/semantic-conventions/incubating";
|
|
11
|
-
import { warning as U, ULIDGenerator as g, trace as $, startSpan as k, span as y, serializeAttributes as V, resolveSendToLogfire as W, resolveBaseUrl as Y, reportError as H, notice as K, NoopAttributeScrubber as z, LogfireAttributeScrubber as J, logfireApiConfig as X, log as j, Level as q, info as Q, fatal as Z, error as ee, debug as re, configureLogfireApi as E } from "
|
|
12
|
-
export * from "
|
|
11
|
+
import { warning as U, ULIDGenerator as g, trace as $, startSpan as k, span as y, serializeAttributes as V, resolveSendToLogfire as W, resolveBaseUrl as Y, reportError as H, notice as K, NoopAttributeScrubber as z, LogfireAttributeScrubber as J, logfireApiConfig as X, log as j, Level as q, info as Q, fatal as Z, error as ee, debug as re, configureLogfireApi as E } from "logfire";
|
|
12
|
+
export * from "logfire";
|
|
13
13
|
import { hrTimeToMicroseconds as c, ExportResultCode as te } from "@opentelemetry/core";
|
|
14
14
|
import { OTLPExporterBase as oe, mergeOtlpSharedConfigurationWithDefaults as ne, getSharedConfigurationDefaults as ie } from "@opentelemetry/otlp-exporter-base";
|
|
15
15
|
import { createOtlpXhrExportDelegate as ae } from "@opentelemetry/otlp-exporter-base/browser-http";
|
|
@@ -151,7 +151,7 @@ function me(t) {
|
|
|
151
151
|
[D]: "logfire-browser",
|
|
152
152
|
...t.environment ? { [B]: t.environment } : {},
|
|
153
153
|
// eslint-disable-next-line no-undef
|
|
154
|
-
[C]: "0.
|
|
154
|
+
[C]: "0.11.0",
|
|
155
155
|
...navigator.userAgentData ? {
|
|
156
156
|
[P]: navigator.userAgentData.brands.map((o) => `${o.brand} ${o.version}`),
|
|
157
157
|
[I]: navigator.userAgentData.mobile,
|
|
@@ -196,7 +196,7 @@ const xe = {
|
|
|
196
196
|
error: ee,
|
|
197
197
|
fatal: Z,
|
|
198
198
|
info: Q,
|
|
199
|
-
// Re-export all from
|
|
199
|
+
// Re-export all from logfire
|
|
200
200
|
Level: q,
|
|
201
201
|
log: j,
|
|
202
202
|
logfireApiConfig: X,
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"stats",
|
|
26
26
|
"monitoring"
|
|
27
27
|
],
|
|
28
|
-
"version": "0.
|
|
28
|
+
"version": "0.11.0",
|
|
29
29
|
"type": "module",
|
|
30
30
|
"main": "./dist/index.cjs",
|
|
31
31
|
"module": "./dist/index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@opentelemetry/instrumentation": "^0.202.0",
|
|
60
60
|
"@opentelemetry/otlp-exporter-base": "^0.203.0",
|
|
61
61
|
"@opentelemetry/resources": "^2.0.1",
|
|
62
|
-
"
|
|
62
|
+
"logfire": "*"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@opentelemetry/sdk-trace-web": "^2.0.1",
|