@lunora/observability 1.0.0-alpha.173 → 1.0.0-alpha.175

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.mjs CHANGED
@@ -1 +1 @@
1
- import{AUTH_METRICS_BUCKETS_TABLE as t,AUTH_METRICS_BUCKET_MS as s,AUTH_METRICS_BUCKET_RETENTION as a,AUTH_METRICS_TABLE as o,ensureAuthMetricsTables as T,readAuthMetrics as E,recordAuthEvent as S}from"./packem_shared/AUTH_METRICS_BUCKETS_TABLE-BpH1ZAgX.mjs";import{createMetrics as i,createSpanCollector as c,createTracedFetch as n,createTracer as I,dispatchRootSpan as u}from"./packem_shared/createMetrics-EODsLse6.mjs";import{createDatabaseTally as A,formatTally as N,instrumentDatabase as p,instrumentSqlClient as C}from"./packem_shared/createDatabaseTally-ZFZnNvOy.mjs";import{FUNCTION_METRICS_BUCKETS_TABLE as f,FUNCTION_METRICS_BUCKET_MS as R,FUNCTION_METRICS_BUCKET_RETENTION as U,FUNCTION_METRICS_INDEX_TABLE as m,FUNCTION_METRICS_MAX_PATHS as l,FUNCTION_METRICS_READ_LIMIT as L,FUNCTION_METRICS_SCANS_TABLE as x,FUNCTION_METRICS_TABLE as B,ensureFunctionMetricsTables as F,mergeScanAttribution as g,readFunctionMetricBuckets as O,readFunctionMetricIndexHits as H,readFunctionMetricScans as y,readFunctionMetrics as b,readFunctionMetricsTotals as h,recordFunctionMetric as v}from"./packem_shared/FUNCTION_METRICS_BUCKETS_TABLE-Dha-40Hv.mjs";import{applyHostRootSpan as K,setHostSpanAttributes as q}from"./packem_shared/applyHostRootSpan-DToRfMn8.mjs";import{DEFAULT_EXPLAIN_ISSUE_MODEL as Q,explainIssue as V,parseExplainIssueArgs as k}from"./packem_shared/DEFAULT_EXPLAIN_ISSUE_MODEL-BkFTgdkd.mjs";import{ISSUE_SEVERITIES as X,ISSUE_STATE_TABLE as j,ISSUE_STATUSES as w,upsertIssueState as z}from"./packem_shared/ISSUE_SEVERITIES-0SJ0glV4.mjs";import{LogBuffer as W}from"./packem_shared/LogBuffer-BmD4CfV0.mjs";import{MetricBuffer as Z}from"./packem_shared/MetricBuffer-BUw1hK3f.mjs";import{readMetricHistory as ee,recordMetricHistory as re}from"./packem_shared/readMetricHistory-BjPDSBkS.mjs";import{latencyBucketIndex as se,readQueryInsights as ae,readQueryMetrics as oe,recordQueryMetric as Te}from"./packem_shared/latencyBucketIndex--kZoW0vc.mjs";import{N as Se,R as _e,S as ie,a as ce,c as ne,e as Ie,b as ue,d as Me,m as Ae,p as Ne,r as pe,f as Ce,g as de,h as fe,s as Re,i as Ue}from"./packem_shared/request-log-DdeDQptI.mjs";import{MIN_ADMIN_TOKEN_LENGTH as le,MIN_AUTH_SECRET_LENGTH as Le,buildSecurityAudit as xe}from"./packem_shared/MIN_ADMIN_TOKEN_LENGTH-DSOQ6rno.mjs";import{SpanBuffer as Fe,foldTraces as ge}from"./packem_shared/SpanBuffer-DnYOc8uk.mjs";import{findDanglingReferences as He}from"./packem_shared/findDanglingReferences-BaOyIdxz.mjs";import{resolveTraceAnchor as be}from"./packem_shared/resolveTraceAnchor-DDAPZRBB.mjs";export{t as AUTH_METRICS_BUCKETS_TABLE,s as AUTH_METRICS_BUCKET_MS,a as AUTH_METRICS_BUCKET_RETENTION,o as AUTH_METRICS_TABLE,Q as DEFAULT_EXPLAIN_ISSUE_MODEL,f as FUNCTION_METRICS_BUCKETS_TABLE,R as FUNCTION_METRICS_BUCKET_MS,U as FUNCTION_METRICS_BUCKET_RETENTION,m as FUNCTION_METRICS_INDEX_TABLE,l as FUNCTION_METRICS_MAX_PATHS,L as FUNCTION_METRICS_READ_LIMIT,x as FUNCTION_METRICS_SCANS_TABLE,B as FUNCTION_METRICS_TABLE,X as ISSUE_SEVERITIES,j as ISSUE_STATE_TABLE,w as ISSUE_STATUSES,W as LogBuffer,le as MIN_ADMIN_TOKEN_LENGTH,Le as MIN_AUTH_SECRET_LENGTH,Z as MetricBuffer,Se as NO_SENSITIVE_SCOPE,_e as REQUEST_LOG_TABLE,ie as SENSITIVE_ARG_MASK,Fe as SpanBuffer,ce as appendRequestLogEntry,K as applyHostRootSpan,xe as buildSecurityAudit,A as createDatabaseTally,i as createMetrics,ne as createSensitiveScope,c as createSpanCollector,n as createTracedFetch,I as createTracer,u as dispatchRootSpan,Ie as emitLogEvent,ue as emitRequestLogEvent,T as ensureAuthMetricsTables,F as ensureFunctionMetricsTables,Me as ensureRequestLogTable,V as explainIssue,He as findDanglingReferences,ge as foldTraces,N as formatTally,p as instrumentDatabase,C as instrumentSqlClient,se as latencyBucketIndex,Ae as maskSensitiveArgs,g as mergeScanAttribution,k as parseExplainIssueArgs,Ne as parseLogArgs,E as readAuthMetrics,pe as readErrorIssues,O as readFunctionMetricBuckets,H as readFunctionMetricIndexHits,y as readFunctionMetricScans,b as readFunctionMetrics,h as readFunctionMetricsTotals,ee as readMetricHistory,ae as readQueryInsights,oe as readQueryMetrics,Ce as readRequestLog,S as recordAuthEvent,v as recordFunctionMetric,re as recordMetricHistory,Te as recordQueryMetric,de as redactArgs,fe as redactCredentials,be as resolveTraceAnchor,Re as sensitiveNames,Ue as sensitiveValues,q as setHostSpanAttributes,z as upsertIssueState};
1
+ import{AUTH_METRICS_BUCKETS_TABLE as t,AUTH_METRICS_BUCKET_MS as s,AUTH_METRICS_BUCKET_RETENTION as a,AUTH_METRICS_TABLE as o,ensureAuthMetricsTables as T,readAuthMetrics as E,recordAuthEvent as S}from"./packem_shared/AUTH_METRICS_BUCKETS_TABLE-BpH1ZAgX.mjs";import{createMetrics as i,createSpanCollector as c,createTracedFetch as n,createTracer as I,dispatchRootSpan as u}from"./packem_shared/createMetrics-EODsLse6.mjs";import{createDatabaseTally as A,formatTally as N,instrumentDatabase as p,instrumentSqlClient as C}from"./packem_shared/createDatabaseTally-7-TS__4e.mjs";import{FUNCTION_METRICS_BUCKETS_TABLE as f,FUNCTION_METRICS_BUCKET_MS as R,FUNCTION_METRICS_BUCKET_RETENTION as U,FUNCTION_METRICS_INDEX_TABLE as m,FUNCTION_METRICS_MAX_PATHS as l,FUNCTION_METRICS_READ_LIMIT as L,FUNCTION_METRICS_SCANS_TABLE as x,FUNCTION_METRICS_TABLE as B,ensureFunctionMetricsTables as F,mergeScanAttribution as g,readFunctionMetricBuckets as O,readFunctionMetricIndexHits as H,readFunctionMetricScans as y,readFunctionMetrics as b,readFunctionMetricsTotals as h,recordFunctionMetric as v}from"./packem_shared/FUNCTION_METRICS_BUCKETS_TABLE-Dha-40Hv.mjs";import{applyHostRootSpan as K,setHostSpanAttributes as q}from"./packem_shared/applyHostRootSpan-DToRfMn8.mjs";import{DEFAULT_EXPLAIN_ISSUE_MODEL as Q,explainIssue as V,parseExplainIssueArgs as k}from"./packem_shared/DEFAULT_EXPLAIN_ISSUE_MODEL-BkFTgdkd.mjs";import{ISSUE_SEVERITIES as X,ISSUE_STATE_TABLE as j,ISSUE_STATUSES as w,upsertIssueState as z}from"./packem_shared/ISSUE_SEVERITIES-0SJ0glV4.mjs";import{LogBuffer as W}from"./packem_shared/LogBuffer-BmD4CfV0.mjs";import{MetricBuffer as Z}from"./packem_shared/MetricBuffer-BUw1hK3f.mjs";import{readMetricHistory as ee,recordMetricHistory as re}from"./packem_shared/readMetricHistory-BjPDSBkS.mjs";import{latencyBucketIndex as se,readQueryInsights as ae,readQueryMetrics as oe,recordQueryMetric as Te}from"./packem_shared/latencyBucketIndex--kZoW0vc.mjs";import{N as Se,R as _e,S as ie,a as ce,c as ne,e as Ie,b as ue,d as Me,m as Ae,p as Ne,r as pe,f as Ce,g as de,h as fe,s as Re,i as Ue}from"./packem_shared/request-log-DdeDQptI.mjs";import{MIN_ADMIN_TOKEN_LENGTH as le,MIN_AUTH_SECRET_LENGTH as Le,buildSecurityAudit as xe}from"./packem_shared/MIN_ADMIN_TOKEN_LENGTH-DSOQ6rno.mjs";import{SpanBuffer as Fe,foldTraces as ge}from"./packem_shared/SpanBuffer-DnYOc8uk.mjs";import{findDanglingReferences as He}from"./packem_shared/findDanglingReferences-BaOyIdxz.mjs";import{resolveTraceAnchor as be}from"./packem_shared/resolveTraceAnchor-DDAPZRBB.mjs";export{t as AUTH_METRICS_BUCKETS_TABLE,s as AUTH_METRICS_BUCKET_MS,a as AUTH_METRICS_BUCKET_RETENTION,o as AUTH_METRICS_TABLE,Q as DEFAULT_EXPLAIN_ISSUE_MODEL,f as FUNCTION_METRICS_BUCKETS_TABLE,R as FUNCTION_METRICS_BUCKET_MS,U as FUNCTION_METRICS_BUCKET_RETENTION,m as FUNCTION_METRICS_INDEX_TABLE,l as FUNCTION_METRICS_MAX_PATHS,L as FUNCTION_METRICS_READ_LIMIT,x as FUNCTION_METRICS_SCANS_TABLE,B as FUNCTION_METRICS_TABLE,X as ISSUE_SEVERITIES,j as ISSUE_STATE_TABLE,w as ISSUE_STATUSES,W as LogBuffer,le as MIN_ADMIN_TOKEN_LENGTH,Le as MIN_AUTH_SECRET_LENGTH,Z as MetricBuffer,Se as NO_SENSITIVE_SCOPE,_e as REQUEST_LOG_TABLE,ie as SENSITIVE_ARG_MASK,Fe as SpanBuffer,ce as appendRequestLogEntry,K as applyHostRootSpan,xe as buildSecurityAudit,A as createDatabaseTally,i as createMetrics,ne as createSensitiveScope,c as createSpanCollector,n as createTracedFetch,I as createTracer,u as dispatchRootSpan,Ie as emitLogEvent,ue as emitRequestLogEvent,T as ensureAuthMetricsTables,F as ensureFunctionMetricsTables,Me as ensureRequestLogTable,V as explainIssue,He as findDanglingReferences,ge as foldTraces,N as formatTally,p as instrumentDatabase,C as instrumentSqlClient,se as latencyBucketIndex,Ae as maskSensitiveArgs,g as mergeScanAttribution,k as parseExplainIssueArgs,Ne as parseLogArgs,E as readAuthMetrics,pe as readErrorIssues,O as readFunctionMetricBuckets,H as readFunctionMetricIndexHits,y as readFunctionMetricScans,b as readFunctionMetrics,h as readFunctionMetricsTotals,ee as readMetricHistory,ae as readQueryInsights,oe as readQueryMetrics,Ce as readRequestLog,S as recordAuthEvent,v as recordFunctionMetric,re as recordMetricHistory,Te as recordQueryMetric,de as redactArgs,fe as redactCredentials,be as resolveTraceAnchor,Re as sensitiveNames,Ue as sensitiveValues,q as setHostSpanAttributes,z as upsertIssueState};
@@ -0,0 +1,2 @@
1
+ import{o as T}from"./otlp-DR7601NL.mjs";import{N as l,g}from"./request-log-DdeDQptI.mjs";import{toErrorType as E}from"./resolveTraceAnchor-DDAPZRBB.mjs";const h=new Set(["ALTER","ANALYZE","BEGIN","CALL","COMMIT","COPY","CREATE","DEALLOCATE","DELETE","DESCRIBE","DO","DROP","EXECUTE","EXPLAIN","GRANT","INSERT","LISTEN","LOCK","MERGE","NOTIFY","PREPARE","REFRESH","RELEASE","REPLACE","REVOKE","ROLLBACK","SAVEPOINT","SELECT","SET","SHOW","START","TABLE","TRUNCATE","UNLISTEN","UPDATE","VACUUM","VALUES","WITH"]),f="OTHER",O=/^[a-z]+/iu,R=e=>{if(typeof e!="string")return f;let t=0;for(;t<e.length;){const o=e.charAt(t);if(o==="("||o.trim()==="")t+=1;else if(e.startsWith("--",t)){const a=e.indexOf(`
2
+ `,t);if(a===-1)return f;t=a+1}else if(e.startsWith("/*",t)){const a=e.indexOf("*/",t+2);if(a===-1)return f;t=a+2}else break}const r=O.exec(e.slice(t,t+16))?.[0].toUpperCase();return r!==void 0&&h.has(r)?r:f},S=e=>e??"other_sql",m=100,A=new Set(["aggregate","count","delete","deleteMany","deleteWhere","explain","findFirst","findFirstOrThrow","findMany","get","groupBy","insert","insertMany","insertManyUnsafe","lookupById","patch","patchIf","patchMany","patchWhere","rank","rankBefore","rankPage","rankPageRows","related","replace","restore"]),I=new Set(["aggregate","count","delete","deleteMany","deleteWhere","explain","findFirst","findFirstOrThrow","findMany","get","groupBy","insert","insertMany","insertManyUnsafe","patch","patchIf","patchMany","patchWhere","rank","rankBefore","rankPage","rankPageRows","replace","restore"]),P=(e,t)=>{if(!I.has(e))return;const r=t[0];return typeof r=="string"&&r.length>0?r:void 0},M=e=>e instanceof Error?e.message:typeof e=="string"?e:JSON.stringify(e)??String(e),L=(e,t,r)=>{const o=(t.scope??l).text(M(e));return r==="redact"?g(o,t.captureRaw):t.captureRaw===!0?o:E(e)},u=(e,t,r)=>{const{durationMs:o,failure:a,startTs:n}=t;return{durationMs:o,...a===void 0?{}:{error:{message:L(a,e,r),type:E(a)}},functionPath:e.functionPath,kind:"client",ok:a===void 0,parentSpanId:e.anchor.rootSpanId,...e.anchor.rayId===void 0?{}:{rayId:e.anchor.rayId},shardKey:e.shardKey,spanId:T(8),startTs:n,traceId:e.anchor.traceId,userId:e.userId()}},y=async(e,t,r,o)=>{const a=Date.now();let n,s;const c=(e.scope??l).hold();try{return s=await r(),s}catch(d){throw n=d,d}finally{const d=Date.now()-a,{tally:i}=e;i.calls+=1,i.durationMs+=d,i.perOperation[t]=(i.perOperation[t]??0)+1,n!==void 0&&(i.errors+=1);try{e.mode==="spans"&&(i.spansEmitted>=m?i.spansTruncated=!0:(i.spansEmitted+=1,e.record(o({durationMs:d,failure:n,result:s,startTs:a}))))}catch{}c()}},p=(e,t,r)=>{const o=new Map;return new Proxy({},{get(a,n){const s=Reflect.get(e,n,e);if(typeof n!="string"||typeof s!="function"||!t(n))return s;const c=s,d=o.get(n);if(d?.original===c)return d.instrumented;const i=r(n,c.bind(e));return o.set(n,{instrumented:i,original:c}),i},getOwnPropertyDescriptor(a,n){const s=Reflect.getOwnPropertyDescriptor(e,n);return s===void 0?void 0:{...s,configurable:!0}},defineProperty(a,n,s){return s.configurable===!1?!1:Reflect.defineProperty(e,n,s)},deleteProperty(a,n){return Reflect.deleteProperty(e,n)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(a,n){return Reflect.has(e,n)},ownKeys(){return Reflect.ownKeys(e)},set(a,n,s){return Reflect.set(e,n,s,e)}})},_=(e,t)=>t.mode==="off"?e:p(e,r=>A.has(r),(r,o)=>async(...a)=>{const n=P(r,a);return y(t,r,()=>o(...a),s=>({...u(t,s,"redact"),attributes:{"db.operation.name":r,...n===void 0?{}:{"db.collection.name":n},"db.system.name":"sqlite"},name:n===void 0?`db.${r}`:`db.${r} ${n}`}))}),C=(e,t)=>{if(t.mode==="off")return e;const r=S(e.dbSystem);return p(e,o=>o==="query",(o,a)=>async(...n)=>{const s=R(n[0]);return y(t,s,()=>a(...n),c=>({...u(t,c,"type-only"),attributes:{"db.operation.name":s,...Array.isArray(c.result)?{"db.response.returned_rows":c.result.length}:{},"db.system.name":r},name:`sql.${s}`}))})},D=()=>({calls:0,durationMs:0,errors:0,perOperation:{},spansEmitted:0,spansTruncated:!1}),k=(e,t="db")=>{const r={[`${t}.calls`]:e.calls,[`${t}.duration_ms`]:e.durationMs};e.errors>0&&(r[`${t}.errors`]=e.errors),e.spansTruncated&&(r[`${t}.spans_truncated`]=!0);for(const[o,a]of Object.entries(e.perOperation))r[`${t}.op.${o}`]=a;return r};export{D as createDatabaseTally,k as formatTally,_ as instrumentDatabase,C as instrumentSqlClient};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/observability",
3
- "version": "1.0.0-alpha.173",
3
+ "version": "1.0.0-alpha.175",
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",
@@ -45,7 +45,7 @@
45
45
  "dependencies": {
46
46
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
47
47
  "@lunora/fingerprint": "1.0.0-alpha.9",
48
- "@lunora/shard-engine": "1.0.0-alpha.161",
48
+ "@lunora/shard-engine": "1.0.0-alpha.163",
49
49
  "@lunora/wire": "1.0.0-alpha.2",
50
50
  "@visulima/redact": "5.0.0"
51
51
  },
@@ -1,2 +0,0 @@
1
- import{o as g}from"./otlp-DR7601NL.mjs";import{N as l,g as p}from"./request-log-DdeDQptI.mjs";import{toErrorType as E}from"./resolveTraceAnchor-DDAPZRBB.mjs";const h=new Set(["ALTER","ANALYZE","BEGIN","CALL","COMMIT","COPY","CREATE","DEALLOCATE","DELETE","DESCRIBE","DO","DROP","EXECUTE","EXPLAIN","GRANT","INSERT","LISTEN","LOCK","MERGE","NOTIFY","PREPARE","REFRESH","RELEASE","REPLACE","REVOKE","ROLLBACK","SAVEPOINT","SELECT","SET","SHOW","START","TABLE","TRUNCATE","UNLISTEN","UPDATE","VACUUM","VALUES","WITH"]),f="OTHER",O=/^[a-z]+/iu,R=e=>{if(typeof e!="string")return f;let t=0;for(;t<e.length;){const o=e.charAt(t);if(o==="("||o.trim()==="")t+=1;else if(e.startsWith("--",t)){const a=e.indexOf(`
2
- `,t);if(a===-1)return f;t=a+1}else if(e.startsWith("/*",t)){const a=e.indexOf("*/",t+2);if(a===-1)return f;t=a+2}else break}const r=O.exec(e.slice(t,t+16))?.[0].toUpperCase();return r!==void 0&&h.has(r)?r:f},S=e=>e??"other_sql",m=100,A=new Set(["aggregate","count","delete","deleteMany","deleteWhere","explain","findFirst","findFirstOrThrow","findMany","get","groupBy","insert","insertMany","insertManyUnsafe","lookupById","patch","patchIf","patchMany","patchWhere","rank","rankBefore","rankPage","rankPageRows","related","replace","restore"]),I=new Set(["aggregate","count","deleteWhere","explain","findFirst","findFirstOrThrow","findMany","groupBy","insert","insertMany","insertManyUnsafe","patchIf","patchWhere","rank","rankBefore","rankPage","rankPageRows"]),P=(e,t)=>{if(!I.has(e))return;const r=t[0];return typeof r=="string"&&r.length>0?r:void 0},L=e=>e instanceof Error?e.message:typeof e=="string"?e:JSON.stringify(e)??String(e),b=(e,t,r)=>{const o=(t.scope??l).text(L(e));return r==="redact"?p(o,t.captureRaw):t.captureRaw===!0?o:E(e)},u=(e,t,r)=>{const{durationMs:o,failure:a,startTs:n}=t;return{durationMs:o,...a===void 0?{}:{error:{message:b(a,e,r),type:E(a)}},functionPath:e.functionPath,kind:"client",ok:a===void 0,parentSpanId:e.anchor.rootSpanId,...e.anchor.rayId===void 0?{}:{rayId:e.anchor.rayId},shardKey:e.shardKey,spanId:g(8),startTs:n,traceId:e.anchor.traceId,userId:e.userId()}},y=async(e,t,r,o)=>{const a=Date.now();let n,s;const c=(e.scope??l).hold();try{return s=await r(),s}catch(d){throw n=d,d}finally{const d=Date.now()-a,{tally:i}=e;i.calls+=1,i.durationMs+=d,i.perOperation[t]=(i.perOperation[t]??0)+1,n!==void 0&&(i.errors+=1);try{e.mode==="spans"&&(i.spansEmitted>=m?i.spansTruncated=!0:(i.spansEmitted+=1,e.record(o({durationMs:d,failure:n,result:s,startTs:a}))))}catch{}c()}},T=(e,t,r)=>{const o=new Map;return new Proxy({},{get(a,n){const s=Reflect.get(e,n,e);if(typeof n!="string"||typeof s!="function"||!t(n))return s;const c=s,d=o.get(n);if(d?.original===c)return d.instrumented;const i=r(n,c.bind(e));return o.set(n,{instrumented:i,original:c}),i},getOwnPropertyDescriptor(a,n){const s=Reflect.getOwnPropertyDescriptor(e,n);return s===void 0?void 0:{...s,configurable:!0}},defineProperty(a,n,s){return s.configurable===!1?!1:Reflect.defineProperty(e,n,s)},deleteProperty(a,n){return Reflect.deleteProperty(e,n)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(a,n){return Reflect.has(e,n)},ownKeys(){return Reflect.ownKeys(e)},set(a,n,s){return Reflect.set(e,n,s,e)}})},_=(e,t)=>t.mode==="off"?e:T(e,r=>A.has(r),(r,o)=>async(...a)=>{const n=P(r,a);return y(t,r,()=>o(...a),s=>({...u(t,s,"redact"),attributes:{"db.operation.name":r,...n===void 0?{}:{"db.collection.name":n},"db.system.name":"sqlite"},name:n===void 0?`db.${r}`:`db.${r} ${n}`}))}),C=(e,t)=>{if(t.mode==="off")return e;const r=S(e.dbSystem);return T(e,o=>o==="query",(o,a)=>async(...n)=>{const s=R(n[0]);return y(t,s,()=>a(...n),c=>({...u(t,c,"type-only"),attributes:{"db.operation.name":s,...Array.isArray(c.result)?{"db.response.returned_rows":c.result.length}:{},"db.system.name":r},name:`sql.${s}`}))})},D=()=>({calls:0,durationMs:0,errors:0,perOperation:{},spansEmitted:0,spansTruncated:!1}),k=(e,t="db")=>{const r={[`${t}.calls`]:e.calls,[`${t}.duration_ms`]:e.durationMs};e.errors>0&&(r[`${t}.errors`]=e.errors),e.spansTruncated&&(r[`${t}.spans_truncated`]=!0);for(const[o,a]of Object.entries(e.perOperation))r[`${t}.op.${o}`]=a;return r};export{D as createDatabaseTally,k as formatTally,_ as instrumentDatabase,C as instrumentSqlClient};