rian 0.3.2 → 0.3.4
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/async.d.ts +1 -1
- package/async.js +1 -1
- package/async.mjs +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +1 -1
package/async.d.ts
CHANGED
package/async.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e = require('node:async_hooks');const { measure:t } = require('rian/utils');const { make:n, parse:r, SAMPLED_FLAG:o } = require('tctx');const { is_sampled:a } = require('tctx');var s={};function c(e,t={}){s={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.
|
|
1
|
+
const e = require('node:async_hooks');const { measure:t } = require('rian/utils');const { make:n, parse:r, SAMPLED_FLAG:o } = require('tctx');const { is_sampled:a } = require('tctx');var s={};function c(e,t={}){s={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.4"}}var l=new Set,p=new WeakMap;async function u(e){let t=[],n=new Map;for(let[e,r]of l){let o;n.has(r)?o=n.get(r).spans:n.set(r,{scope:r,spans:o=[]}),o.push(e),p.has(r)&&(t.push(...p.get(r)),p.delete(r))}return l.clear(),t.length&&await Promise.all(t),e({resource:s,scopeSpans:n.values()})}function i(e,t){return a(t)}var m=new e.AsyncLocalStorage;function f(){let e=m.getStore()?.[1];if(null==e)throw new Error("no current span");return e}function d(e,o){let a=m.getStore();if(!a)throw Error("TODO");let s=a[0],c=s.scope,u=a[1],i=s.sampler,f=null!=o?"string"==typeof o?r(o):o:u?.traceparent,w=f?f.child():n(),g="boolean"!=typeof i?i(e,w,c):i;w.flags;let h={id:w,parent:f,start:s.clock.now(),name:e,events:[],context:{}};g&&l.add([h,c]);let k=e=>m.run([s,k],t,k,e);k.traceparent=w,k.span=e=>m.run([s,k],d,e),k.set_context=e=>{"function"!=typeof e?Object.assign(h.context,e):h.context=e(h.context)},k.add_event=(e,t)=>{h.events.push({name:e,timestamp:s.clock.now(),attributes:t||{}})},k.end=()=>{null==h.end&&(h.end=s.clock.now())};let v=p.get(c);return k.__add_promise=e=>{v.add(e),e.then((()=>v.delete(e)))},k}function w(e,t){let n={name:e},r={scope:n,sampler:t?.sampler??i,clock:t?.clock??Date};return p.set(n,new Set),function(e){let t=m.getStore();return m.run([r,t?.[1]||null],e)}}exports.configure=c;exports.currentSpan=f;exports.report=u;exports.span=d;exports.tracer=w;
|
package/async.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"node:async_hooks";import{measure as t}from"rian/utils";import{make as n,parse as r,SAMPLED_FLAG as o}from"tctx";import{is_sampled as a}from"tctx";var s={};function c(e,t={}){s={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.
|
|
1
|
+
import*as e from"node:async_hooks";import{measure as t}from"rian/utils";import{make as n,parse as r,SAMPLED_FLAG as o}from"tctx";import{is_sampled as a}from"tctx";var s={};function c(e,t={}){s={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.4"}}var l=new Set,p=new WeakMap;async function u(e){let t=[],n=new Map;for(let[e,r]of l){let o;n.has(r)?o=n.get(r).spans:n.set(r,{scope:r,spans:o=[]}),o.push(e),p.has(r)&&(t.push(...p.get(r)),p.delete(r))}return l.clear(),t.length&&await Promise.all(t),e({resource:s,scopeSpans:n.values()})}function i(e,t){return a(t)}var m=new e.AsyncLocalStorage;function f(){let e=m.getStore()?.[1];if(null==e)throw new Error("no current span");return e}function d(e,o){let a=m.getStore();if(!a)throw Error("TODO");let s=a[0],c=s.scope,u=a[1],i=s.sampler,f=null!=o?"string"==typeof o?r(o):o:u?.traceparent,w=f?f.child():n(),g="boolean"!=typeof i?i(e,w,c):i;w.flags;let h={id:w,parent:f,start:s.clock.now(),name:e,events:[],context:{}};g&&l.add([h,c]);let k=e=>m.run([s,k],t,k,e);k.traceparent=w,k.span=e=>m.run([s,k],d,e),k.set_context=e=>{"function"!=typeof e?Object.assign(h.context,e):h.context=e(h.context)},k.add_event=(e,t)=>{h.events.push({name:e,timestamp:s.clock.now(),attributes:t||{}})},k.end=()=>{null==h.end&&(h.end=s.clock.now())};let v=p.get(c);return k.__add_promise=e=>{v.add(e),e.then((()=>v.delete(e)))},k}function w(e,t){let n={name:e},r={scope:n,sampler:t?.sampler??i,clock:t?.clock??Date};return p.set(n,new Set),function(e){let t=m.getStore();return m.run([r,t?.[1]||null],e)}}export{c as configure,f as currentSpan,u as report,d as span,w as tracer};
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const { measure:e } = require('rian/utils');const { make:t, parse:n, SAMPLED_FLAG:a } = require('tctx');const { is_sampled:
|
|
1
|
+
const { measure:e } = require('rian/utils');const { make:t, parse:n, SAMPLED_FLAG:a } = require('tctx');const { is_sampled:o } = require('tctx');var s={};function r(e,t={}){s={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.4"}}var l=new Set,i=new WeakMap;async function p(e){let t=[],n=new Map;for(let[e,a]of l){let o;n.has(a)?o=n.get(a).spans:n.set(a,{scope:a,spans:o=[]}),o.push(e),i.has(a)&&(t.push(...i.get(a)),i.delete(a))}return l.clear(),t.length&&await Promise.all(t),e({resource:s,scopeSpans:n.values()})}function c(e,t){return o(t)}function d(a,o){let s=o?.sampler??c,r=o?.clock??Date,p={name:a},d=new Set;i.set(p,d);let m=(a,o)=>{let i=null!=o?"string"==typeof o?n(o):o:void 0,c=i?i.child():t(),u="boolean"!=typeof s?s(a,c,p):s;c.flags;let f={id:c,parent:i,start:r.now(),name:a,events:[],context:{}};u&&l.add([f,p]);let v=t=>e(v,t);return v.traceparent=c,v.span=(e,t)=>m(e,t||c),v.set_context=e=>"function"==typeof e?void(f.context=e(f.context)):void Object.assign(f.context,e),v.add_event=(e,t)=>{f.events.push({name:e,timestamp:r.now(),attributes:t||{}})},v.end=()=>{null==f.end&&(f.end=r.now())},v.__add_promise=e=>{d.add(e),e.then((()=>d.delete(e)))},v};return{span:m}}exports.configure=r;exports.report=p;exports.tracer=d;
|
package/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{measure as e}from"rian/utils";import{make as t,parse as n,SAMPLED_FLAG as a}from"tctx";import{is_sampled as
|
|
1
|
+
import{measure as e}from"rian/utils";import{make as t,parse as n,SAMPLED_FLAG as a}from"tctx";import{is_sampled as o}from"tctx";var s={};function r(e,t={}){s={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.4"}}var l=new Set,i=new WeakMap;async function p(e){let t=[],n=new Map;for(let[e,a]of l){let o;n.has(a)?o=n.get(a).spans:n.set(a,{scope:a,spans:o=[]}),o.push(e),i.has(a)&&(t.push(...i.get(a)),i.delete(a))}return l.clear(),t.length&&await Promise.all(t),e({resource:s,scopeSpans:n.values()})}function c(e,t){return o(t)}function d(a,o){let s=o?.sampler??c,r=o?.clock??Date,p={name:a},d=new Set;i.set(p,d);let m=(a,o)=>{let i=null!=o?"string"==typeof o?n(o):o:void 0,c=i?i.child():t(),u="boolean"!=typeof s?s(a,c,p):s;c.flags;let f={id:c,parent:i,start:r.now(),name:a,events:[],context:{}};u&&l.add([f,p]);let v=t=>e(v,t);return v.traceparent=c,v.span=(e,t)=>m(e,t||c),v.set_context=e=>"function"==typeof e?void(f.context=e(f.context)):void Object.assign(f.context,e),v.add_event=(e,t)=>{f.events.push({name:e,timestamp:r.now(),attributes:t||{}})},v.end=()=>{null==f.end&&(f.end=r.now())},v.__add_promise=e=>{d.add(e),e.then((()=>d.delete(e)))},v};return{span:m}}export{r as configure,p as report,d as tracer};
|