@lunora/observability 1.0.0-alpha.51 → 1.0.0-alpha.53
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.d.mts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/LogBuffer-86QaCGLN.mjs +1 -0
- package/dist/packem_shared/SpanBuffer-CEdTCCbZ.mjs +1 -0
- package/package.json +3 -3
- package/dist/packem_shared/LogBuffer-bIvCelI-.mjs +0 -1
- package/dist/packem_shared/SpanBuffer-zjqCAuGp.mjs +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1226,10 +1226,21 @@ declare class LogBuffer {
|
|
|
1226
1226
|
/** Backing store, kept in insertion order (oldest first). */
|
|
1227
1227
|
private readonly buffer;
|
|
1228
1228
|
private readonly capacity;
|
|
1229
|
+
/** How many entries the ring has evicted since it was last cleared. */
|
|
1230
|
+
private droppedCount;
|
|
1229
1231
|
constructor(capacity?: number);
|
|
1232
|
+
/**
|
|
1233
|
+
* Entries evicted for capacity since the last {@link LogBuffer.clear}.
|
|
1234
|
+
*
|
|
1235
|
+
* Without it a full ring is indistinguishable from a quiet instance that
|
|
1236
|
+
* happened to log exactly `capacity` lines: the reader sees 500 entries
|
|
1237
|
+
* either way and cannot tell whether 500 lines happened or 50,000 did. The
|
|
1238
|
+
* count is what turns "the newest 500" into an honest statement.
|
|
1239
|
+
*/
|
|
1240
|
+
get dropped(): number;
|
|
1230
1241
|
/** Number of entries currently buffered. */
|
|
1231
1242
|
get size(): number;
|
|
1232
|
-
/** Drop every buffered entry. */
|
|
1243
|
+
/** Drop every buffered entry, including the eviction count. */
|
|
1233
1244
|
clear(): void;
|
|
1234
1245
|
/**
|
|
1235
1246
|
* Snapshot of the buffered entries, **newest first** so the panel renders
|
|
@@ -1920,10 +1931,19 @@ interface TraceSummary {
|
|
|
1920
1931
|
declare class SpanBuffer {
|
|
1921
1932
|
private readonly buffer;
|
|
1922
1933
|
private readonly capacity;
|
|
1934
|
+
/** How many spans the ring has evicted since it was last cleared. */
|
|
1935
|
+
private droppedCount;
|
|
1923
1936
|
constructor(capacity?: number);
|
|
1937
|
+
/**
|
|
1938
|
+
* Spans evicted for capacity since the last {@link SpanBuffer.clear}. The
|
|
1939
|
+
* ring silently drops its oldest span once full, which makes a busy instance
|
|
1940
|
+
* look identical to one that recorded exactly `capacity` spans; this count
|
|
1941
|
+
* is the difference between the two.
|
|
1942
|
+
*/
|
|
1943
|
+
get dropped(): number;
|
|
1924
1944
|
/** Number of spans currently buffered. */
|
|
1925
1945
|
get size(): number;
|
|
1926
|
-
/** Drop every buffered span. */
|
|
1946
|
+
/** Drop every buffered span, including the eviction count. */
|
|
1927
1947
|
clear(): void;
|
|
1928
1948
|
/** Snapshot of the buffered spans in insertion order. Fresh array per call. */
|
|
1929
1949
|
entries(): SpanEvent[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1226,10 +1226,21 @@ declare class LogBuffer {
|
|
|
1226
1226
|
/** Backing store, kept in insertion order (oldest first). */
|
|
1227
1227
|
private readonly buffer;
|
|
1228
1228
|
private readonly capacity;
|
|
1229
|
+
/** How many entries the ring has evicted since it was last cleared. */
|
|
1230
|
+
private droppedCount;
|
|
1229
1231
|
constructor(capacity?: number);
|
|
1232
|
+
/**
|
|
1233
|
+
* Entries evicted for capacity since the last {@link LogBuffer.clear}.
|
|
1234
|
+
*
|
|
1235
|
+
* Without it a full ring is indistinguishable from a quiet instance that
|
|
1236
|
+
* happened to log exactly `capacity` lines: the reader sees 500 entries
|
|
1237
|
+
* either way and cannot tell whether 500 lines happened or 50,000 did. The
|
|
1238
|
+
* count is what turns "the newest 500" into an honest statement.
|
|
1239
|
+
*/
|
|
1240
|
+
get dropped(): number;
|
|
1230
1241
|
/** Number of entries currently buffered. */
|
|
1231
1242
|
get size(): number;
|
|
1232
|
-
/** Drop every buffered entry. */
|
|
1243
|
+
/** Drop every buffered entry, including the eviction count. */
|
|
1233
1244
|
clear(): void;
|
|
1234
1245
|
/**
|
|
1235
1246
|
* Snapshot of the buffered entries, **newest first** so the panel renders
|
|
@@ -1920,10 +1931,19 @@ interface TraceSummary {
|
|
|
1920
1931
|
declare class SpanBuffer {
|
|
1921
1932
|
private readonly buffer;
|
|
1922
1933
|
private readonly capacity;
|
|
1934
|
+
/** How many spans the ring has evicted since it was last cleared. */
|
|
1935
|
+
private droppedCount;
|
|
1923
1936
|
constructor(capacity?: number);
|
|
1937
|
+
/**
|
|
1938
|
+
* Spans evicted for capacity since the last {@link SpanBuffer.clear}. The
|
|
1939
|
+
* ring silently drops its oldest span once full, which makes a busy instance
|
|
1940
|
+
* look identical to one that recorded exactly `capacity` spans; this count
|
|
1941
|
+
* is the difference between the two.
|
|
1942
|
+
*/
|
|
1943
|
+
get dropped(): number;
|
|
1924
1944
|
/** Number of spans currently buffered. */
|
|
1925
1945
|
get size(): number;
|
|
1926
|
-
/** Drop every buffered span. */
|
|
1946
|
+
/** Drop every buffered span, including the eviction count. */
|
|
1927
1947
|
clear(): void;
|
|
1928
1948
|
/** Snapshot of the buffered spans in insertion order. Fresh array per call. */
|
|
1929
1949
|
entries(): SpanEvent[];
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AUTH_METRICS_BUCKETS_TABLE as t,AUTH_METRICS_BUCKET_MS as T,AUTH_METRICS_BUCKET_RETENTION as o,AUTH_METRICS_TABLE as a,ensureAuthMetricsTables as s,readAuthMetrics as E,recordAuthEvent as _}from"./packem_shared/AUTH_METRICS_BUCKETS_TABLE-CeplWoRm.mjs";import{createMetrics as S,createSpanCollector as I,createTracedFetch as i,createTracer as n,dispatchRootSpan as M}from"./packem_shared/createMetrics-B366_-Qf.mjs";import{createDatabaseTally as A,formatTally as C,instrumentDatabase as N}from"./packem_shared/createDatabaseTally-DCMuBKoP.mjs";import{FUNCTION_METRICS_BUCKETS_TABLE as f,FUNCTION_METRICS_BUCKET_MS as U,FUNCTION_METRICS_BUCKET_RETENTION as d,FUNCTION_METRICS_INDEX_TABLE as R,FUNCTION_METRICS_MAX_PATHS as L,FUNCTION_METRICS_READ_LIMIT as m,FUNCTION_METRICS_SCANS_TABLE as x,FUNCTION_METRICS_TABLE as B,ensureFunctionMetricsTables as F,mergeScanAttribution as l,readFunctionMetricBuckets as g,readFunctionMetricIndexHits as O,readFunctionMetricScans as H,readFunctionMetrics as y,readFunctionMetricsTotals as b,recordFunctionMetric as D}from"./packem_shared/FUNCTION_METRICS_BUCKETS_TABLE-ChlIe0vF.mjs";import{DEFAULT_EXPLAIN_ISSUE_MODEL as K,explainIssue as q,parseExplainIssueArgs as v}from"./packem_shared/DEFAULT_EXPLAIN_ISSUE_MODEL-BGGX6k5D.mjs";import{ISSUE_SEVERITIES as G,ISSUE_STATE_TABLE as X,ISSUE_STATUSES as P,upsertIssueState as k}from"./packem_shared/ISSUE_SEVERITIES-gLC4VEPQ.mjs";import{LogBuffer as j}from"./packem_shared/LogBuffer-
|
|
1
|
+
import{AUTH_METRICS_BUCKETS_TABLE as t,AUTH_METRICS_BUCKET_MS as T,AUTH_METRICS_BUCKET_RETENTION as o,AUTH_METRICS_TABLE as a,ensureAuthMetricsTables as s,readAuthMetrics as E,recordAuthEvent as _}from"./packem_shared/AUTH_METRICS_BUCKETS_TABLE-CeplWoRm.mjs";import{createMetrics as S,createSpanCollector as I,createTracedFetch as i,createTracer as n,dispatchRootSpan as M}from"./packem_shared/createMetrics-B366_-Qf.mjs";import{createDatabaseTally as A,formatTally as C,instrumentDatabase as N}from"./packem_shared/createDatabaseTally-DCMuBKoP.mjs";import{FUNCTION_METRICS_BUCKETS_TABLE as f,FUNCTION_METRICS_BUCKET_MS as U,FUNCTION_METRICS_BUCKET_RETENTION as d,FUNCTION_METRICS_INDEX_TABLE as R,FUNCTION_METRICS_MAX_PATHS as L,FUNCTION_METRICS_READ_LIMIT as m,FUNCTION_METRICS_SCANS_TABLE as x,FUNCTION_METRICS_TABLE as B,ensureFunctionMetricsTables as F,mergeScanAttribution as l,readFunctionMetricBuckets as g,readFunctionMetricIndexHits as O,readFunctionMetricScans as H,readFunctionMetrics as y,readFunctionMetricsTotals as b,recordFunctionMetric as D}from"./packem_shared/FUNCTION_METRICS_BUCKETS_TABLE-ChlIe0vF.mjs";import{DEFAULT_EXPLAIN_ISSUE_MODEL as K,explainIssue as q,parseExplainIssueArgs as v}from"./packem_shared/DEFAULT_EXPLAIN_ISSUE_MODEL-BGGX6k5D.mjs";import{ISSUE_SEVERITIES as G,ISSUE_STATE_TABLE as X,ISSUE_STATUSES as P,upsertIssueState as k}from"./packem_shared/ISSUE_SEVERITIES-gLC4VEPQ.mjs";import{LogBuffer as j}from"./packem_shared/LogBuffer-86QaCGLN.mjs";import{M as z}from"./packem_shared/metric-buffer-Bx0XbypU.mjs";import{readMetricHistory as W,recordMetricHistory as Y}from"./packem_shared/readMetricHistory-TKfnwFNv.mjs";import{readQueryInsights as $,readQueryMetrics as ee,recordQueryMetric as re}from"./packem_shared/readQueryInsights-D37H7MII.mjs";import{R as Te,a as oe,e as ae,b as se,c as Ee,p as _e,r as ce,d as Se,f as Ie}from"./packem_shared/request-log-COB2xhns.mjs";import{MIN_ADMIN_TOKEN_LENGTH as ne,MIN_AUTH_SECRET_LENGTH as Me,buildSecurityAudit as ue}from"./packem_shared/MIN_ADMIN_TOKEN_LENGTH-CidkqOQ1.mjs";import{SpanBuffer as Ce,foldTraces as Ne}from"./packem_shared/SpanBuffer-CEdTCCbZ.mjs";import{findDanglingReferences as fe}from"./packem_shared/findDanglingReferences-Dxl42LBT.mjs";import{r as de}from"./packem_shared/trace-context-DfJZi_g2.mjs";export{t as AUTH_METRICS_BUCKETS_TABLE,T as AUTH_METRICS_BUCKET_MS,o as AUTH_METRICS_BUCKET_RETENTION,a as AUTH_METRICS_TABLE,K as DEFAULT_EXPLAIN_ISSUE_MODEL,f as FUNCTION_METRICS_BUCKETS_TABLE,U as FUNCTION_METRICS_BUCKET_MS,d as FUNCTION_METRICS_BUCKET_RETENTION,R as FUNCTION_METRICS_INDEX_TABLE,L as FUNCTION_METRICS_MAX_PATHS,m as FUNCTION_METRICS_READ_LIMIT,x as FUNCTION_METRICS_SCANS_TABLE,B as FUNCTION_METRICS_TABLE,G as ISSUE_SEVERITIES,X as ISSUE_STATE_TABLE,P as ISSUE_STATUSES,j as LogBuffer,ne as MIN_ADMIN_TOKEN_LENGTH,Me as MIN_AUTH_SECRET_LENGTH,z as MetricBuffer,Te as REQUEST_LOG_TABLE,Ce as SpanBuffer,oe as appendRequestLogEntry,ue as buildSecurityAudit,A as createDatabaseTally,S as createMetrics,I as createSpanCollector,i as createTracedFetch,n as createTracer,M as dispatchRootSpan,ae as emitLogEvent,se as emitRequestLogEvent,s as ensureAuthMetricsTables,F as ensureFunctionMetricsTables,Ee as ensureRequestLogTable,q as explainIssue,fe as findDanglingReferences,Ne as foldTraces,C as formatTally,N as instrumentDatabase,l as mergeScanAttribution,v as parseExplainIssueArgs,_e as parseLogArgs,E as readAuthMetrics,ce as readErrorIssues,g as readFunctionMetricBuckets,O as readFunctionMetricIndexHits,H as readFunctionMetricScans,y as readFunctionMetrics,b as readFunctionMetricsTotals,W as readMetricHistory,$ as readQueryInsights,ee as readQueryMetrics,Se as readRequestLog,_ as recordAuthEvent,D as recordFunctionMetric,Y as recordMetricHistory,re as recordQueryMetric,Ie as redactArgs,de as resolveTraceAnchor,k as upsertIssueState};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=t=>Number.isFinite(t)&&t>=1?Math.trunc(t):500;class s{buffer=[];capacity;droppedCount=0;constructor(e=500){this.capacity=r(e)}get dropped(){return this.droppedCount}get size(){return this.buffer.length}clear(){this.buffer.length=0,this.droppedCount=0}entries(){return this.buffer.toReversed()}push(e){this.buffer.push(e),this.buffer.length>this.capacity&&(this.buffer.shift(),this.droppedCount+=1)}}export{s as LogBuffer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const I=n=>Number.isFinite(n)&&n>=1?Math.trunc(n):500;class M{buffer=[];capacity;droppedCount=0;constructor(o=500){this.capacity=I(o)}get dropped(){return this.droppedCount}get size(){return this.buffer.length}clear(){this.buffer.length=0,this.droppedCount=0}entries(){return[...this.buffer]}hasTrace(o){return this.buffer.some(a=>a.traceId===o)}push(o){this.buffer.push(o),this.buffer.length>this.capacity&&(this.buffer.shift(),this.droppedCount+=1)}}const l=50,T=n=>{const o=new Map;for(const a of n){const c=o.get(a.traceId);c===void 0?o.set(a.traceId,[a]):c.push(a)}return o},b=(n,o)=>{const a=n.find(d=>d.dispatch===!0);if(a!==void 0)return a;const c=n.toSorted((d,t)=>d.startTs-t.startTs);return c.find(d=>!o.has(d.parentSpanId))??c[0]},v=(n,o)=>{const a=new Map([[n.spanId,0]]);return c=>{const d=[],t=new Set;let e=c,r=0;for(;;){const i=a.get(e.spanId);if(i!==void 0){r=i;break}if(t.has(e.spanId))break;t.add(e.spanId),d.push(e);const f=o.get(e.parentSpanId);if(f===void 0)break;e=f}for(const[i,f]of d.toReversed().entries())a.set(f.spanId,r+i+1);return a.get(c.spanId)??r}},m=(n,o)=>{const a=new Map(n.map(t=>[t.spanId,t.depth])),c=new Map,d=[];for(const t of n){if(t.spanId===o){d.push(t);continue}const e=a.get(t.parentSpanId)===t.depth-1?t.parentSpanId:o,r=c.get(e);r===void 0?c.set(e,[t]):r.push(t)}for(const t of c.values())t.sort((e,r)=>e.offsetMs-r.offsetMs);return{childrenOf:c,roots:d}},g=(n,o)=>{const{childrenOf:a,roots:c}=m(n,o),d=[],t=new Set,e=c.toReversed();for(;e.length>0;){const r=e.pop();if(t.has(r))continue;t.add(r),d.push(r);const i=a.get(r.spanId);if(i!==void 0)for(const f of i.toReversed())e.push(f)}if(d.length!==n.length)for(const r of n)t.has(r)||d.push(r);return d},y=(n,o=l)=>{const a=T(n),c=[...a.entries()].map(([t,e])=>({group:e,startTs:Math.min(...e.map(r=>r.startTs)),traceId:t})).toSorted((t,e)=>e.startTs-t.startTs).slice(0,o),d=[];for(const{group:t,traceId:e}of c){const r=new Map(t.map(s=>[s.spanId,s])),i=b(t,r);if(i===void 0)continue;const f=v(i,r),{startTs:h}=i,p=Math.max(...t.map(s=>s.startTs+s.durationMs)),u=t.map(s=>({...s.attributes===void 0?{}:{attributes:s.attributes},depth:f(s),durationMs:s.durationMs,...s.error===void 0?{}:{error:s.error},...s.events===void 0?{}:{events:s.events},...s.kind===void 0?{}:{kind:s.kind},name:s.name,offsetMs:Math.max(0,s.startTs-h),ok:s.ok,parentSpanId:s.parentSpanId,spanId:s.spanId}));d.push({durationMs:p-h,functionPath:i.functionPath,ok:t.every(s=>s.ok),rootName:i.name,...i.shardKey===void 0?{}:{shardKey:i.shardKey},spans:g(u,i.spanId),startTs:h,traceId:e})}return{total:a.size,traces:d.toSorted((t,e)=>e.startTs-t.startTs)}};export{l as DEFAULT_TRACE_LIMIT,M as SpanBuffer,y as foldTraces};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/observability",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.53",
|
|
4
4
|
"description": "Host-neutral telemetry storage and read models for Lunora, backing the Studio's Logs, Traces, Metrics and Issues views",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lunora",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
46
|
+
"@lunora/errors": "1.0.0-alpha.29",
|
|
47
47
|
"@lunora/fingerprint": "1.0.0-alpha.9",
|
|
48
|
-
"@lunora/shard-engine": "1.0.0-alpha.
|
|
48
|
+
"@lunora/shard-engine": "1.0.0-alpha.52",
|
|
49
49
|
"@visulima/redact": "4.0.0"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class r{buffer=[];capacity;constructor(t=500){this.capacity=t>0?Math.trunc(t):500}get size(){return this.buffer.length}clear(){this.buffer.length=0}entries(){return this.buffer.toReversed()}push(t){this.buffer.push(t),this.buffer.length>this.capacity&&this.buffer.shift()}}export{r as LogBuffer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class m{buffer=[];capacity;constructor(r=500){this.capacity=r>0?Math.trunc(r):500}get size(){return this.buffer.length}clear(){this.buffer.length=0}entries(){return[...this.buffer]}hasTrace(r){return this.buffer.some(o=>o.traceId===r)}push(r){this.buffer.push(r),this.buffer.length>this.capacity&&this.buffer.shift()}}const I=50,l=d=>{const r=new Map;for(const o of d){const c=r.get(o.traceId);c===void 0?r.set(o.traceId,[o]):c.push(o)}return r},T=(d,r)=>{const o=d.find(a=>a.dispatch===!0);if(o!==void 0)return o;const c=d.toSorted((a,t)=>a.startTs-t.startTs);return c.find(a=>!r.has(a.parentSpanId))??c[0]},b=(d,r)=>{const o=new Map([[d.spanId,0]]);return c=>{const a=[],t=new Set;let e=c,n=0;for(;;){const i=o.get(e.spanId);if(i!==void 0){n=i;break}if(t.has(e.spanId))break;t.add(e.spanId),a.push(e);const f=r.get(e.parentSpanId);if(f===void 0)break;e=f}for(const[i,f]of a.toReversed().entries())o.set(f.spanId,n+i+1);return o.get(c.spanId)??n}},v=(d,r)=>{const o=new Map(d.map(t=>[t.spanId,t.depth])),c=new Map,a=[];for(const t of d){if(t.spanId===r){a.push(t);continue}const e=o.get(t.parentSpanId)===t.depth-1?t.parentSpanId:r,n=c.get(e);n===void 0?c.set(e,[t]):n.push(t)}for(const t of c.values())t.sort((e,n)=>e.offsetMs-n.offsetMs);return{childrenOf:c,roots:a}},g=(d,r)=>{const{childrenOf:o,roots:c}=v(d,r),a=[],t=new Set,e=c.toReversed();for(;e.length>0;){const n=e.pop();if(t.has(n))continue;t.add(n),a.push(n);const i=o.get(n.spanId);if(i!==void 0)for(const f of i.toReversed())e.push(f)}if(a.length!==d.length)for(const n of d)t.has(n)||a.push(n);return a},M=(d,r=I)=>{const o=l(d),c=[...o.entries()].map(([t,e])=>({group:e,startTs:Math.min(...e.map(n=>n.startTs)),traceId:t})).toSorted((t,e)=>e.startTs-t.startTs).slice(0,r),a=[];for(const{group:t,traceId:e}of c){const n=new Map(t.map(s=>[s.spanId,s])),i=T(t,n);if(i===void 0)continue;const f=b(i,n),{startTs:h}=i,u=Math.max(...t.map(s=>s.startTs+s.durationMs)),p=t.map(s=>({...s.attributes===void 0?{}:{attributes:s.attributes},depth:f(s),durationMs:s.durationMs,...s.error===void 0?{}:{error:s.error},...s.events===void 0?{}:{events:s.events},...s.kind===void 0?{}:{kind:s.kind},name:s.name,offsetMs:Math.max(0,s.startTs-h),ok:s.ok,parentSpanId:s.parentSpanId,spanId:s.spanId}));a.push({durationMs:u-h,functionPath:i.functionPath,ok:t.every(s=>s.ok),rootName:i.name,...i.shardKey===void 0?{}:{shardKey:i.shardKey},spans:g(p,i.spanId),startTs:h,traceId:e})}return{total:o.size,traces:a.toSorted((t,e)=>e.startTs-t.startTs)}};export{I as DEFAULT_TRACE_LIMIT,m as SpanBuffer,M as foldTraces};
|