mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Merge pull request #31442 from MichaelRBond/newrelic-lambda
Add type support for NewRelic's AWS Lambda monitoring
This commit is contained in:
Vendored
+10
-1
@@ -1,7 +1,8 @@
|
||||
// Type definitions for newrelic 3.4
|
||||
// Type definitions for newrelic 4.11
|
||||
// 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;
|
||||
|
||||
@@ -104,3 +104,5 @@ newrelic.shutdown({ collectPendingData: true, timeout: 3000 }, (err) => {
|
||||
newrelic.shutdown((err) => {
|
||||
const error: Error | undefined = err;
|
||||
});
|
||||
|
||||
newrelic.setLambdaHandler(() => void 0); // $ExpectType undefined
|
||||
|
||||
Reference in New Issue
Block a user