import { getLogger } from "../utils/logger.js";

//#region src/otel/processor.ts
/**
* OTEL SpanProcessor that routes completed spans through SpanEventMapper.
*
* Register this processor on a TracerProvider to automatically convert
* every span into the appropriate [Agent] event(s).
*/
const logger = getLogger();
var AmplitudeEventSpanProcessor = class {
	_mapper;
	constructor(mapper) {
		this._mapper = mapper;
	}
	onStart(_span, _parentContext) {}
	onEnd(span) {
		try {
			this._mapper.mapAndTrack(span);
		} catch (e) {
			logger.debug(`Failed to map span to Amplitude event: ${e}`);
		}
	}
	shutdown() {
		return Promise.resolve();
	}
	forceFlush(_timeoutMillis) {
		return Promise.resolve();
	}
};

//#endregion
export { AmplitudeEventSpanProcessor };
//# sourceMappingURL=processor.js.map