UNPKG

@embrace-io/web-sdk

Version:
3 lines (2 loc) 1.31 kB
import{diag as t,trace as e,metrics as r}from"@opentelemetry/api";import{logs as i}from"@opentelemetry/api-logs";class n{constructor(n,s,o){this.instrumentationName=n,this.instrumentationVersion=s,this._config={},this.setConfig(o),this._diag=t.createComponentLogger({namespace:n}),this._tracer=e.getTracer(n,s),this._meter=r.getMeter(n,s),this._logger=i.getLogger(n,s),this._updateMetricInstruments()}get tracer(){return this._tracer}get meter(){return this._meter}get logger(){return this._logger}getModuleDefinitions(){var t;const e=null!==(t=this.init())&&void 0!==t?t:[];return Array.isArray(e)?e:[e]}getConfig(){return this._config}setConfig(t){this._config=Object.assign({enabled:!0},t)}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}_updateMetricInstruments(){}_runSpanCustomizationHook(t,e,r,i){if(t)try{t(r,i)}catch(t){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:e},t)}}}export{n as InstrumentationAbstract}; //# sourceMappingURL=InstrumentationAbstract.js.map