@@ -23,6 +23,7 @@ import {
2323 FEATURE_FILTER_TYPE_KEY ,
2424 FF_MAX_VARIANTS_KEY ,
2525 FF_FEATURES_KEY ,
26+ NODE_VERSION_KEY ,
2627 HOST_TYPE_KEY ,
2728 HostType ,
2829 KEY_VAULT_CONFIGURED_TAG ,
@@ -126,6 +127,7 @@ function createCorrelationContextHeader(requestTracingOptions: RequestTracingOpt
126127 keyValues . set ( REQUEST_TYPE_KEY , requestTracingOptions . initialLoadCompleted ? RequestType . WATCH : RequestType . STARTUP ) ;
127128 keyValues . set ( HOST_TYPE_KEY , getHostType ( ) ) ;
128129 keyValues . set ( ENV_KEY , isDevEnvironment ( ) ? DEV_ENV_VAL : undefined ) ;
130+ keyValues . set ( NODE_VERSION_KEY , getNodeVersion ( ) ) ;
129131
130132 const appConfigOptions = requestTracingOptions . appConfigOptions ;
131133 if ( appConfigOptions ?. keyVaultOptions ) {
@@ -198,7 +200,7 @@ function createFeaturesString(requestTracingOptions: RequestTracingOptions): str
198200 return tags . join ( DELIMITER ) ;
199201}
200202
201- function getEnvironmentVariable ( name : string ) {
203+ function getEnvironmentVariable ( name : string ) : string | undefined {
202204 // Make it compatible with non-Node.js runtime
203205 if ( typeof process !== "undefined" && typeof process ?. env === "object" ) {
204206 return process . env [ name ] ;
@@ -207,6 +209,16 @@ function getEnvironmentVariable(name: string) {
207209 }
208210}
209211
212+ function getNodeVersion ( ) : string | undefined {
213+ // Make it compatible with non-Node.js runtime
214+ if ( typeof process !== "undefined" && typeof process ?. versions === "object" ) {
215+ const version = process . versions . node ;
216+ return version ? version . split ( '.' ) [ 0 ] : undefined ;
217+ } else {
218+ return undefined ;
219+ }
220+ }
221+
210222function getHostType ( ) : string | undefined {
211223 let hostType : string | undefined ;
212224 if ( getEnvironmentVariable ( AZURE_FUNCTION_ENV_VAR ) ) {
@@ -235,7 +247,7 @@ function isDevEnvironment(): boolean {
235247 return false ;
236248}
237249
238- export function isBrowser ( ) {
250+ export function isBrowser ( ) : boolean {
239251 // https://developer.mozilla.org/en-US/docs/Web/API/Window
240252 const isWindowDefinedAsExpected = typeof window === "object" && typeof Window === "function" && window instanceof Window ;
241253 // https://developer.mozilla.org/en-US/docs/Web/API/Document
@@ -244,7 +256,7 @@ export function isBrowser() {
244256 return isWindowDefinedAsExpected && isDocumentDefinedAsExpected ;
245257}
246258
247- export function isWebWorker ( ) {
259+ export function isWebWorker ( ) : boolean {
248260 // https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope
249261 const workerGlobalScopeDefined = typeof WorkerGlobalScope !== "undefined" ;
250262 // https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator
0 commit comments