Skip to content

Commit

Permalink
fix: use 'detail' not 'details'
Browse files Browse the repository at this point in the history
  • Loading branch information
niieani committed Nov 22, 2024
1 parent bc8e732 commit c69a7ec
Show file tree
Hide file tree
Showing 6 changed files with 4,338 additions and 4,333 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"source": "src/main.ts",
"types": "src/index.ts",
"scripts": {
"dev": "rm -rf esm/* && echo \"export * from '../src/main'\" > ./esm/main.d.ts && yarn webpack build --mode development --entry ./src/main --watch",
"dev": "echo \"export * from '../src/main'\" > ./esm/main.d.ts && yarn webpack build --mode development --entry ./src/main --watch",
"build": "yarn build:cjs && yarn build:esm && yarn copy:css",
"build:cjs": "yarn rrun tsc --outDir cjs --module commonjs --target es2021",
"build:esm": "rm -rf esm && yarn build:esm:ts && yarn build:esm:webpack && cp package.esm.json esm/package.json",
Expand Down
42 changes: 21 additions & 21 deletions src/v3/getSpanFromPerformanceEntry.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { getCommonUrlForTracing } from '../main'
import { ensureTimestamp } from './ensureTimestamp'
import { Attributes, InitiatorType, NativePerformanceEntryType, PerformanceEntrySpan, ResourceSpan } from './spanTypes'
import {
Attributes,
InitiatorType,
NativePerformanceEntryType,
PerformanceEntrySpan,
ResourceSpan,
} from './spanTypes'
import { ScopeBase, Timestamp } from './types'

/**
* Maps Performance Entry to Trace Entry
* @param inputEntry - The performance entry event.
* @returns {Span} The span.
* Maps Performance Entry to a Span
* @returns The span.
*/
export function getSpanFromPerformanceEntry<ScopeT extends ScopeBase>(
inputEntry: PerformanceEntry,
Expand All @@ -17,19 +22,16 @@ export function getSpanFromPerformanceEntry<ScopeT extends ScopeBase>(
}

const attributes =
'details' in inputEntry &&
typeof inputEntry.detail === 'object' &&
inputEntry.details !== null
? (inputEntry.details as Attributes)
'detail' in inputEntry &&
typeof inputEntry.detail === 'object' &&
inputEntry.detail !== null
? (inputEntry.detail as Attributes)
: {}

const type = inputEntry.entryType as NativePerformanceEntryType
let { name } = inputEntry

if (
type === 'resource' ||
type === 'navigation'
) {
if (type === 'resource' || type === 'navigation') {
const { commonUrl, query, hash } = getCommonUrlForTracing(inputEntry.name)
name = commonUrl

Expand All @@ -52,17 +54,15 @@ export function getSpanFromPerformanceEntry<ScopeT extends ScopeBase>(
},
}
}
} else if (
type !== 'mark' &&
type !== 'measure'
) {
name = `${type}${inputEntry.name &&
inputEntry.name !== 'unknown' &&
inputEntry.name.length > 0 &&
type !== inputEntry.name
} else if (type !== 'mark' && type !== 'measure') {
name = `${type}${
inputEntry.name &&
inputEntry.name !== 'unknown' &&
inputEntry.name.length > 0 &&
type !== inputEntry.name
? `/${inputEntry.name}`
: ''
}`
}`
}

const timestamp: Partial<Timestamp> = {
Expand Down
Loading

0 comments on commit c69a7ec

Please sign in to comment.