rian 0.3.5 → 0.3.6

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.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 l(e,t={}){s={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.5"}}var c=new Set,p=new WeakMap;async function u(e){let t=[],n=new Map;for(let[e,r]of c){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 c.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,a){let s=m.getStore();if(!s)throw Error("TODO");let l=s[0],u=l.scope,i=s[1],f=l.sampler,g=null!=a?"string"==typeof a?r(a):a:i?.traceparent,w=g?g.child():n(),h="boolean"!=typeof f?f(e,w,u):f;h?w.flags|=o:w.flags&=~o;let k={id:w,parent:g,start:l.clock.now(),name:e,events:[],context:{}};h&&c.add([k,u]);let v=e=>m.run([l,v],t,v,e);v.traceparent=w,v.span=e=>m.run([l,v],d,e),v.set_context=e=>{"function"!=typeof e?Object.assign(k.context,e):k.context=e(k.context)},v.add_event=(e,t)=>{k.events.push({name:e,timestamp:l.clock.now(),attributes:t||{}})},v.end=()=>{null==k.end&&(k.end=l.clock.now())};let x=p.get(u);return v.__add_promise=e=>{x.add(e),e.then((()=>x.delete(e)))},v}function g(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=l;exports.currentSpan=f;exports.report=u;exports.span=d;exports.tracer=g;
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 l(e,t={}){s={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.6"}}var c=new Set,p=new WeakMap;async function u(e){let t=[],n=new Map;for(let[e,r]of c){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 c.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,a){let s=m.getStore();if(!s)throw Error("TODO");let l=s[0],u=l.scope,i=s[1],f=l.sampler,g=null!=a?"string"==typeof a?r(a):a:i?.traceparent,w=g?g.child():n(),h="boolean"!=typeof f?f(e,w,u):f;h?w.flags|=o:w.flags&=~o;let k={id:w,parent:g,start:l.clock.now(),name:e,events:[],context:{}};h&&c.add([k,u]);let v=e=>m.run([l,v],t,v,e);v.traceparent=w,v.span=e=>m.run([l,v],d,e),v.set_context=e=>{"function"!=typeof e?Object.assign(k.context,e):k.context=e(k.context)},v.add_event=(e,t)=>{k.events.push({name:e,timestamp:l.clock.now(),attributes:t||{}})},v.end=()=>{null==k.end&&(k.end=l.clock.now())};let x=p.get(u);return v.__add_promise=e=>{x.add(e),e.then((()=>x.delete(e)))},v}function g(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=l;exports.currentSpan=f;exports.report=u;exports.span=d;exports.tracer=g;
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 l(e,t={}){s={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.5"}}var c=new Set,p=new WeakMap;async function u(e){let t=[],n=new Map;for(let[e,r]of c){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 c.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,a){let s=m.getStore();if(!s)throw Error("TODO");let l=s[0],u=l.scope,i=s[1],f=l.sampler,g=null!=a?"string"==typeof a?r(a):a:i?.traceparent,w=g?g.child():n(),h="boolean"!=typeof f?f(e,w,u):f;h?w.flags|=o:w.flags&=~o;let k={id:w,parent:g,start:l.clock.now(),name:e,events:[],context:{}};h&&c.add([k,u]);let v=e=>m.run([l,v],t,v,e);v.traceparent=w,v.span=e=>m.run([l,v],d,e),v.set_context=e=>{"function"!=typeof e?Object.assign(k.context,e):k.context=e(k.context)},v.add_event=(e,t)=>{k.events.push({name:e,timestamp:l.clock.now(),attributes:t||{}})},v.end=()=>{null==k.end&&(k.end=l.clock.now())};let x=p.get(u);return v.__add_promise=e=>{x.add(e),e.then((()=>x.delete(e)))},v}function g(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{l as configure,f as currentSpan,u as report,d as span,g as tracer};
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 l(e,t={}){s={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.6"}}var c=new Set,p=new WeakMap;async function u(e){let t=[],n=new Map;for(let[e,r]of c){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 c.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,a){let s=m.getStore();if(!s)throw Error("TODO");let l=s[0],u=l.scope,i=s[1],f=l.sampler,g=null!=a?"string"==typeof a?r(a):a:i?.traceparent,w=g?g.child():n(),h="boolean"!=typeof f?f(e,w,u):f;h?w.flags|=o:w.flags&=~o;let k={id:w,parent:g,start:l.clock.now(),name:e,events:[],context:{}};h&&c.add([k,u]);let v=e=>m.run([l,v],t,v,e);v.traceparent=w,v.span=e=>m.run([l,v],d,e),v.set_context=e=>{"function"!=typeof e?Object.assign(k.context,e):k.context=e(k.context)},v.add_event=(e,t)=>{k.events.push({name:e,timestamp:l.clock.now(),attributes:t||{}})},v.end=()=>{null==k.end&&(k.end=l.clock.now())};let x=p.get(u);return v.__add_promise=e=>{x.add(e),e.then((()=>x.delete(e)))},v}function g(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{l as configure,f as currentSpan,u as report,d as span,g as tracer};
package/index.d.ts CHANGED
@@ -217,9 +217,7 @@ export function tracer(name: string, options?: Options): Tracer;
217
217
  /**
218
218
  * Awaits all active promises, and then calls the {@link Options.exporter|exporter}. Passing all collected spans.
219
219
  */
220
- export async function report<T extends Exporter>(
221
- exporter: T,
222
- ): Promise<ReturnType<T>>;
220
+ export function report<T extends Exporter>(exporter: T): Promise<ReturnType<T>>;
223
221
 
224
222
  /**
225
223
  * Calling this method will set the resource attributes for this runtime. This is useful for things like:
@@ -237,7 +235,7 @@ export async function report<T extends Exporter>(
237
235
  * configure('my-service', { 'deployment.environment': 'production', 'k8s.namespace.name': 'default' });
238
236
  * ```
239
237
  */
240
- export function configure(name: string, attributes: Context): void;
238
+ export function configure(name: string, attributes?: Context): void;
241
239
 
242
240
  /**
243
241
  * Provinding a clock allows you to control the time of the span.
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:s } = require('tctx');var o={};function r(e,t={}){o={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.5"}}var l=new Set,i=new WeakMap;async function p(e){let t=[],n=new Map;for(let[e,a]of l){let s;n.has(a)?s=n.get(a).spans:n.set(a,{scope:a,spans:s=[]}),s.push(e),i.has(a)&&(t.push(...i.get(a)),i.delete(a))}return l.clear(),t.length&&await Promise.all(t),e({resource:o,scopeSpans:n.values()})}function c(e,t){return s(t)}function d(s,o){let r=o?.sampler??c,p=o?.clock??Date,d={name:s},m=new Set;i.set(d,m);let u=(s,o)=>{let i=null!=o?"string"==typeof o?n(o):o:void 0,c=i?i.child():t(),f="boolean"!=typeof r?r(s,c,d):r;f?c.flags|=a:c.flags&=~a;let v={id:c,parent:i,start:p.now(),name:s,events:[],context:{}};f&&l.add([v,d]);let h=t=>e(h,t);return h.traceparent=c,h.span=(e,t)=>u(e,t||c),h.set_context=e=>"function"==typeof e?void(v.context=e(v.context)):void Object.assign(v.context,e),h.add_event=(e,t)=>{v.events.push({name:e,timestamp:p.now(),attributes:t||{}})},h.end=()=>{null==v.end&&(v.end=p.now())},h.__add_promise=e=>{m.add(e),e.then((()=>m.delete(e)))},h};return{span:u}}exports.configure=r;exports.report=p;exports.tracer=d;
1
+ const { measure:e } = require('rian/utils');const { make:t, parse:n, SAMPLED_FLAG:a } = require('tctx');const { is_sampled:s } = require('tctx');var o={};function r(e,t={}){o={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.6"}}var l=new Set,i=new WeakMap;async function p(e){let t=[],n=new Map;for(let[e,a]of l){let s;n.has(a)?s=n.get(a).spans:n.set(a,{scope:a,spans:s=[]}),s.push(e),i.has(a)&&(t.push(...i.get(a)),i.delete(a))}return l.clear(),t.length&&await Promise.all(t),e({resource:o,scopeSpans:n.values()})}function c(e,t){return s(t)}function d(s,o){let r=o?.sampler??c,p=o?.clock??Date,d={name:s},m=new Set;i.set(d,m);let u=(s,o)=>{let i=null!=o?"string"==typeof o?n(o):o:void 0,c=i?i.child():t(),f="boolean"!=typeof r?r(s,c,d):r;f?c.flags|=a:c.flags&=~a;let v={id:c,parent:i,start:p.now(),name:s,events:[],context:{}};f&&l.add([v,d]);let h=t=>e(h,t);return h.traceparent=c,h.span=(e,t)=>u(e,t||c),h.set_context=e=>"function"==typeof e?void(v.context=e(v.context)):void Object.assign(v.context,e),h.add_event=(e,t)=>{v.events.push({name:e,timestamp:p.now(),attributes:t||{}})},h.end=()=>{null==v.end&&(v.end=p.now())},h.__add_promise=e=>{m.add(e),e.then((()=>m.delete(e)))},h};return{span:u}}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 s}from"tctx";var o={};function r(e,t={}){o={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.5"}}var l=new Set,i=new WeakMap;async function p(e){let t=[],n=new Map;for(let[e,a]of l){let s;n.has(a)?s=n.get(a).spans:n.set(a,{scope:a,spans:s=[]}),s.push(e),i.has(a)&&(t.push(...i.get(a)),i.delete(a))}return l.clear(),t.length&&await Promise.all(t),e({resource:o,scopeSpans:n.values()})}function c(e,t){return s(t)}function d(s,o){let r=o?.sampler??c,p=o?.clock??Date,d={name:s},m=new Set;i.set(d,m);let u=(s,o)=>{let i=null!=o?"string"==typeof o?n(o):o:void 0,c=i?i.child():t(),f="boolean"!=typeof r?r(s,c,d):r;f?c.flags|=a:c.flags&=~a;let v={id:c,parent:i,start:p.now(),name:s,events:[],context:{}};f&&l.add([v,d]);let h=t=>e(h,t);return h.traceparent=c,h.span=(e,t)=>u(e,t||c),h.set_context=e=>"function"==typeof e?void(v.context=e(v.context)):void Object.assign(v.context,e),h.add_event=(e,t)=>{v.events.push({name:e,timestamp:p.now(),attributes:t||{}})},h.end=()=>{null==v.end&&(v.end=p.now())},h.__add_promise=e=>{m.add(e),e.then((()=>m.delete(e)))},h};return{span:u}}export{r as configure,p as report,d as tracer};
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 s}from"tctx";var o={};function r(e,t={}){o={...t,"service.name":e,"telemetry.sdk.name":"rian","telemetry.sdk.version":"0.3.6"}}var l=new Set,i=new WeakMap;async function p(e){let t=[],n=new Map;for(let[e,a]of l){let s;n.has(a)?s=n.get(a).spans:n.set(a,{scope:a,spans:s=[]}),s.push(e),i.has(a)&&(t.push(...i.get(a)),i.delete(a))}return l.clear(),t.length&&await Promise.all(t),e({resource:o,scopeSpans:n.values()})}function c(e,t){return s(t)}function d(s,o){let r=o?.sampler??c,p=o?.clock??Date,d={name:s},m=new Set;i.set(d,m);let u=(s,o)=>{let i=null!=o?"string"==typeof o?n(o):o:void 0,c=i?i.child():t(),f="boolean"!=typeof r?r(s,c,d):r;f?c.flags|=a:c.flags&=~a;let v={id:c,parent:i,start:p.now(),name:s,events:[],context:{}};f&&l.add([v,d]);let h=t=>e(h,t);return h.traceparent=c,h.span=(e,t)=>u(e,t||c),h.set_context=e=>"function"==typeof e?void(v.context=e(v.context)):void Object.assign(v.context,e),h.add_event=(e,t)=>{v.events.push({name:e,timestamp:p.now(),attributes:t||{}})},h.end=()=>{null==v.end&&(v.end=p.now())},h.__add_promise=e=>{m.add(e),e.then((()=>m.delete(e)))},h};return{span:u}}export{r as configure,p as report,d as tracer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rian",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Effective tracing for the edge and origins",
5
5
  "keywords": [
6
6
  "opentelemetry",