Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
00f300a0
Unverified
Commit
00f300a0
authored
Feb 23, 2024
by
Dima Voytenko
Committed by
GitHub
Feb 23, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Telemetry: ensure the ClientComponentLoad metric is only reported when available (#62459)
parent
dcf8f041
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
24 deletions
+33
-24
app-render.tsx
packages/next/src/server/app-render/app-render.tsx
+14
-10
client-component-renderer-logger.ts
packages/next/src/server/client-component-renderer-logger.ts
+8
-5
pipe-readable.ts
packages/next/src/server/pipe-readable.ts
+11
-9
No files found.
packages/next/src/server/app-render/app-render.tsx
View file @
00f300a0
...
@@ -634,16 +634,20 @@ async function renderToHTMLOrFlightImpl(
...
@@ -634,16 +634,20 @@ async function renderToHTMLOrFlightImpl(
req
.
on
(
'end'
,
()
=>
{
req
.
on
(
'end'
,
()
=>
{
if
(
'performance'
in
globalThis
)
{
if
(
'performance'
in
globalThis
)
{
const
metrics
=
getClientComponentLoaderMetrics
({
reset
:
true
})
const
metrics
=
getClientComponentLoaderMetrics
({
reset
:
true
})
getTracer
()
if
(
metrics
)
{
.
startSpan
(
NextNodeServerSpan
.
clientComponentLoading
,
{
getTracer
()
startTime
:
metrics
.
clientComponentLoadStart
,
.
startSpan
(
NextNodeServerSpan
.
clientComponentLoading
,
{
attributes
:
{
startTime
:
metrics
.
clientComponentLoadStart
,
'next.clientComponentLoadCount'
:
metrics
.
clientComponentLoadCount
,
attributes
:
{
},
'next.clientComponentLoadCount'
:
})
metrics
.
clientComponentLoadCount
,
.
end
(
},
metrics
.
clientComponentLoadStart
+
metrics
.
clientComponentLoadTimes
})
)
.
end
(
metrics
.
clientComponentLoadStart
+
metrics
.
clientComponentLoadTimes
)
}
}
}
})
})
}
}
...
...
packages/next/src/server/client-component-renderer-logger.ts
View file @
00f300a0
...
@@ -37,11 +37,14 @@ export function wrapClientComponentLoader(ComponentMod: any) {
...
@@ -37,11 +37,14 @@ export function wrapClientComponentLoader(ComponentMod: any) {
export
function
getClientComponentLoaderMetrics
(
export
function
getClientComponentLoaderMetrics
(
options
:
{
reset
?:
boolean
}
=
{}
options
:
{
reset
?:
boolean
}
=
{}
)
{
)
{
const
metrics
=
{
const
metrics
=
clientComponentLoadStart
,
clientComponentLoadStart
===
0
clientComponentLoadTimes
,
?
undefined
clientComponentLoadCount
,
:
{
}
clientComponentLoadStart
,
clientComponentLoadTimes
,
clientComponentLoadCount
,
}
if
(
options
.
reset
)
{
if
(
options
.
reset
)
{
clientComponentLoadStart
=
0
clientComponentLoadStart
=
0
...
...
packages/next/src/server/pipe-readable.ts
View file @
00f300a0
...
@@ -55,15 +55,17 @@ function createWriterFromResponse(
...
@@ -55,15 +55,17 @@ function createWriterFromResponse(
process
.
env
.
NEXT_OTEL_PERFORMANCE_PREFIX
process
.
env
.
NEXT_OTEL_PERFORMANCE_PREFIX
)
{
)
{
const
metrics
=
getClientComponentLoaderMetrics
()
const
metrics
=
getClientComponentLoaderMetrics
()
performance
.
measure
(
if
(
metrics
)
{
`
${
process
.
env
.
NEXT_OTEL_PERFORMANCE_PREFIX
}
:next-client-component-loading`
,
performance
.
measure
(
{
`
${
process
.
env
.
NEXT_OTEL_PERFORMANCE_PREFIX
}
:next-client-component-loading`
,
start
:
metrics
.
clientComponentLoadStart
,
{
end
:
start
:
metrics
.
clientComponentLoadStart
,
metrics
.
clientComponentLoadStart
+
end
:
metrics
.
clientComponentLoadTimes
,
metrics
.
clientComponentLoadStart
+
}
metrics
.
clientComponentLoadTimes
,
)
}
)
}
}
}
res
.
flushHeaders
()
res
.
flushHeaders
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment