Skip to content

Commit

Permalink
chore: lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
waitingsong committed Oct 10, 2024
1 parent a7a8a4c commit e271145
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
11 changes: 3 additions & 8 deletions packages/fetch/src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-types */
import type { Span } from '@opentelemetry/api'
import type { JsonObject } from '@waiting/shared-types'
import type {
Expand All @@ -10,18 +9,14 @@ import type {
} from 'undici'



export {
type HeadersInit,
type RequestInfo,
type RequestInit,
FormData,
Headers,
Response,
} from 'undici'
export type {
HeadersInit,
RequestInfo,
RequestInit,
} from 'undici'


export interface Options extends RequestInit, Args {
url: RequestInfo
Expand Down
7 changes: 3 additions & 4 deletions packages/midway-component-fetch/src/lib/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
type DecoratorTraceDataResp,
AttrNames,
HeadersKey,
SemanticAttributes,
propagateHeader,
} from '@mwcp/otel'
// eslint-disable-next-line import/no-extraneous-dependencies
Expand Down Expand Up @@ -35,7 +34,7 @@ export const genRequestHeaders: Config['genRequestHeaders'] = (options, headersI
return headers
}

if (! headers.has(HeadersKey.otelTraceId)) {
if (! headers.has(HeadersKey.TRACE_PARENT_HEADER)) {
const tmp = {}
propagation.inject(traceContext, tmp)
Object.entries(tmp).forEach(([key, val]) => {
Expand Down Expand Up @@ -185,8 +184,8 @@ export function genOutgoingRequestAttributes(options: ReqCallbackOptions): Attri

const url = pickUrlStrFromRequestInfo(opts.url)
const tags: Attributes = {
[SemanticAttributes.HTTP_METHOD]: opts.method,
[SemanticAttributes.HTTP_URL]: url,
['http.method']: opts.method,
['http.url']: url,
}

if (enableTraceLoggingReqBody && typeof opts.data !== 'undefined') {
Expand Down

0 comments on commit e271145

Please sign in to comment.