Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/main' into use-otel-in-runtime
  • Loading branch information
pieh committed Oct 14, 2025
commit 19ef7102b4c478636f2a4268519ff91c682f2fc5
20 changes: 11 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@netlify/edge-functions": "^2.17.1",
"@netlify/edge-functions-bootstrap": "^2.14.0",
"@netlify/eslint-config-node": "^7.0.1",
"@netlify/functions": "^4.2.7",
"@netlify/functions": "^4.3.0",
"@netlify/otel": "^4.3.0",
"@netlify/serverless-functions-api": "^2.5.0",
"@netlify/zip-it-and-ship-it": "^14.1.8",
Expand Down
4 changes: 2 additions & 2 deletions src/build/skew-protection.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mkdir, writeFile } from 'node:fs/promises'
import { dirname } from 'node:path'

import type { Span } from '@opentelemetry/api'

Check failure on line 4 in src/build/skew-protection.ts

View workflow job for this annotation

GitHub Actions / Lint

"@opentelemetry/api" is extraneous.

import type { PluginContext } from './plugin-context.js'

Expand Down Expand Up @@ -87,10 +87,10 @@
}
}

export const setSkewProtection = async (ctx: PluginContext, span: Span) => {
export const setSkewProtection = async (ctx: PluginContext, span?: Span) => {
const { enabled, enabledOrDisabledReason } = shouldEnableSkewProtection(ctx)

span.setAttribute('skewProtection', enabledOrDisabledReason)
span?.setAttribute('skewProtection', enabledOrDisabledReason)

if (!enabled) {
if (enabledOrDisabledReason === EnabledOrDisabledReason.OPT_OUT_NO_VALID_DEPLOY_ID_ENV_VAR) {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const onPreBuild = async (options: NetlifyPluginOptions) => {
return
}

await withActiveSpan(tracer, 'onPreBuild', async () => {
await withActiveSpan(tracer, 'onPreBuild', async (span) => {
// Enable Next.js standalone mode at build time
process.env.NEXT_PRIVATE_STANDALONE = 'true'
const ctx = new PluginContext(options)
Expand Down
14 changes: 10 additions & 4 deletions src/run/handlers/cache.cts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ import {
} from '../storage/storage.cjs'

import { getLogger, getRequestContext } from './request-context.cjs'
import { isAnyTagStale, markTagsAsStaleAndPurgeEdgeCache, purgeEdgeCache } from './tags-handler.cjs'
import {
isAnyTagStaleOrExpired,
markTagsAsStaleAndPurgeEdgeCache,
purgeEdgeCache,
type RevalidateTagDurations,
type TagStaleOrExpiredStatus,
} from './tags-handler.cjs'
import { getTracer, recordWarning, withActiveSpan } from './tracer.cjs'

let memoizedPrerenderManifest: PrerenderManifest
Expand Down Expand Up @@ -296,15 +302,15 @@ export class NetlifyCacheHandler implements CacheHandlerForMultipleVersions {
context.softTags,
)

if (staleByTags) {
span?.addEvent('Stale', { staleByTags, key, ttl })
if (expiredByTags) {
span?.addEvent('Expired', { expiredByTags, key, ttl })
return null
}

this.captureResponseCacheLastModified(blob, key, span)

if (staleByTags) {
span.addEvent('Stale', { staleByTags, key, ttl })
span?.addEvent('Stale', { staleByTags, key, ttl })
// note that we modify this after we capture last modified to ensure that Age is correct
// but we still let Next.js know that entry is stale
blob.lastModified = -1 // indicate that the entry is stale
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.