Skip to content

Commit

Permalink
[receiver/iis] fixed issue open-telemetry#34924 - monitor application…
Browse files Browse the repository at this point in the history
… pool uptime (open-telemetry#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
open-telemetry#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.-->
  • Loading branch information
syron authored Feb 27, 2025
1 parent a9f5ff9 commit 7ec4927
Show file tree
Hide file tree
Showing 9 changed files with 241 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .chloggen/iisreceiver-add-application_pool-metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: iisreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Added state and uptime metrics for application pools

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [34924]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
26 changes: 26 additions & 0 deletions receiver/iisreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,32 @@ The amount of time the server has been up.
| ---- | ----------- | ---------- |
| s | Gauge | Int |
## Optional Metrics
The following metrics are not emitted by default. Each of them can be enabled by applying the following configuration:
```yaml
metrics:
<metric_name>:
enabled: true
```
### iis.application_pool.state
The current state of the application pool. (0 - Starting, 1 - Started, 2 - Stopping, 3 - Stopped, 4 - Unknown)
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {state} | Gauge | Int |
### iis.application_pool.uptime
The application pools uptime period since the last restart.
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {ms} | Gauge | Int |
## Resource Attributes
| Name | Description | Values | Enabled |
Expand Down
8 changes: 8 additions & 0 deletions receiver/iisreceiver/internal/metadata/generated_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 114 additions & 0 deletions receiver/iisreceiver/internal/metadata/generated_metrics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions receiver/iisreceiver/internal/metadata/generated_metrics_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions receiver/iisreceiver/internal/metadata/testdata/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
default:
all_set:
metrics:
iis.application_pool.state:
enabled: true
iis.application_pool.uptime:
enabled: true
iis.connection.active:
enabled: true
iis.connection.anonymous:
Expand Down Expand Up @@ -32,6 +36,10 @@ all_set:
enabled: true
none_set:
metrics:
iis.application_pool.state:
enabled: false
iis.application_pool.uptime:
enabled: false
iis.connection.active:
enabled: false
iis.connection.anonymous:
Expand Down
12 changes: 12 additions & 0 deletions receiver/iisreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,15 @@ metrics:
gauge:
value_type: int
enabled: true
iis.application_pool.state:
description: The current state of the application pool. (0 - Starting, 1 - Started, 2 - Stopping, 3 - Stopped, 4 - Unknown)
unit: "{state}"
gauge:
value_type: int
enabled: false
iis.application_pool.uptime:
description: The application pools uptime period since the last restart.
unit: "{ms}"
gauge:
value_type: int
enabled: false
12 changes: 12 additions & 0 deletions receiver/iisreceiver/recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ var appPoolPerfCounterRecorders = []perfCounterRecorderConf{
},
},
},
{
object: "APP_POOL_WAS",
instance: "*",
recorders: map[string]recordFunc{
"Current Application Pool State": func(mb *metadata.MetricsBuilder, ts pcommon.Timestamp, val float64) {
mb.RecordIisApplicationPoolStateDataPoint(ts, int64(val))
},
"Current Application Pool Uptime": func(mb *metadata.MetricsBuilder, ts pcommon.Timestamp, val float64) {
mb.RecordIisApplicationPoolUptimeDataPoint(ts, int64(val))
},
},
},
}

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

0 comments on commit 7ec4927

Please sign in to comment.