Created
October 24, 2018 16:46
-
-
Save mgax/26fc2a4727f1f813f06368edb05d927a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as LibhoneyEventAPI from 'honeycomb-beeline/lib/api/libhoney'; // tslint:disable-line no-submodule-imports | |
import * as tracker from 'honeycomb-beeline/lib/async_tracker'; // tslint:disable-line no-submodule-imports | |
shimmer.wrap(LibhoneyEventAPI.prototype, 'startSpan', original => function () { | |
const eventPayload = original.apply(this, arguments); | |
const context = tracker.getTracked(); | |
if (context.stack.length > 1) context.stack.pop(); | |
return eventPayload; | |
}); | |
shimmer.wrap(LibhoneyEventAPI.prototype, 'finishSpan', original => function () { | |
const ev = arguments[0]; | |
const context = tracker.getTracked(); | |
context.stack.push(ev); | |
return original.apply(this, arguments); | |
}); | |
shimmer.wrap(LibhoneyEventAPI.prototype, 'finishTrace', original => function () { | |
const context = tracker.getTracked(); | |
context.stack.pop(); | |
return original.apply(this, arguments); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment