Skip to content

Commit

Permalink
fix: ts type defined at start of file
Browse files Browse the repository at this point in the history
  • Loading branch information
sagivoululumigo committed May 12, 2024
1 parent bd02081 commit e711092
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/hooks/baseHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ export type RequestData = {
sendTime?: number;
};

export type httpRequestCreatedParams = {
options?: ParseHttpRequestOptions;
url?: string;
};

export class BaseHttp {
/**
* Starts an HTTP request tracing span
Expand All @@ -93,10 +98,7 @@ export class BaseHttp {
static onRequestCreated({
options,
url,
}: {
options: ParseHttpRequestOptions;
url: string;
}): HttpRequestTracingConfig | undefined {
}: httpRequestCreatedParams): HttpRequestTracingConfig | undefined {
// Gather basic info for creating the HTTP span
const host = BaseHttp._getHostFromOptionsOrUrl({ options, url });
const headers = options.headers || {};
Expand Down Expand Up @@ -150,13 +152,7 @@ export class BaseHttp {
}

@GlobalDurationTimer.timedSync()
static _getHostFromOptionsOrUrl({
options,
url = undefined,
}: {
options?: ParseHttpRequestOptions;
url?: string;
}) {
static _getHostFromOptionsOrUrl({ options, url = undefined }: httpRequestCreatedParams) {
if (url) {
return new URL(url).hostname;
}
Expand Down Expand Up @@ -304,16 +300,16 @@ export class BaseHttp {
};
}

static isBlacklisted(host: string) {
static isBlacklisted(host: string): boolean {
return host === getEdgeHost() || hostBlacklist.has(host);
}

static aggregateRequestBodyToSpan(
body,
body: string,
requestData: RequestData,
currentSpan: BasicChildSpan,
maxSize: number = getEventEntitySize(true)
) {
): void {
let serviceData: ServiceData = {};
if (body && !requestData.truncated) {
requestData.body += body;
Expand Down

0 comments on commit e711092

Please sign in to comment.