newrelic distributed tracing Transaction handle methods (#40550)

* Adds newrelic distributed tracing Transaction handle methods

* Adds newrelic distributed tracing Transaction handle methods
This commit is contained in:
Kenneth Aasan
2019-11-22 07:41:35 -08:00
committed by Sheetal Nandi
parent 6f4c34b258
commit 85e29d5a71
2 changed files with 25 additions and 0 deletions
+23
View File
@@ -4,6 +4,7 @@
// Brooks Patton <https://github.com/brookspatton>
// Michael Bond <https://github.com/MichaelRBond>
// Kyle Scully <https://github.com/zieka>
// Kenneth Aasan <https://github.com/kennethaasan>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// https://docs.newrelic.com/docs/agents/nodejs-agent/api-guides/nodejs-agent-api
@@ -354,6 +355,18 @@ export interface Metric {
sumOfSquares: number;
}
export interface DistributedTracePayload {
/**
* The base64 encoded JSON representation of the distributed trace payload.
*/
text(): string;
/**
* The base64 encoded JSON representation of the distributed trace payload.
*/
httpSafe(): string;
}
export interface TransactionHandle {
/**
* End the transaction.
@@ -364,4 +377,14 @@ export interface TransactionHandle {
* Mark the transaction to be ignored.
*/
ignore(): void;
/**
* Creates a distributed trace payload.
*/
createDistributedTracePayload(): DistributedTracePayload;
/**
* Parses incoming distributed trace header payload.
*/
acceptDistributedTracePayload(payload: DistributedTracePayload): void;
}
+2
View File
@@ -7,6 +7,8 @@ const trans = newrelic.getTransaction();
trans.ignore(); // $ExpectType void
trans.end(); // $ExpectType void
trans.end(() => {}); // $ExpectType void
const payload = trans.createDistributedTracePayload(); // $ExpectType DistributedTracePayload
trans.acceptDistributedTracePayload(payload); // $ExpectType void
newrelic.setDispatcher('foo'); // $ExpectType void
newrelic.setDispatcher('foo', '42'); // $ExpectType void