@embrace-io/web-sdk
Version:
28 lines (27 loc) • 883 B
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
let _opentelemetry_semantic_conventions_incubating = require("@opentelemetry/semantic-conventions/incubating");
//#region src/processors/UserSpanProcessor/UserSpanProcessor.ts
/**
* UserSpanProcessor sets the userId attribute on all spans if the userId is set in the UserManager.
*/
var UserSpanProcessor = class {
_userManager;
constructor({ userManager }) {
this._userManager = userManager;
}
forceFlush() {
return Promise.resolve(void 0);
}
onEnding(span) {
const userId = this._userManager.getUserId();
if (userId) span.attributes[_opentelemetry_semantic_conventions_incubating.ATTR_USER_ID] = userId;
}
onStart() {}
onEnd() {}
shutdown() {
return Promise.resolve(void 0);
}
};
//#endregion
exports.UserSpanProcessor = UserSpanProcessor;
//# sourceMappingURL=UserSpanProcessor.cjs.map