@netlify/build 29.28.0 → 29.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/flags.d.ts +5 -0
- package/lib/core/flags.js +5 -0
- package/lib/core/normalize_flags.js +1 -0
- package/lib/core/types.d.ts +1 -0
- package/lib/plugins/spawn.js +2 -0
- package/lib/tracing/main.d.ts +14 -3
- package/lib/tracing/main.js +23 -1
- package/package.json +13 -5
package/lib/core/flags.d.ts
CHANGED
|
@@ -169,6 +169,11 @@ export const FLAGS: {
|
|
|
169
169
|
describe: string;
|
|
170
170
|
hidden: boolean;
|
|
171
171
|
};
|
|
172
|
+
'tracing.preloadingEnabled': {
|
|
173
|
+
boolean: boolean;
|
|
174
|
+
describe: string;
|
|
175
|
+
hidden: boolean;
|
|
176
|
+
};
|
|
172
177
|
'tracing.apiKey': {
|
|
173
178
|
string: boolean;
|
|
174
179
|
describe: string;
|
package/lib/core/flags.js
CHANGED
|
@@ -202,6 +202,11 @@ Default: false`,
|
|
|
202
202
|
describe: 'Enable distributed tracing for build',
|
|
203
203
|
hidden: true,
|
|
204
204
|
},
|
|
205
|
+
'tracing.preloadingEnabled': {
|
|
206
|
+
boolean: true,
|
|
207
|
+
describe: 'Enable distributed tracing for build via module preloading, to be removed once fully rolled out',
|
|
208
|
+
hidden: true,
|
|
209
|
+
},
|
|
205
210
|
'tracing.apiKey': {
|
|
206
211
|
string: true,
|
|
207
212
|
describe: 'API Key for the tracing backend provider',
|
|
@@ -58,6 +58,7 @@ const getDefaultFlags = function ({ env: envOpt = {} }, combinedEnv) {
|
|
|
58
58
|
// honeycomb directly - https://github.com/honeycombio/honeycomb-opentelemetry-node/issues/201
|
|
59
59
|
tracing: {
|
|
60
60
|
enabled: false,
|
|
61
|
+
preloadingEnabled: false,
|
|
61
62
|
apiKey: '-',
|
|
62
63
|
// defaults to always sample
|
|
63
64
|
sampleRate: 1,
|
package/lib/core/types.d.ts
CHANGED
package/lib/plugins/spawn.js
CHANGED
|
@@ -31,6 +31,8 @@ const startPlugin = async function ({ pluginDir, nodePath, buildDir, childEnv, s
|
|
|
31
31
|
preferLocal: true,
|
|
32
32
|
localDir: pluginDir,
|
|
33
33
|
nodePath,
|
|
34
|
+
// make sure we don't pass build's node cli properties for now (e.g. --import)
|
|
35
|
+
nodeOptions: [],
|
|
34
36
|
execPath: nodePath,
|
|
35
37
|
env: childEnv,
|
|
36
38
|
extendEnv: false,
|
package/lib/tracing/main.d.ts
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
|
+
import { Context } from '@opentelemetry/api';
|
|
1
2
|
import type { TracingOptions } from '../core/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the global context to be used when initialising our root span
|
|
5
|
+
* TODO this will move to a shared package (opentelemetry-utils) to scope the usage of this global property there
|
|
6
|
+
*/
|
|
7
|
+
export declare const getGlobalContext: () => Context;
|
|
8
|
+
/**
|
|
9
|
+
* Sets global context to be used when initialising our root span
|
|
10
|
+
* TODO this will move to a shared package (opentelemetry-utils) to scope the usage of this global property there
|
|
11
|
+
*/
|
|
12
|
+
export declare const setGlobalContext: (ctx: Context) => void;
|
|
2
13
|
/** Starts the tracing SDK, if there's already a tracing service this will be a no-op */
|
|
3
|
-
export declare const startTracing: (options: TracingOptions, logger: (...args: any[]) => void) =>
|
|
14
|
+
export declare const startTracing: (options: TracingOptions, logger: (...args: any[]) => void) => Context | undefined;
|
|
4
15
|
/** Stops the tracing service if there's one running. This will flush any ongoing events */
|
|
5
16
|
export declare const stopTracing: () => Promise<void>;
|
|
6
17
|
/** Sets attributes to be propagated across child spans under the current active context */
|
|
7
18
|
export declare const setMultiSpanAttributes: (attributes: {
|
|
8
19
|
[key: string]: string;
|
|
9
|
-
}) =>
|
|
20
|
+
}) => Context;
|
|
10
21
|
/** Add error information to the current active span (if any) */
|
|
11
22
|
export declare const addErrorToActiveSpan: (error: Error) => void;
|
|
12
23
|
export declare const addEventToActiveSpan: (eventName: string, attributes?: {
|
|
13
24
|
[key: string]: string;
|
|
14
25
|
} | undefined) => void;
|
|
15
|
-
export declare const loadBaggageFromFile: (baggageFilePath: string) =>
|
|
26
|
+
export declare const loadBaggageFromFile: (baggageFilePath: string) => Context;
|
|
16
27
|
/** Attributes used for the root span of our execution */
|
|
17
28
|
export type RootExecutionAttributes = {
|
|
18
29
|
'build.id': string;
|
package/lib/tracing/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { HoneycombSDK } from '@honeycombio/opentelemetry-node';
|
|
3
|
-
import { context, trace, propagation, SpanStatusCode, diag, DiagLogLevel } from '@opentelemetry/api';
|
|
3
|
+
import { context, trace, propagation, SpanStatusCode, diag, DiagLogLevel, } from '@opentelemetry/api';
|
|
4
4
|
import { parseKeyPairsIntoRecord } from '@opentelemetry/core/build/src/baggage/utils.js';
|
|
5
5
|
import { isBuildError } from '../error/info.js';
|
|
6
6
|
import { parseErrorInfo } from '../error/parse/parse.js';
|
|
@@ -22,8 +22,30 @@ const getOtelLogger = function (logger) {
|
|
|
22
22
|
warn: otelLogger,
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Gets the global context to be used when initialising our root span
|
|
27
|
+
* TODO this will move to a shared package (opentelemetry-utils) to scope the usage of this global property there
|
|
28
|
+
*/
|
|
29
|
+
export const getGlobalContext = function () {
|
|
30
|
+
if (global['NETLIFY_GLOBAL_CONTEXT'] === undefined) {
|
|
31
|
+
return context.active();
|
|
32
|
+
}
|
|
33
|
+
return global['NETLIFY_GLOBAL_CONTEXT'];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Sets global context to be used when initialising our root span
|
|
37
|
+
* TODO this will move to a shared package (opentelemetry-utils) to scope the usage of this global property there
|
|
38
|
+
*/
|
|
39
|
+
export const setGlobalContext = function (ctx) {
|
|
40
|
+
global['NETLIFY_GLOBAL_CONTEXT'] = ctx;
|
|
41
|
+
};
|
|
25
42
|
/** Starts the tracing SDK, if there's already a tracing service this will be a no-op */
|
|
26
43
|
export const startTracing = function (options, logger) {
|
|
44
|
+
// As we roll out the new way to initialise the SDK, if we detect preloading is enabled,
|
|
45
|
+
// it means we're using `@netlify/opentelemetry-sdk-setup` so we must get the initial context from the global store
|
|
46
|
+
if (options.preloadingEnabled) {
|
|
47
|
+
return getGlobalContext();
|
|
48
|
+
}
|
|
27
49
|
if (!options.enabled)
|
|
28
50
|
return;
|
|
29
51
|
if (sdk)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "29.28.
|
|
3
|
+
"version": "29.28.1",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
"@netlify/config": "^20.10.0",
|
|
71
71
|
"@netlify/edge-bundler": "10.1.3",
|
|
72
72
|
"@netlify/framework-info": "^9.8.10",
|
|
73
|
-
"@netlify/functions-utils": "^5.2.
|
|
73
|
+
"@netlify/functions-utils": "^5.2.42",
|
|
74
74
|
"@netlify/git-utils": "^5.1.1",
|
|
75
75
|
"@netlify/plugins-list": "^6.72.0",
|
|
76
76
|
"@netlify/run-utils": "^5.1.1",
|
|
77
|
-
"@netlify/zip-it-and-ship-it": "9.26.
|
|
77
|
+
"@netlify/zip-it-and-ship-it": "9.26.4",
|
|
78
78
|
"@opentelemetry/api": "^1.4.1",
|
|
79
79
|
"@opentelemetry/core": "^1.17.1",
|
|
80
80
|
"@sindresorhus/slugify": "^2.0.0",
|
|
@@ -140,11 +140,19 @@
|
|
|
140
140
|
"process-exists": "^5.0.0",
|
|
141
141
|
"sinon": "^13.0.0",
|
|
142
142
|
"tmp-promise": "^3.0.2",
|
|
143
|
-
"tsd": "^0.
|
|
143
|
+
"tsd": "^0.29.0",
|
|
144
144
|
"yarn": "^1.22.4"
|
|
145
145
|
},
|
|
146
|
+
"peerDependencies": {
|
|
147
|
+
"@netlify/opentelemetry-sdk-setup": "^1.0.1"
|
|
148
|
+
},
|
|
149
|
+
"peerDependenciesMeta": {
|
|
150
|
+
"@netlify/opentelemetry-sdk-setup": {
|
|
151
|
+
"optional": true
|
|
152
|
+
}
|
|
153
|
+
},
|
|
146
154
|
"engines": {
|
|
147
155
|
"node": "^14.16.0 || >=16.0.0"
|
|
148
156
|
},
|
|
149
|
-
"gitHead": "
|
|
157
|
+
"gitHead": "5aef135bf29606313b5e2547c4c7d77c8ff64d56"
|
|
150
158
|
}
|