Skip to content

Commit 7ec4927

Browse files
authored
[receiver/iis] fixed issue #34924 - monitor application pool uptime (#38183)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Added new metrics * application pool state: Each application pool's state * application pool uptime: The number of milliseconds an application pool has been up. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue #34924 <!--Describe what testing was performed and which tests were added.--> #### Testing Has been tested on a local windows machine. <!--Describe the documentation added.--> #### Documentation Metadata documention has been updated by mdatagen. <!--Please delete paragraphs that you did not use before submitting.-->
1 parent a9f5ff9 commit 7ec4927

File tree

9 files changed

+241
-0
lines changed

9 files changed

+241
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: iisreceiver
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Added state and uptime metrics for application pools
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [34924]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [user]

receiver/iisreceiver/documentation.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,32 @@ The amount of time the server has been up.
126126
| ---- | ----------- | ---------- |
127127
| s | Gauge | Int |
128128
129+
## Optional Metrics
130+
131+
The following metrics are not emitted by default. Each of them can be enabled by applying the following configuration:
132+
133+
```yaml
134+
metrics:
135+
<metric_name>:
136+
enabled: true
137+
```
138+
139+
### iis.application_pool.state
140+
141+
The current state of the application pool. (0 - Starting, 1 - Started, 2 - Stopping, 3 - Stopped, 4 - Unknown)
142+
143+
| Unit | Metric Type | Value Type |
144+
| ---- | ----------- | ---------- |
145+
| {state} | Gauge | Int |
146+
147+
### iis.application_pool.uptime
148+
149+
The application pools uptime period since the last restart.
150+
151+
| Unit | Metric Type | Value Type |
152+
| ---- | ----------- | ---------- |
153+
| {ms} | Gauge | Int |
154+
129155
## Resource Attributes
130156
131157
| Name | Description | Values | Enabled |

receiver/iisreceiver/internal/metadata/generated_config.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/iisreceiver/internal/metadata/generated_config_test.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/iisreceiver/internal/metadata/generated_metrics.go

Lines changed: 114 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/iisreceiver/internal/metadata/generated_metrics_test.go

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/iisreceiver/internal/metadata/testdata/config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
default:
22
all_set:
33
metrics:
4+
iis.application_pool.state:
5+
enabled: true
6+
iis.application_pool.uptime:
7+
enabled: true
48
iis.connection.active:
59
enabled: true
610
iis.connection.anonymous:
@@ -32,6 +36,10 @@ all_set:
3236
enabled: true
3337
none_set:
3438
metrics:
39+
iis.application_pool.state:
40+
enabled: false
41+
iis.application_pool.uptime:
42+
enabled: false
3543
iis.connection.active:
3644
enabled: false
3745
iis.connection.anonymous:

receiver/iisreceiver/metadata.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,15 @@ metrics:
135135
gauge:
136136
value_type: int
137137
enabled: true
138+
iis.application_pool.state:
139+
description: The current state of the application pool. (0 - Starting, 1 - Started, 2 - Stopping, 3 - Stopped, 4 - Unknown)
140+
unit: "{state}"
141+
gauge:
142+
value_type: int
143+
enabled: false
144+
iis.application_pool.uptime:
145+
description: The application pools uptime period since the last restart.
146+
unit: "{ms}"
147+
gauge:
148+
value_type: int
149+
enabled: false

receiver/iisreceiver/recorder.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,18 @@ var appPoolPerfCounterRecorders = []perfCounterRecorderConf{
103103
},
104104
},
105105
},
106+
{
107+
object: "APP_POOL_WAS",
108+
instance: "*",
109+
recorders: map[string]recordFunc{
110+
"Current Application Pool State": func(mb *metadata.MetricsBuilder, ts pcommon.Timestamp, val float64) {
111+
mb.RecordIisApplicationPoolStateDataPoint(ts, int64(val))
112+
},
113+
"Current Application Pool Uptime": func(mb *metadata.MetricsBuilder, ts pcommon.Timestamp, val float64) {
114+
mb.RecordIisApplicationPoolUptimeDataPoint(ts, int64(val))
115+
},
116+
},
117+
},
106118
}
107119

108120
func recordMaxQueueItemAge(mb *metadata.MetricsBuilder, ts pcommon.Timestamp, val float64) {

0 commit comments

Comments
 (0)