Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to 'cross-fetch' instead of 'request' #6

Merged
merged 7 commits into from
Jan 25, 2022
376 changes: 9 additions & 367 deletions packages/thrift-client-zipkin-filter/package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions packages/thrift-client-zipkin-filter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
"typescript": "~4.4.4"
},
"dependencies": {
"@types/request": "^2.48.8",
"request": "^2.88.2",
"cross-fetch": "^3.1.4",
"zipkin": "^0.22.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Instrumentation, TraceId, Tracer } from 'zipkin'

import { CoreOptions } from 'request'

import {
formatUrl,
IRequestContext,
Expand All @@ -15,6 +13,7 @@ import {
IThriftClientFilter,
IThriftRequest,
NextFunction,
RequestOptions,
} from '@statestitle/thrift-client'

import {
Expand Down Expand Up @@ -65,7 +64,7 @@ function readRequestContext(
}

function readRequestHeaders(
request: IThriftRequest<CoreOptions>,
request: IThriftRequest<RequestOptions>,
): IRequestHeaders {
if (request.context && request.context.headers) {
return request.context.headers
Expand All @@ -78,7 +77,7 @@ export function ThriftClientZipkinFilter<Context extends IRequest>({
localServiceName,
remoteServiceName,
tracerConfig = {},
}: IZipkinClientOptions): IThriftClientFilter<CoreOptions> {
}: IZipkinClientOptions): IThriftClientFilter<RequestOptions> {
const serviceName: string = remoteServiceName || localServiceName
const tracer: Tracer = getTracerForService(serviceName, tracerConfig)
const instrumentation = new Instrumentation.HttpClient({
Expand All @@ -90,8 +89,8 @@ export function ThriftClientZipkinFilter<Context extends IRequest>({
return {
methods: [],
handler(
request: IThriftRequest<CoreOptions>,
next: NextFunction<CoreOptions>,
request: IThriftRequest<RequestOptions>,
next: NextFunction<RequestOptions>,
): Promise<IRequestResponse> {
const requestHeaders: IRequestHeaders = readRequestHeaders(request)
const requestContext: IRequestContext = readRequestContext(
Expand Down
Loading