@pydantic/logfire-browser 0.11.0 → 0.12.1
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.js +1 -1
- 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("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.
|
|
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.12.1",...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.js
CHANGED
|
@@ -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.12.1",
|
|
155
155
|
...navigator.userAgentData ? {
|
|
156
156
|
[P]: navigator.userAgentData.brands.map((o) => `${o.brand} ${o.version}`),
|
|
157
157
|
[I]: navigator.userAgentData.mobile,
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"stats",
|
|
26
26
|
"monitoring"
|
|
27
27
|
],
|
|
28
|
-
"version": "0.
|
|
28
|
+
"version": "0.12.1",
|
|
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
|
-
"logfire": "
|
|
62
|
+
"logfire": "^0.11.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@opentelemetry/sdk-trace-web": "^2.0.1",
|