File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -302,9 +302,9 @@ class Statsbeat {
302302 ) ;
303303 if ( currentCounter . totalSuccesfulRequestCount > 0 ) {
304304 this . _statbeatMetrics . push ( {
305- name : Constants . StatsbeatCounter . REQUEST_SUCCESS ,
306- value : currentCounter . totalSuccesfulRequestCount ,
307- properties : properties
305+ name : Constants . StatsbeatCounter . REQUEST_SUCCESS ,
306+ value : currentCounter . totalSuccesfulRequestCount ,
307+ properties : properties
308308 } ) ;
309309 currentCounter . totalSuccesfulRequestCount = 0 ; //Reset
310310 }
@@ -385,7 +385,11 @@ class Statsbeat {
385385 let waiting : boolean = false ;
386386 this . _resourceProvider = Constants . StatsbeatResourceProvider . unknown ;
387387 this . _resourceIdentifier = Constants . StatsbeatResourceProvider . unknown ;
388- if ( process . env . WEBSITE_SITE_NAME ) { // Web apps
388+ if ( process . env . AKS_ARM_NAMESPACE_ID ) { //AKS
389+ this . _resourceProvider = Constants . StatsbeatResourceProvider . aks ;
390+ this . _resourceIdentifier = process . env . AKS_ARM_NAMESPACE_ID ;
391+ }
392+ else if ( process . env . WEBSITE_SITE_NAME ) { // Web apps
389393 this . _resourceProvider = Constants . StatsbeatResourceProvider . appsvc ;
390394 this . _resourceIdentifier = process . env . WEBSITE_SITE_NAME ;
391395 if ( process . env . WEBSITE_HOME_STAMPNAME ) {
Original file line number Diff line number Diff line change @@ -135,6 +135,7 @@ export const StatsbeatTelemetryName = "Statsbeat";
135135
136136export const StatsbeatResourceProvider = {
137137 appsvc : "appsvc" ,
138+ aks : "aks" ,
138139 functions : "functions" ,
139140 vm : "vm" ,
140141 unknown : "unknown"
Original file line number Diff line number Diff line change @@ -120,6 +120,19 @@ describe("AutoCollection/Statsbeat", () => {
120120 done ( ) ;
121121 } ) . catch ( ( error ) => { done ( error ) ; } ) ;
122122 } ) ;
123+
124+ it ( "aks" , ( done ) => {
125+ var newEnv = < { [ id : string ] : string } > { } ;
126+ newEnv [ "AKS_ARM_NAMESPACE_ID" ] = "Test AKS cluster and namespace" ;
127+ var originalEnv = process . env ;
128+ process . env = newEnv ;
129+ statsBeat [ "_getResourceProvider" ] ( ) . then ( ( ) => {
130+ process . env = originalEnv ;
131+ assert . equal ( statsBeat [ "_resourceProvider" ] , "aks" ) ;
132+ assert . equal ( statsBeat [ "_resourceIdentifier" ] , "Test AKS cluster and namespace" ) ;
133+ done ( ) ;
134+ } ) . catch ( ( error ) => { done ( error ) ; } ) ;
135+ } ) ;
123136 } ) ;
124137
125138 describe ( "#trackStatbeats" , ( ) => {
You can’t perform that action at this time.
0 commit comments