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