@@ -2,7 +2,7 @@ import { StatsD } from "hot-shots";
2
2
import { promisify } from "util" ;
3
3
import { logDebug , logError } from "../utils" ;
4
4
import { APIClient } from "./api" ;
5
- import { flushExtension , isAgentRunning } from "./extension" ;
5
+ import { flushExtension , isExtensionRunning } from "./extension" ;
6
6
import { KMSService } from "./kms-service" ;
7
7
import { writeMetricToStdout } from "./metric-log" ;
8
8
import { Distribution } from "./model" ;
@@ -59,20 +59,20 @@ export class MetricsListener {
59
59
private currentProcessor ?: Promise < Processor > ;
60
60
private apiKey : Promise < string > ;
61
61
private statsDClient ?: StatsD ;
62
- private isAgentRunning ?: boolean = undefined ;
62
+ private isExtensionRunning ?: boolean = undefined ;
63
63
64
64
constructor ( private kmsClient : KMSService , private config : MetricsConfig ) {
65
65
this . apiKey = this . getAPIKey ( config ) ;
66
66
this . config = config ;
67
67
}
68
68
69
69
public async onStartInvocation ( _ : any ) {
70
- if ( this . isAgentRunning === undefined ) {
71
- this . isAgentRunning = await isAgentRunning ( ) ;
72
- logDebug ( `Extension present: ${ this . isAgentRunning } ` ) ;
70
+ if ( this . isExtensionRunning === undefined ) {
71
+ this . isExtensionRunning = await isExtensionRunning ( ) ;
72
+ logDebug ( `Extension present: ${ this . isExtensionRunning } ` ) ;
73
73
}
74
74
75
- if ( this . isAgentRunning ) {
75
+ if ( this . isExtensionRunning ) {
76
76
logDebug ( `Using StatsD client` ) ;
77
77
78
78
this . statsDClient = new StatsD ( { host : "127.0.0.1" , closingFlushInterval : 1 } ) ;
@@ -121,7 +121,7 @@ export class MetricsListener {
121
121
}
122
122
}
123
123
try {
124
- if ( this . isAgentRunning && this . config . localTesting ) {
124
+ if ( this . isExtensionRunning && this . config . localTesting ) {
125
125
logDebug ( `Flushing Extension for local test` ) ;
126
126
await flushExtension ( ) ;
127
127
}
@@ -140,7 +140,7 @@ export class MetricsListener {
140
140
forceAsync : boolean ,
141
141
...tags : string [ ]
142
142
) {
143
- if ( this . isAgentRunning ) {
143
+ if ( this . isExtensionRunning ) {
144
144
this . statsDClient ?. distribution ( name , value , undefined , tags ) ;
145
145
return ;
146
146
}
0 commit comments