Add type support for NewRelic's AWS Lambda monitoring

This commit is contained in:
Michael Bond
2018-12-16 07:44:39 -05:00
parent 9e7c8df972
commit e2f28fb92b
2 changed files with 11 additions and 0 deletions
+9
View File
@@ -2,6 +2,7 @@
// Project: http://github.com/newrelic/node-newrelic
// Definitions by: Matt R. Wilson <https://github.com/mastermatt>
// Brooks Patton <https://github.com/brookspatton>
// Michael Bond <https://github.com/MichaelRBond>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// https://docs.newrelic.com/docs/agents/nodejs-agent/api-guides/nodejs-agent-api
@@ -321,6 +322,14 @@ export const instrumentMessages: Instrument;
export function shutdown(cb?: (error?: Error) => void): void;
export function shutdown(options?: { collectPendingData?: boolean, timeout?: number }, cb?: (error?: Error) => void): void;
/**
* Wraps an AWS Lambda function with NewRelic instrumentation and returns the value of the handler
*
* @param handler a callback function whose value is returned from setLambdaHandler
* @returns the value returned by handler
*/
export function setLambdaHandler<T>(handler: (...args: any[]) => T): T;
export interface Instrument {
(opts: { moduleName: string, onRequire: () => void, onError?: (err: Error) => void }): void;
(moduleName: string, onRequire: () => void, onError?: (err: Error) => void): void;
+2
View File
@@ -104,3 +104,5 @@ newrelic.shutdown({ collectPendingData: true, timeout: 3000 }, (err) => {
newrelic.shutdown((err) => {
const error: Error | undefined = err;
});
newrelic.setLambdaHandler(() => void 0); // $ExpectType void