-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[receiver/iis] Add IIS Metrics Receiver (#8832)
* Add IIS metric receiver based on windows performance counters
- Loading branch information
Miguel Rodriguez
authored
Apr 14, 2022
1 parent
faf74e4
commit 95f0da0
Showing
30 changed files
with
2,738 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../../Makefile.Common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Microsoft IIS Receiver | ||
|
||
The `iis` receiver grabs metrics about an IIS instance using the Windows Performance Counters. | ||
Because of this, it is a Windows only receiver. | ||
|
||
Supported pipeline types: `metrics` | ||
|
||
## Configuration | ||
|
||
The following settings are optional: | ||
|
||
- `collection_interval` (default = `10s`): The interval at which metrics should be emitted by this receiver. | ||
|
||
Example: | ||
|
||
```yaml | ||
receivers: | ||
iis: | ||
collection_interval: 10s | ||
``` | ||
The full list of settings exposed for this receiver are documented [here](./config.go). | ||
## Metrics | ||
Details about the metrics produced by this receiver can be found in [documentation.md](./documentation.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package iisreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/iisreceiver" | ||
|
||
import ( | ||
"go.opentelemetry.io/collector/receiver/scraperhelper" | ||
|
||
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/iisreceiver/internal/metadata" | ||
) | ||
|
||
// Config defines configuration for simple prometheus receiver. | ||
type Config struct { | ||
scraperhelper.ScraperControllerSettings `mapstructure:",squash"` | ||
Metrics metadata.MetricsSettings `mapstructure:"metrics"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//go:build windows | ||
// +build windows | ||
|
||
package iisreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/iisreceiver" | ||
|
||
import ( | ||
windowsapi "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/winperfcounters" | ||
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/iisreceiver/internal/metadata" | ||
) | ||
|
||
// getPerfCounters returns established PerfCounters for each metric. | ||
func getScraperCfgs() []windowsapi.ObjectConfig { | ||
return []windowsapi.ObjectConfig{ | ||
{ | ||
Object: "Web Service", | ||
Instances: []string{"_Total"}, | ||
Counters: []windowsapi.CounterConfig{ | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.connection.active", | ||
}, | ||
Name: "Current Connections", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.network.io", | ||
Attributes: map[string]string{ | ||
"direction": "received", | ||
}, | ||
}, | ||
Name: "Total Bytes Received", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.network.io", | ||
Attributes: map[string]string{ | ||
"direction": "sent", | ||
}, | ||
}, | ||
Name: "Total Bytes Sent", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.connection.attempt.count", | ||
}, | ||
Name: "Total Connection Attempts (all instances)", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.request.count", | ||
Attributes: map[string]string{ | ||
metadata.A.Request: "delete", | ||
}, | ||
}, | ||
Name: "Total Delete Requests", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.request.count", | ||
Attributes: map[string]string{ | ||
metadata.A.Request: "get", | ||
}, | ||
}, | ||
|
||
Name: "Total Get Requests", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.request.count", | ||
Attributes: map[string]string{ | ||
metadata.A.Request: "head", | ||
}, | ||
}, | ||
|
||
Name: "Total Head Requests", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.request.count", | ||
Attributes: map[string]string{ | ||
metadata.A.Request: "options", | ||
}, | ||
}, | ||
|
||
Name: "Total Options Requests", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.request.count", | ||
Attributes: map[string]string{ | ||
metadata.A.Request: "post", | ||
}, | ||
}, | ||
|
||
Name: "Total Post Requests", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.request.count", | ||
Attributes: map[string]string{ | ||
metadata.A.Request: "put", | ||
}, | ||
}, | ||
|
||
Name: "Total Put Requests", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.request.count", | ||
Attributes: map[string]string{ | ||
metadata.A.Request: "trace", | ||
}, | ||
}, | ||
|
||
Name: "Total Trace Requests", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.network.file.count", | ||
Attributes: map[string]string{ | ||
metadata.A.Direction: "received", | ||
}, | ||
}, | ||
Name: "Total Files Received", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.network.file.count", | ||
Attributes: map[string]string{ | ||
metadata.A.Direction: "sent", | ||
}, | ||
}, | ||
Name: "Total Files Sent", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.connection.anonymous", | ||
}, | ||
|
||
Name: "Total Anonymous Users", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.network.blocked", | ||
}, | ||
|
||
Name: "Total blocked bandwidth bytes", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.uptime", | ||
}, | ||
|
||
Name: "Service Uptime", | ||
}, | ||
}, | ||
}, | ||
{ | ||
Object: "HTTP Service Request Queues", | ||
Counters: []windowsapi.CounterConfig{ | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.request.rejected", | ||
}, | ||
|
||
Name: "RejectedRequests", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.request.queue.count", | ||
}, | ||
|
||
Name: "CurrentQueueSize", | ||
}, | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.request.queue.age.max", | ||
}, | ||
Name: "MaxQueueItemAge", | ||
}, | ||
}, | ||
}, | ||
{ | ||
Object: "Process", | ||
Instances: []string{"_Total"}, | ||
Counters: []windowsapi.CounterConfig{ | ||
{ | ||
MetricRep: windowsapi.MetricRep{ | ||
Name: "iis.thread.active", | ||
}, | ||
Name: "Thread Count", | ||
}, | ||
}, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//go:generate mdatagen --experimental-gen metadata.yaml | ||
|
||
package iisreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/iisreceiver" |
Oops, something went wrong.