Skip to content

Commit

Permalink
fix: wrong and missing type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
sagivoululumigo committed May 8, 2024
1 parent d326aad commit e07d28c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
27 changes: 5 additions & 22 deletions src/hooks/baseHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,23 +166,6 @@ export class BaseHttp {
return 'localhost';
}

// static createSendRequestDataHandler({
// requestData,
// currentSpan,
// }: {
// requestData: { body: string };
// currentSpan: BasicChildSpan;
// }) {
// return function (data: Object, encoding: string) {
// GlobalDurationTimer.start();
// if (isEmptyString(requestData.body)) {
// const body = extractBodyFromWriteOrEndFunc(args);
// Http.aggregateRequestBodyToSpan(body, requestData, currentSpan, getEventEntitySize(true));
// }
// GlobalDurationTimer.stop();
// };
// }

/**
* Returns a handler that should be called every time request body data is sent to the server.
* This handler will collect the request body and add it to the current span.
Expand All @@ -198,7 +181,7 @@ export class BaseHttp {
requestData,
currentSpan = undefined,
}: {
requestData: { body: string };
requestData: RequestData;
currentSpan?: BasicChildSpan;
}): Function {
return function (args: any[]) {
Expand Down Expand Up @@ -231,7 +214,7 @@ export class BaseHttp {
requestData,
currentSpan = undefined,
}: {
requestData: { body: string };
requestData: RequestData;
currentSpan?: BasicChildSpan;
}): Function {
return function (socketEventArgs: {}) {
Expand Down Expand Up @@ -324,9 +307,9 @@ export class BaseHttp {

static aggregateRequestBodyToSpan(
body,
requestData,
currentSpan,
maxSize = getEventEntitySize(true)
requestData: RequestData,
currentSpan: BasicChildSpan,
maxSize: number = getEventEntitySize(true)
) {
let serviceData: ServiceData = {};
if (body && !requestData.truncated) {
Expand Down
4 changes: 2 additions & 2 deletions src/spans/awsSpan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export const decodeHttpBody = (httpBody: any, hasError: boolean): any | string =
return httpBody;
};

export const getHttpInfo = (requestData, responseData): HttpInfo => {
export const getHttpInfo = (requestData: RequestData, responseData): HttpInfo => {
const { host } = requestData;
const request = Object.assign({}, requestData);
const response = Object.assign({}, responseData);
Expand Down Expand Up @@ -417,7 +417,7 @@ export const getHttpSpan = (
HTTP_SPAN
);

let info = Object.assign({}, basicHttpSpan.info, {
const info = Object.assign({}, basicHttpSpan.info, {
httpInfo,
...awsServiceData,
});
Expand Down
4 changes: 3 additions & 1 deletion src/types/spans/basicSpan.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { HttpInfo } from './httpSpan';

export type Vendor = 'AWS';

export interface SpanInfo {
Expand All @@ -12,7 +14,7 @@ export interface SpanInfo {

export interface BasicSpan {
id: string;
info: SpanInfo;
info: SpanInfo | { httpInfo: HttpInfo };
vendor: Vendor;
transactionId: string;
account: string;
Expand Down

0 comments on commit e07d28c

Please sign in to comment.