Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions packages/apm/src/integrations/express.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import { Integration, Transaction } from '@sentry/types';
import { logger } from '@sentry/utils';
// tslint:disable-next-line:no-implicit-dependencies
import { Application, ErrorRequestHandler, NextFunction, Request, RequestHandler, Response } from 'express';

// tslint:disable: completed-docs
// Have to manually set types because we are using package-alias
interface Application {
use(...args: any): any;
}

type ErrorRequestHandler = (...args: any) => any;
type RequestHandler = (...args: any) => any;
type NextFunction = (...args: any) => any;

interface Response {
once(name: string, callback: () => void): void;
}
// tslint:enable: completed-docs

/**
* Internal helper for `__sentry_transaction`
Expand Down Expand Up @@ -167,6 +180,7 @@ function wrapUseArgs(args: IArguments): unknown[] {
* Patches original app.use to utilize our tracing functionality
*/
function instrumentMiddlewares(app: Application): Application {
// tslint:disable-next-line: no-unbound-method
const originalAppUse = app.use;
app.use = function(): any {
return originalAppUse.apply(this, wrapUseArgs(arguments));
Expand Down
18 changes: 16 additions & 2 deletions packages/tracing/src/integrations/express.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import { Integration, Transaction } from '@sentry/types';
import { logger } from '@sentry/utils';
// tslint:disable-next-line:no-implicit-dependencies
import { Application, ErrorRequestHandler, NextFunction, Request, RequestHandler, Response } from 'express';

// tslint:disable: completed-docs
// Have to manually set types because we are using package-alias
interface Application {
use(...args: any): any;
}

type ErrorRequestHandler = (...args: any) => any;
type RequestHandler = (...args: any) => any;
type NextFunction = (...args: any) => any;

interface Response {
once(name: string, callback: () => void): void;
}
// tslint:enable: completed-docs

/**
* Internal helper for `__sentry_transaction`
Expand Down Expand Up @@ -167,6 +180,7 @@ function wrapUseArgs(args: IArguments): unknown[] {
* Patches original app.use to utilize our tracing functionality
*/
function instrumentMiddlewares(app: Application): Application {
// tslint:disable-next-line: no-unbound-method
const originalAppUse = app.use;
app.use = function(): any {
return originalAppUse.apply(this, wrapUseArgs(arguments));
Expand Down