Skip to content

Commit 27551e8

Browse files
test
1 parent 4ebe838 commit 27551e8

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

x-pack/metricbeat/module/iis/application_pool/_meta/fields.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,5 @@
136136
type: float
137137
description: >
138138
Current Queue Length.
139+
- name: "state"
140+
type: long

x-pack/metricbeat/module/iis/application_pool/reader.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ var appPoolCounters = map[string]string{
8080
"net_clr.locks_and_threads.contention_rate_per_sec": "\\.NET CLR LocksAndThreads(w3wp*)\\Contention Rate / sec",
8181
"net_clr.locks_and_threads.current_queue_length": "\\.NET CLR LocksAndThreads(w3wp*)\\Current Queue Length",
8282

83-
"test_state": "\\APP_POOL_WAS(*)\\Current Application Pool State",
83+
"state": "\\APP_POOL_WAS(*)\\Current Application Pool State",
8484
}
8585

8686
// newReader creates a new instance of Reader.
@@ -172,10 +172,10 @@ func (r *Reader) initAppPools() error {
172172

173173
// read executes a query and returns those values in an event.
174174
func (r *Reader) read() ([]mb.Event, error) {
175-
// if len(r.applicationPools) == 0 {
176-
// r.executed = true
177-
// return nil, nil
178-
// }
175+
if len(r.applicationPools) == 0 {
176+
r.executed = true
177+
return nil, nil
178+
}
179179

180180
// Some counters, such as rate counters, require two counter values in order to compute a displayable value. In this case we must call PdhCollectQueryData twice before calling PdhGetFormattedCounterValue.
181181
// For more information, see Collecting Performance Data (https://docs.microsoft.com/en-us/windows/desktop/PerfCtrs/collecting-performance-data).
@@ -200,7 +200,7 @@ func (r *Reader) read() ([]mb.Event, error) {
200200
}
201201

202202
func (r *Reader) mapEvents(values map[string][]pdh.CounterValue) map[string]mb.Event {
203-
// workers := getProcessIds(values)
203+
workers := getProcessIds(values)
204204
events := make(map[string]mb.Event)
205205
for _, appPool := range r.applicationPools {
206206
events[appPool.name] = mb.Event{
@@ -227,13 +227,13 @@ func (r *Reader) mapEvents(values map[string][]pdh.CounterValue) map[string]mb.E
227227
continue
228228
}
229229
}
230-
// if hasWorkerProcess(val.Instance, workers, appPool.workerProcessIds) {
231-
if r.workerProcesses[counterPath] == ecsProcessId {
232-
events[appPool.name].RootFields.Put(r.workerProcesses[counterPath], val.Measurement)
233-
} else if len(r.workerProcesses[counterPath]) != 0 {
234-
events[appPool.name].MetricSetFields.Put(r.workerProcesses[counterPath], val.Measurement)
230+
if hasWorkerProcess(val.Instance, workers, appPool.workerProcessIds) || val.Instance == appPool.name {
231+
if r.workerProcesses[counterPath] == ecsProcessId {
232+
events[appPool.name].RootFields.Put(r.workerProcesses[counterPath], val.Measurement)
233+
} else if len(r.workerProcesses[counterPath]) != 0 {
234+
events[appPool.name].MetricSetFields.Put(r.workerProcesses[counterPath], val.Measurement)
235+
}
235236
}
236-
// }
237237
}
238238
}
239239
}

0 commit comments

Comments
 (0)