Skip to content

Commit

Permalink
Merge branch 'v6' into thomas.lebeau/polyfill-s
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-lebeau committed Aug 1, 2024
2 parents 8395cc9 + c04e32b commit 636aba9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/core/src/tools/experimentalFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export enum ExperimentalFeature {
TOLERANT_RESOURCE_TIMINGS = 'tolerant_resource_timings',
REMOTE_CONFIGURATION = 'remote_configuration',
UPDATE_VIEW_NAME = 'update_view_name',
NULL_INP_TELEMETRY = 'null_inp_telemetry',
}

const enabledExperimentalFeatures: Set<ExperimentalFeature> = new Set()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { elapsed, noop, ONE_MINUTE } from '@datadog/browser-core'
import {
addTelemetryDebug,
elapsed,
ExperimentalFeature,
isExperimentalFeatureEnabled,
noop,
ONE_MINUTE,
} from '@datadog/browser-core'
import type { Duration, RelativeTime } from '@datadog/browser-core'
import { RumPerformanceEntryType, supportPerformanceTimingEvent } from '../../../browser/performanceObservable'
import type { RumFirstInputTiming, RumPerformanceEventTiming } from '../../../browser/performanceObservable'
Expand Down Expand Up @@ -65,17 +72,26 @@ export function trackInteractionToNextPaint(

const newInteraction = longestInteractions.estimateP98Interaction()
if (newInteraction && newInteraction.duration !== interactionToNextPaint) {
const inpTarget = newInteraction.target
interactionToNextPaint = newInteraction.duration
interactionToNextPaintStartTime = elapsed(viewStart, newInteraction.startTime)

if (newInteraction.target && isElementNode(newInteraction.target)) {
interactionToNextPaintTargetSelector = getSelectorFromElement(
newInteraction.target,
configuration.actionNameAttribute
)
if (inpTarget && isElementNode(inpTarget)) {
interactionToNextPaintTargetSelector = getSelectorFromElement(inpTarget, configuration.actionNameAttribute)
} else {
interactionToNextPaintTargetSelector = undefined
}
if (
!interactionToNextPaintTargetSelector &&
isExperimentalFeatureEnabled(ExperimentalFeature.NULL_INP_TELEMETRY)
) {
addTelemetryDebug('Fail to get INP target selector', {
hasTarget: !!inpTarget,
targetIsConnected: inpTarget ? inpTarget.isConnected : undefined,
targetIsElementNode: inpTarget ? isElementNode(inpTarget) : undefined,
inp: newInteraction.duration,
})
}
}
})

Expand Down
1 change: 0 additions & 1 deletion scripts/lib/git-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ module.exports = {
initGitConfig,
fetchPR,
getLastCommonCommit,
BASE_BRANCH: process.env.MAIN_BRANCH,
LOCAL_BRANCH: process.env.CI_COMMIT_REF_NAME,
GITHUB_TOKEN,
}
4 changes: 2 additions & 2 deletions scripts/performance/report-as-a-pr-comment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { command } = require('../lib/command')
const { fetchHandlingError } = require('../lib/execution-utils')
const { LOCAL_BRANCH, BASE_BRANCH, GITHUB_TOKEN, getLastCommonCommit, fetchPR } = require('../lib/git-utils')
const { LOCAL_BRANCH, GITHUB_TOKEN, getLastCommonCommit, fetchPR } = require('../lib/git-utils')
const { fetchPerformanceMetrics } = require('./fetch-performance-metrics')
const PR_COMMENT_HEADER = 'Bundles Sizes Evolution'
const PR_COMMENTER_AUTH_TOKEN = command`authanywhere`.run().split(' ')[2].trim()
Expand All @@ -9,12 +9,12 @@ const SIZE_INCREASE_THRESHOLD = 5
const LOCAL_COMMIT_SHA = process.env.CI_COMMIT_SHORT_SHA

async function reportAsPrComment(localBundleSizes, memoryLocalPerformance) {
const lastCommonCommit = getLastCommonCommit(BASE_BRANCH, LOCAL_BRANCH)
const pr = await fetchPR(LOCAL_BRANCH)
if (!pr) {
console.log('No pull requests found for the branch')
return
}
const lastCommonCommit = getLastCommonCommit(pr.base.ref, LOCAL_BRANCH)
const packageNames = Object.keys(localBundleSizes)
const testNames = memoryLocalPerformance.map((obj) => obj.testProperty)
const baseBundleSizes = await fetchPerformanceMetrics('bundle', packageNames, lastCommonCommit)
Expand Down

0 comments on commit 636aba9

Please sign in to comment.