"use strict";let n,s,M;function f(r){n=r}function R(){return n}function d(r,e){if(!n)throw new Error("MetricReporterFactory not configured. Call setMetricReporterFactory() first.");return n.createMetricReporter(r,e)}function T(r){s=r}function _(){return s}function v(r){M=r}function y(){return M}function F(r){M?.reportUsage(r)}class m{reportHistogramMetrics(){}reportCountMetrics(){}wrapMetrics(e,t){return t}callWithMetrics(e,t){return t()}wrapTrace(e,t,o){return t}callWithTrace(e,t){return t()}Metric(e){return(t,o,c)=>c}Trace(e,t){return(o,c,i)=>i}}const N=new m;class w{constructor(e,t){this.namespace=e,this.scope=t}delegate;resolve(){return this.delegate||(this.delegate=n?n.createMetricReporter(this.namespace,this.scope):void 0),this.delegate??N}reportHistogramMetrics(e,t){this.resolve().reportHistogramMetrics(e,t)}reportCountMetrics(e,t){this.resolve().reportCountMetrics(e,t)}wrapMetrics(e,t){return(...o)=>this.resolve().callWithMetrics(e,()=>t(...o))}callWithMetrics(e,t){return this.resolve().callWithMetrics(e,t)}wrapTrace(e,t,o){return(...c)=>this.resolve().callWithTrace(e,()=>t(...c))}callWithTrace(e,t){return this.resolve().callWithTrace(e,t)}Metric(e){const t=this.resolve.bind(this);return function(o,c,i){const a=i.value,l=typeof c=="string"?c:String(c),u=e||l,p=function(...g){return t().callWithMetrics(u,()=>a.apply(this,g))};i.value=p}}Trace(e,t){const o=this.resolve.bind(this);return function(c,i,a){const l=a.value,u=typeof i=="string"?i:String(i),p=e||u,g=function(...h){return o().wrapTrace(p,l.bind(this),t)(...h)};a.value=g}}}function D(r,e){return new w(r,e)}function W(r){return(e,t,o)=>o}const O={Trace(r){return s?s.Trace(r):W()}};exports.NoOpMetricReporter=m;exports.Telemetry=O;exports.createMetricReporter=d;exports.getFeatureReporter=y;exports.getMetricReporterFactory=R;exports.getMetricReporterOrNoOp=D;exports.getTelemetryDecorators=_;exports.reportFeatureUsage=F;exports.setFeatureReporter=v;exports.setMetricReporterFactory=f;exports.setTelemetryDecorators=T;
//# sourceMappingURL=telemetry-C8yrvnwb.cjs.map
