@pydantic/logfire-cf-workers 0.8.2 → 0.9.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 +66 -3
- package/dist/index.d.ts +66 -3
- package/dist/index.js +94 -63
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("@opentelemetry/sdk-trace-base"),r=require("@pydantic/logfire-api"),g=require("@pydantic/otel-cf-workers"),c=require("@opentelemetry/core"),m=require("@opentelemetry/otlp-transformer");async function d(t,e){const o=e.LOGFIRE_TOKEN;if(!o){console.warn("No token provided, not sending payload to Logfire");return}const n=r.resolveBaseUrl(e,void 0,o);for(const s of t)for(const a of s.logs)if(Array.isArray(a.message)){for(const i of a.message)if("resourceSpans"in i)try{return await fetch(`${n}/v1/traces`,{body:JSON.stringify(i),headers:{Authorization:o,"Content-Type":"application/json"},method:"POST"})}catch(u){console.error(u)}}}const T=Object.freeze(Object.defineProperty({__proto__:null,exportTailEventsToLogfire:d},Symbol.toStringTag,{value:"Module"})),E={1:"trace",5:"debug",9:"info",10:"notice",13:"warning",17:"error",21:"fatal"};class L{export(e,o){this.sendSpans(e,o)}forceFlush(){return Promise.resolve()}shutdown(){return this.sendSpans([]),this.forceFlush()}exportInfo(e){var o;return{attributes:e.attributes,duration:c.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:c.hrTimeToMicroseconds(e.startTime),traceId:e.spanContext().traceId,traceState:(o=e.spanContext().traceState)==null?void 0:o.serialize()}}sendSpans(e,o){for(const n of e){const s=E[n.attributes["logfire.level_num"]]??"info",{attributes:a,name:i,...u}=this.exportInfo(n);console.log(`Logfire: ${s} >> ${i}`),console.log("Attributes:"),console.log(JSON.stringify(a,null,2)),console.log("---"),console.log("Span details:"),console.log(JSON.stringify(u,null,2)),console.log("---")}o&&o({code:c.ExportResultCode.SUCCESS})}}class h{export(e,o){this._sendSpans(e,o)}shutdown(){return this._sendSpans([]),Promise.resolve()}_cleanNullValues(e){if(!e.resourceSpans)return e;for(const o of e.resourceSpans){l(o.resource);for(const n of o.scopeSpans){n.scope&&l(n.scope);for(const s of n.spans??[])l(s)}}return e}_sendSpans(e,o){const n=m.JsonTraceSerializer.serializeRequest(e),s=new TextDecoder().decode(n),a=JSON.parse(s),i=this._cleanNullValues(a);return console.log(i),o==null?void 0:o({code:c.ExportResultCode.SUCCESS})}}function l(t){t!=null&&t.attributes&&(t.attributes=t.attributes.filter(x))}function x(t){return Object.keys(t.value).length>0}function y(t){return e=>{const{LOGFIRE_ENVIRONMENT:o,LOGFIRE_TOKEN:n=""}=e,s=r.resolveBaseUrl(e,t.baseUrl,n),a=t.environment??o,i=t.additionalSpanProcessors??[];return t.console&&i.push(new v.SimpleSpanProcessor(new L)),Object.assign({},t,{additionalSpanProcessors:i,environment:a,exporter:{headers:{Authorization:n},url:`${s}/v1/traces`},idGenerator:new r.ULIDGenerator,postProcessor:u=>A(u)})}}function f(t){return e=>Object.assign({},t,{exporter:new h,idGenerator:new r.ULIDGenerator})}function p(t,e){return e.scrubbing!==void 0&&r.configureLogfireApi({scrubbing:e.scrubbing}),g.instrument(t,y(e))}function b(t,e){return g.instrument(t,f(e))}const S=p;function A(t){for(const e of t){for(const o of Object.keys(e.attributes)){const n=e.attributes[o];n==null&&delete e.attributes[o]}Object.assign(e.attributes,r.serializeAttributes(e.attributes))}return t}const C={...T,configureLogfireApi:r.configureLogfireApi,debug:r.debug,error:r.error,fatal:r.fatal,getTailConfig:f,info:r.info,instrument:S,instrumentInProcess:p,instrumentTail:b,Level:r.Level,log:r.log,logfireApiConfig:r.logfireApiConfig,LogfireAttributeScrubber:r.LogfireAttributeScrubber,NoopAttributeScrubber:r.NoopAttributeScrubber,notice:r.notice,reportError:r.reportError,resolveBaseUrl:r.resolveBaseUrl,resolveSendToLogfire:r.resolveSendToLogfire,serializeAttributes:r.serializeAttributes,span:r.span,startSpan:r.startSpan,trace:r.trace,ULIDGenerator:r.ULIDGenerator,warning:r.warning};exports.default=C;exports.exportTailEventsToLogfire=d;exports.getTailConfig=f;exports.instrument=S;exports.instrumentInProcess=p;exports.instrumentTail=b;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,74 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { configureLogfireApi } from '@pydantic/logfire-api';
|
|
2
|
+
import { debug } from '@pydantic/logfire-api';
|
|
3
|
+
import { error } from '@pydantic/logfire-api';
|
|
4
|
+
import { fatal } from '@pydantic/logfire-api';
|
|
5
|
+
import { info } from '@pydantic/logfire-api';
|
|
6
|
+
import { log } from '@pydantic/logfire-api';
|
|
7
|
+
import { LogfireApiConfig } from '@pydantic/logfire-api';
|
|
8
|
+
import { LogfireAttributeScrubber } from '@pydantic/logfire-api';
|
|
9
|
+
import { NoopAttributeScrubber } from '@pydantic/logfire-api';
|
|
10
|
+
import { notice } from '@pydantic/logfire-api';
|
|
11
|
+
import { reportError as reportError_2 } from '@pydantic/logfire-api';
|
|
12
|
+
import { resolveBaseUrl } from '@pydantic/logfire-api';
|
|
13
|
+
import { resolveSendToLogfire } from '@pydantic/logfire-api';
|
|
14
|
+
import { ScrubbingOptions } from '@pydantic/logfire-api';
|
|
15
|
+
import { serializeAttributes } from '@pydantic/logfire-api';
|
|
16
|
+
import { span } from '@pydantic/logfire-api';
|
|
2
17
|
import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
18
|
+
import { startSpan } from '@pydantic/logfire-api';
|
|
19
|
+
import { trace } from '@pydantic/logfire-api';
|
|
3
20
|
import { TraceConfig } from '@pydantic/otel-cf-workers';
|
|
21
|
+
import { ULIDGenerator } from '@pydantic/logfire-api';
|
|
22
|
+
import { warning } from '@pydantic/logfire-api';
|
|
4
23
|
|
|
5
24
|
declare type ConfigOptionsBase = Pick<TraceConfig, 'environment' | 'fetch' | 'handlers' | 'instrumentation' | 'propagator' | 'sampling' | 'scope' | 'service'>;
|
|
6
25
|
|
|
26
|
+
declare const _default: {
|
|
27
|
+
configureLogfireApi: typeof configureLogfireApi;
|
|
28
|
+
debug: typeof debug;
|
|
29
|
+
error: typeof error;
|
|
30
|
+
fatal: typeof fatal;
|
|
31
|
+
getTailConfig: typeof getTailConfig;
|
|
32
|
+
info: typeof info;
|
|
33
|
+
instrument: typeof instrumentInProcess;
|
|
34
|
+
instrumentInProcess: typeof instrumentInProcess;
|
|
35
|
+
instrumentTail: typeof instrumentTail;
|
|
36
|
+
Level: {
|
|
37
|
+
Trace: 1;
|
|
38
|
+
Debug: 5;
|
|
39
|
+
Info: 9;
|
|
40
|
+
Notice: 10;
|
|
41
|
+
Warning: 13;
|
|
42
|
+
Error: 17;
|
|
43
|
+
Fatal: 21;
|
|
44
|
+
};
|
|
45
|
+
log: typeof log;
|
|
46
|
+
logfireApiConfig: LogfireApiConfig;
|
|
47
|
+
LogfireAttributeScrubber: typeof LogfireAttributeScrubber;
|
|
48
|
+
NoopAttributeScrubber: typeof NoopAttributeScrubber;
|
|
49
|
+
notice: typeof notice;
|
|
50
|
+
reportError: typeof reportError_2;
|
|
51
|
+
resolveBaseUrl: typeof resolveBaseUrl;
|
|
52
|
+
resolveSendToLogfire: typeof resolveSendToLogfire;
|
|
53
|
+
serializeAttributes: typeof serializeAttributes;
|
|
54
|
+
span: typeof span;
|
|
55
|
+
startSpan: typeof startSpan;
|
|
56
|
+
trace: typeof trace;
|
|
57
|
+
ULIDGenerator: typeof ULIDGenerator;
|
|
58
|
+
warning: typeof warning;
|
|
59
|
+
exportTailEventsToLogfire(events: exportTailEventsExports.TraceItem[], env: Record<string, string | undefined>): Promise<Response | undefined>;
|
|
60
|
+
};
|
|
61
|
+
export default _default;
|
|
62
|
+
|
|
7
63
|
declare type Env = Record<string, string | undefined>;
|
|
8
64
|
|
|
65
|
+
declare namespace exportTailEventsExports {
|
|
66
|
+
export {
|
|
67
|
+
exportTailEventsToLogfire,
|
|
68
|
+
TraceItem
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
9
72
|
export declare function exportTailEventsToLogfire(events: TraceItem[], env: Record<string, string | undefined>): Promise<Response | undefined>;
|
|
10
73
|
|
|
11
74
|
export declare function getTailConfig(config: TailConfigOptions): (env: Env) => TraceConfig;
|
|
@@ -23,7 +86,7 @@ export declare interface InProcessConfigOptions extends ConfigOptionsBase {
|
|
|
23
86
|
/**
|
|
24
87
|
* Options for scrubbing sensitive data. Set to False to disable.
|
|
25
88
|
*/
|
|
26
|
-
scrubbing?: false |
|
|
89
|
+
scrubbing?: false | ScrubbingOptions;
|
|
27
90
|
}
|
|
28
91
|
|
|
29
92
|
/**
|
|
@@ -38,7 +101,7 @@ export declare function instrumentTail<T>(handler: T, config: TailConfigOptions)
|
|
|
38
101
|
export declare interface TailConfigOptions extends ConfigOptionsBase {
|
|
39
102
|
}
|
|
40
103
|
|
|
41
|
-
declare interface TraceItem {
|
|
104
|
+
export declare interface TraceItem {
|
|
42
105
|
logs: {
|
|
43
106
|
message: any[];
|
|
44
107
|
}[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,74 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { configureLogfireApi } from '@pydantic/logfire-api';
|
|
2
|
+
import { debug } from '@pydantic/logfire-api';
|
|
3
|
+
import { error } from '@pydantic/logfire-api';
|
|
4
|
+
import { fatal } from '@pydantic/logfire-api';
|
|
5
|
+
import { info } from '@pydantic/logfire-api';
|
|
6
|
+
import { log } from '@pydantic/logfire-api';
|
|
7
|
+
import { LogfireApiConfig } from '@pydantic/logfire-api';
|
|
8
|
+
import { LogfireAttributeScrubber } from '@pydantic/logfire-api';
|
|
9
|
+
import { NoopAttributeScrubber } from '@pydantic/logfire-api';
|
|
10
|
+
import { notice } from '@pydantic/logfire-api';
|
|
11
|
+
import { reportError as reportError_2 } from '@pydantic/logfire-api';
|
|
12
|
+
import { resolveBaseUrl } from '@pydantic/logfire-api';
|
|
13
|
+
import { resolveSendToLogfire } from '@pydantic/logfire-api';
|
|
14
|
+
import { ScrubbingOptions } from '@pydantic/logfire-api';
|
|
15
|
+
import { serializeAttributes } from '@pydantic/logfire-api';
|
|
16
|
+
import { span } from '@pydantic/logfire-api';
|
|
2
17
|
import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
18
|
+
import { startSpan } from '@pydantic/logfire-api';
|
|
19
|
+
import { trace } from '@pydantic/logfire-api';
|
|
3
20
|
import { TraceConfig } from '@pydantic/otel-cf-workers';
|
|
21
|
+
import { ULIDGenerator } from '@pydantic/logfire-api';
|
|
22
|
+
import { warning } from '@pydantic/logfire-api';
|
|
4
23
|
|
|
5
24
|
declare type ConfigOptionsBase = Pick<TraceConfig, 'environment' | 'fetch' | 'handlers' | 'instrumentation' | 'propagator' | 'sampling' | 'scope' | 'service'>;
|
|
6
25
|
|
|
26
|
+
declare const _default: {
|
|
27
|
+
configureLogfireApi: typeof configureLogfireApi;
|
|
28
|
+
debug: typeof debug;
|
|
29
|
+
error: typeof error;
|
|
30
|
+
fatal: typeof fatal;
|
|
31
|
+
getTailConfig: typeof getTailConfig;
|
|
32
|
+
info: typeof info;
|
|
33
|
+
instrument: typeof instrumentInProcess;
|
|
34
|
+
instrumentInProcess: typeof instrumentInProcess;
|
|
35
|
+
instrumentTail: typeof instrumentTail;
|
|
36
|
+
Level: {
|
|
37
|
+
Trace: 1;
|
|
38
|
+
Debug: 5;
|
|
39
|
+
Info: 9;
|
|
40
|
+
Notice: 10;
|
|
41
|
+
Warning: 13;
|
|
42
|
+
Error: 17;
|
|
43
|
+
Fatal: 21;
|
|
44
|
+
};
|
|
45
|
+
log: typeof log;
|
|
46
|
+
logfireApiConfig: LogfireApiConfig;
|
|
47
|
+
LogfireAttributeScrubber: typeof LogfireAttributeScrubber;
|
|
48
|
+
NoopAttributeScrubber: typeof NoopAttributeScrubber;
|
|
49
|
+
notice: typeof notice;
|
|
50
|
+
reportError: typeof reportError_2;
|
|
51
|
+
resolveBaseUrl: typeof resolveBaseUrl;
|
|
52
|
+
resolveSendToLogfire: typeof resolveSendToLogfire;
|
|
53
|
+
serializeAttributes: typeof serializeAttributes;
|
|
54
|
+
span: typeof span;
|
|
55
|
+
startSpan: typeof startSpan;
|
|
56
|
+
trace: typeof trace;
|
|
57
|
+
ULIDGenerator: typeof ULIDGenerator;
|
|
58
|
+
warning: typeof warning;
|
|
59
|
+
exportTailEventsToLogfire(events: exportTailEventsExports.TraceItem[], env: Record<string, string | undefined>): Promise<Response | undefined>;
|
|
60
|
+
};
|
|
61
|
+
export default _default;
|
|
62
|
+
|
|
7
63
|
declare type Env = Record<string, string | undefined>;
|
|
8
64
|
|
|
65
|
+
declare namespace exportTailEventsExports {
|
|
66
|
+
export {
|
|
67
|
+
exportTailEventsToLogfire,
|
|
68
|
+
TraceItem
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
9
72
|
export declare function exportTailEventsToLogfire(events: TraceItem[], env: Record<string, string | undefined>): Promise<Response | undefined>;
|
|
10
73
|
|
|
11
74
|
export declare function getTailConfig(config: TailConfigOptions): (env: Env) => TraceConfig;
|
|
@@ -23,7 +86,7 @@ export declare interface InProcessConfigOptions extends ConfigOptionsBase {
|
|
|
23
86
|
/**
|
|
24
87
|
* Options for scrubbing sensitive data. Set to False to disable.
|
|
25
88
|
*/
|
|
26
|
-
scrubbing?: false |
|
|
89
|
+
scrubbing?: false | ScrubbingOptions;
|
|
27
90
|
}
|
|
28
91
|
|
|
29
92
|
/**
|
|
@@ -38,7 +101,7 @@ export declare function instrumentTail<T>(handler: T, config: TailConfigOptions)
|
|
|
38
101
|
export declare interface TailConfigOptions extends ConfigOptionsBase {
|
|
39
102
|
}
|
|
40
103
|
|
|
41
|
-
declare interface TraceItem {
|
|
104
|
+
export declare interface TraceItem {
|
|
42
105
|
logs: {
|
|
43
106
|
message: any[];
|
|
44
107
|
}[];
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,38 @@
|
|
|
1
|
-
import { SimpleSpanProcessor as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const
|
|
1
|
+
import { SimpleSpanProcessor as v } from "@opentelemetry/sdk-trace-base";
|
|
2
|
+
import { resolveBaseUrl as u, warning as h, ULIDGenerator as l, trace as x, startSpan as y, span as E, serializeAttributes as p, resolveSendToLogfire as O, reportError as T, notice as C, NoopAttributeScrubber as L, LogfireAttributeScrubber as _, logfireApiConfig as A, log as N, Level as w, info as I, fatal as P, error as k, debug as z, configureLogfireApi as d } from "@pydantic/logfire-api";
|
|
3
|
+
import { instrument as S } from "@pydantic/otel-cf-workers";
|
|
4
|
+
import { hrTimeToMicroseconds as f, ExportResultCode as b } from "@opentelemetry/core";
|
|
5
|
+
import { JsonTraceSerializer as G } from "@opentelemetry/otlp-transformer";
|
|
6
|
+
async function R(t, e) {
|
|
7
|
+
const r = e.LOGFIRE_TOKEN;
|
|
8
|
+
if (!r) {
|
|
9
|
+
console.warn("No token provided, not sending payload to Logfire");
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const o = u(e, void 0, r);
|
|
13
|
+
for (const n of t)
|
|
14
|
+
for (const i of n.logs)
|
|
15
|
+
if (Array.isArray(i.message)) {
|
|
16
|
+
for (const s of i.message)
|
|
17
|
+
if ("resourceSpans" in s)
|
|
18
|
+
try {
|
|
19
|
+
return await fetch(`${o}/v1/traces`, {
|
|
20
|
+
body: JSON.stringify(s),
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: r,
|
|
23
|
+
"Content-Type": "application/json"
|
|
24
|
+
},
|
|
25
|
+
method: "POST"
|
|
26
|
+
});
|
|
27
|
+
} catch (a) {
|
|
28
|
+
console.error(a);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
33
|
+
__proto__: null,
|
|
34
|
+
exportTailEventsToLogfire: R
|
|
35
|
+
}, Symbol.toStringTag, { value: "Module" })), F = {
|
|
8
36
|
1: "trace",
|
|
9
37
|
5: "debug",
|
|
10
38
|
9: "info",
|
|
@@ -13,7 +41,7 @@ const v = {
|
|
|
13
41
|
17: "error",
|
|
14
42
|
21: "fatal"
|
|
15
43
|
};
|
|
16
|
-
class
|
|
44
|
+
class J {
|
|
17
45
|
export(e, r) {
|
|
18
46
|
this.sendSpans(e, r);
|
|
19
47
|
}
|
|
@@ -31,7 +59,7 @@ class h {
|
|
|
31
59
|
var r;
|
|
32
60
|
return {
|
|
33
61
|
attributes: e.attributes,
|
|
34
|
-
duration:
|
|
62
|
+
duration: f(e.duration),
|
|
35
63
|
events: e.events,
|
|
36
64
|
id: e.spanContext().spanId,
|
|
37
65
|
instrumentationScope: e.instrumentationScope,
|
|
@@ -43,20 +71,20 @@ class h {
|
|
|
43
71
|
attributes: e.resource.attributes
|
|
44
72
|
},
|
|
45
73
|
status: e.status,
|
|
46
|
-
timestamp:
|
|
74
|
+
timestamp: f(e.startTime),
|
|
47
75
|
traceId: e.spanContext().traceId,
|
|
48
76
|
traceState: (r = e.spanContext().traceState) == null ? void 0 : r.serialize()
|
|
49
77
|
};
|
|
50
78
|
}
|
|
51
79
|
sendSpans(e, r) {
|
|
52
80
|
for (const o of e) {
|
|
53
|
-
const n =
|
|
81
|
+
const n = F[o.attributes["logfire.level_num"]] ?? "info", { attributes: i, name: s, ...a } = this.exportInfo(o);
|
|
54
82
|
console.log(`Logfire: ${n} >> ${s}`), console.log("Attributes:"), console.log(JSON.stringify(i, null, 2)), console.log("---"), console.log("Span details:"), console.log(JSON.stringify(a, null, 2)), console.log("---");
|
|
55
83
|
}
|
|
56
|
-
r && r({ code:
|
|
84
|
+
r && r({ code: b.SUCCESS });
|
|
57
85
|
}
|
|
58
86
|
}
|
|
59
|
-
class
|
|
87
|
+
class $ {
|
|
60
88
|
export(e, r) {
|
|
61
89
|
this._sendSpans(e, r);
|
|
62
90
|
}
|
|
@@ -77,84 +105,87 @@ class y {
|
|
|
77
105
|
return e;
|
|
78
106
|
}
|
|
79
107
|
_sendSpans(e, r) {
|
|
80
|
-
const o =
|
|
81
|
-
return console.log(s), r == null ? void 0 : r({ code:
|
|
108
|
+
const o = G.serializeRequest(e), n = new TextDecoder().decode(o), i = JSON.parse(n), s = this._cleanNullValues(i);
|
|
109
|
+
return console.log(s), r == null ? void 0 : r({ code: b.SUCCESS });
|
|
82
110
|
}
|
|
83
111
|
}
|
|
84
112
|
function c(t) {
|
|
85
|
-
t != null && t.attributes && (t.attributes = t.attributes.filter(
|
|
113
|
+
t != null && t.attributes && (t.attributes = t.attributes.filter(M));
|
|
86
114
|
}
|
|
87
|
-
function
|
|
115
|
+
function M(t) {
|
|
88
116
|
return Object.keys(t.value).length > 0;
|
|
89
117
|
}
|
|
90
|
-
|
|
91
|
-
const r = e.LOGFIRE_TOKEN;
|
|
92
|
-
if (!r) {
|
|
93
|
-
console.warn("No token provided, not sending payload to Logfire");
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const o = l(e, void 0, r);
|
|
97
|
-
for (const n of t)
|
|
98
|
-
for (const i of n.logs)
|
|
99
|
-
if (Array.isArray(i.message)) {
|
|
100
|
-
for (const s of i.message)
|
|
101
|
-
if ("resourceSpans" in s)
|
|
102
|
-
try {
|
|
103
|
-
return await fetch(`${o}/v1/traces`, {
|
|
104
|
-
body: JSON.stringify(s),
|
|
105
|
-
headers: {
|
|
106
|
-
Authorization: r,
|
|
107
|
-
"Content-Type": "application/json"
|
|
108
|
-
},
|
|
109
|
-
method: "POST"
|
|
110
|
-
});
|
|
111
|
-
} catch (a) {
|
|
112
|
-
console.error(a);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
function E(t) {
|
|
118
|
+
function V(t) {
|
|
117
119
|
return (e) => {
|
|
118
|
-
const { LOGFIRE_ENVIRONMENT: r, LOGFIRE_TOKEN: o = "" } = e, n =
|
|
119
|
-
return t.console && s.push(new
|
|
120
|
+
const { LOGFIRE_ENVIRONMENT: r, LOGFIRE_TOKEN: o = "" } = e, n = u(e, t.baseUrl, o), i = t.environment ?? r, s = t.additionalSpanProcessors ?? [];
|
|
121
|
+
return t.console && s.push(new v(new J())), Object.assign({}, t, {
|
|
120
122
|
additionalSpanProcessors: s,
|
|
121
123
|
environment: i,
|
|
122
124
|
exporter: {
|
|
123
125
|
headers: { Authorization: o },
|
|
124
126
|
url: `${n}/v1/traces`
|
|
125
127
|
},
|
|
126
|
-
idGenerator: new
|
|
127
|
-
postProcessor: (a) =>
|
|
128
|
+
idGenerator: new l(),
|
|
129
|
+
postProcessor: (a) => K(a)
|
|
128
130
|
});
|
|
129
131
|
};
|
|
130
132
|
}
|
|
131
|
-
function
|
|
133
|
+
function g(t) {
|
|
132
134
|
return (e) => Object.assign({}, t, {
|
|
133
|
-
exporter: new
|
|
134
|
-
idGenerator: new
|
|
135
|
+
exporter: new $(),
|
|
136
|
+
idGenerator: new l()
|
|
135
137
|
});
|
|
136
138
|
}
|
|
137
|
-
function
|
|
138
|
-
return e.scrubbing !== void 0 &&
|
|
139
|
+
function m(t, e) {
|
|
140
|
+
return e.scrubbing !== void 0 && d({ scrubbing: e.scrubbing }), S(t, V(e));
|
|
139
141
|
}
|
|
140
|
-
function
|
|
141
|
-
return
|
|
142
|
+
function j(t, e) {
|
|
143
|
+
return S(t, g(e));
|
|
142
144
|
}
|
|
143
|
-
const
|
|
144
|
-
function
|
|
145
|
+
const D = m;
|
|
146
|
+
function K(t) {
|
|
145
147
|
for (const e of t) {
|
|
146
148
|
for (const r of Object.keys(e.attributes)) {
|
|
147
149
|
const o = e.attributes[r];
|
|
148
150
|
o == null && delete e.attributes[r];
|
|
149
151
|
}
|
|
150
|
-
Object.assign(e.attributes,
|
|
152
|
+
Object.assign(e.attributes, p(e.attributes));
|
|
151
153
|
}
|
|
152
154
|
return t;
|
|
153
155
|
}
|
|
156
|
+
const X = {
|
|
157
|
+
...U,
|
|
158
|
+
configureLogfireApi: d,
|
|
159
|
+
debug: z,
|
|
160
|
+
error: k,
|
|
161
|
+
fatal: P,
|
|
162
|
+
getTailConfig: g,
|
|
163
|
+
info: I,
|
|
164
|
+
instrument: D,
|
|
165
|
+
instrumentInProcess: m,
|
|
166
|
+
instrumentTail: j,
|
|
167
|
+
// Re-export all from @pydantic/logfire-api
|
|
168
|
+
Level: w,
|
|
169
|
+
log: N,
|
|
170
|
+
logfireApiConfig: A,
|
|
171
|
+
LogfireAttributeScrubber: _,
|
|
172
|
+
NoopAttributeScrubber: L,
|
|
173
|
+
notice: C,
|
|
174
|
+
reportError: T,
|
|
175
|
+
resolveBaseUrl: u,
|
|
176
|
+
resolveSendToLogfire: O,
|
|
177
|
+
serializeAttributes: p,
|
|
178
|
+
span: E,
|
|
179
|
+
startSpan: y,
|
|
180
|
+
trace: x,
|
|
181
|
+
ULIDGenerator: l,
|
|
182
|
+
warning: h
|
|
183
|
+
};
|
|
154
184
|
export {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
185
|
+
X as default,
|
|
186
|
+
R as exportTailEventsToLogfire,
|
|
187
|
+
g as getTailConfig,
|
|
188
|
+
D as instrument,
|
|
189
|
+
m as instrumentInProcess,
|
|
190
|
+
j as instrumentTail
|
|
160
191
|
};
|