@pydantic/logfire-cf-workers 0.3.0 → 0.4.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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +22 -24
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@microlabs/otel-cf-workers"),o=require("@pydantic/logfire-api");function u(t){return e=>{const{LOGFIRE_TOKEN:r=""}=e,s=o.resolveBaseUrl(e,t.baseUrl,r);return{exporter:{headers:{Authorization:r},url:`${s}/v1/traces`},postProcessor:i=>c(i),service:{name:t.serviceName??"cloudflare-worker",namespace:t.serviceNamespace??"",version:t.serviceVersion??"0.0.0"}}}}function a(t,e){return n.instrument(t,u(e))}function c(t){for(const e of t){for(const r of Object.keys(e.attributes)){const s=e.attributes[r];s==null&&delete e.attributes[r]}Object.assign(e.attributes,o.serializeAttributes(e.attributes))}return t}exports.instrument=a;
|
package/dist/index.d.cts
CHANGED
|
@@ -6,6 +6,7 @@ export declare interface CloudflareConfigOptions {
|
|
|
6
6
|
export declare function instrument<T>(handler: T, config: LogfireCloudflareConfigOptions): T;
|
|
7
7
|
|
|
8
8
|
export declare interface LogfireCloudflareConfigOptions {
|
|
9
|
+
baseUrl?: string;
|
|
9
10
|
serviceName?: string;
|
|
10
11
|
serviceNamespace?: string;
|
|
11
12
|
serviceVersion?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare interface CloudflareConfigOptions {
|
|
|
6
6
|
export declare function instrument<T>(handler: T, config: LogfireCloudflareConfigOptions): T;
|
|
7
7
|
|
|
8
8
|
export declare interface LogfireCloudflareConfigOptions {
|
|
9
|
+
baseUrl?: string;
|
|
9
10
|
serviceName?: string;
|
|
10
11
|
serviceNamespace?: string;
|
|
11
12
|
serviceVersion?: string;
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,35 @@
|
|
|
1
|
-
import { instrument as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
let { LOGFIRE_BASE_URL: r = c, LOGFIRE_TOKEN: i } = e;
|
|
8
|
-
return r.endsWith("/") || (r += "/"), {
|
|
1
|
+
import { instrument as i } from "@microlabs/otel-cf-workers";
|
|
2
|
+
import { resolveBaseUrl as n, serializeAttributes as a } from "@pydantic/logfire-api";
|
|
3
|
+
function u(e) {
|
|
4
|
+
return (t) => {
|
|
5
|
+
const { LOGFIRE_TOKEN: r = "" } = t, s = n(t, e.baseUrl, r);
|
|
6
|
+
return {
|
|
9
7
|
exporter: {
|
|
10
|
-
headers: { Authorization:
|
|
11
|
-
url: `${
|
|
8
|
+
headers: { Authorization: r },
|
|
9
|
+
url: `${s}/v1/traces`
|
|
12
10
|
},
|
|
13
|
-
postProcessor: (o) =>
|
|
11
|
+
postProcessor: (o) => c(o),
|
|
14
12
|
service: {
|
|
15
|
-
name:
|
|
16
|
-
namespace:
|
|
17
|
-
version:
|
|
13
|
+
name: e.serviceName ?? "cloudflare-worker",
|
|
14
|
+
namespace: e.serviceNamespace ?? "",
|
|
15
|
+
version: e.serviceVersion ?? "0.0.0"
|
|
18
16
|
}
|
|
19
17
|
};
|
|
20
18
|
};
|
|
21
19
|
}
|
|
22
|
-
function
|
|
23
|
-
return
|
|
20
|
+
function m(e, t) {
|
|
21
|
+
return i(e, u(t));
|
|
24
22
|
}
|
|
25
|
-
function
|
|
26
|
-
for (const
|
|
27
|
-
for (const r of Object.keys(
|
|
28
|
-
const
|
|
29
|
-
|
|
23
|
+
function c(e) {
|
|
24
|
+
for (const t of e) {
|
|
25
|
+
for (const r of Object.keys(t.attributes)) {
|
|
26
|
+
const s = t.attributes[r];
|
|
27
|
+
s == null && delete t.attributes[r];
|
|
30
28
|
}
|
|
31
|
-
Object.assign(
|
|
29
|
+
Object.assign(t.attributes, a(t.attributes));
|
|
32
30
|
}
|
|
33
|
-
return
|
|
31
|
+
return e;
|
|
34
32
|
}
|
|
35
33
|
export {
|
|
36
|
-
|
|
34
|
+
m as instrument
|
|
37
35
|
};
|