Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[receiver/iis] Add IIS Metrics Receiver #8832

Merged
merged 45 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
495b8b6
Add common API for windows performance counters
Apr 6, 2022
1c5c773
Update tests for windowsperfreceiver
Mrod1598 Apr 6, 2022
bd40817
Add test to new package
Apr 7, 2022
0abb2f4
Update tests
Mrod1598 Apr 7, 2022
ccb4123
Add comments
Mrod1598 Apr 7, 2022
0e25aba
Run gotidy and gofmt
Apr 7, 2022
b986f83
Rebert go.mod changes in other packages
Apr 7, 2022
fd35006
Restucture
Apr 7, 2022
d47612f
Rework structs
Apr 8, 2022
045e285
Merge branch 'main' into windows-common-package
Apr 8, 2022
0ce03b7
Update generic receiver to use MetricRep
Apr 8, 2022
c6ba5f0
Fic minor naming
Apr 8, 2022
1d6e8a4
Rename expected vars
Apr 8, 2022
a9f7093
Check for counterValue
Apr 8, 2022
42f4f6c
Unwrap functions
Apr 11, 2022
cb69569
Merge branch 'main' into windows-common-package
Apr 11, 2022
4e444bb
Condense start method
Apr 11, 2022
00085b5
Use common Package
Apr 11, 2022
51f592c
Update changelog
Apr 11, 2022
eabc234
Fix typo
Apr 11, 2022
1c0ba5e
Fix versions.yaml
Apr 11, 2022
995121b
Merge branch 'main' into windows-common-package
Apr 11, 2022
6715701
Merge branch 'main' into windows-common-package
djaglowski Apr 11, 2022
0f5b907
Merge branch 'main' into windows-common-package
Apr 11, 2022
03fee41
Merge branch 'windows-common-package' into iis-receiver
Apr 12, 2022
608b865
Merge branch 'main' into iis-receiver
Apr 12, 2022
7fffd0c
Add scrape func to receiver
Apr 12, 2022
f5895d6
Add integration test
Mrod1598 Apr 12, 2022
0d96f86
Add to components
Apr 12, 2022
4a63fb9
Update attributes to use metadata
Apr 12, 2022
0af8cc9
Rename Metricsettings
Apr 12, 2022
28535d6
Fix lint
Apr 12, 2022
a1cdb69
Add more tests
Mrod1598 Apr 12, 2022
1b1340f
Merge branch 'iis-receiver' of https://github.com/observIQ/openteleme…
Apr 12, 2022
dd5e2c8
Clean up checks
Apr 12, 2022
679f465
Merge branch 'main' into iis-receiver
Apr 13, 2022
9182306
Add changelog
Apr 13, 2022
5417c27
Update to record multiple datapoints
Apr 13, 2022
4df25cf
Fix typo in readme
Apr 13, 2022
c2191cb
PR feedback
Apr 13, 2022
5fd6726
Move metricBuilder & Update link
Apr 14, 2022
6524a13
Add codeowners
Apr 14, 2022
b0ee861
Merge branch 'main' into iis-receiver
Apr 14, 2022
73bcce5
Update go mod
Apr 14, 2022
136fd27
Make generate
Apr 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ receiver/googlecloudpubsubreceiver/ @open-telemetry/collector-c
receiver/googlecloudspannerreceiver/ @open-telemetry/collector-contrib-approvers @ydrozhdzhal @asukhyy @khospodarysko @architjugran
receiver/hostmetricsreceiver @open-telemetry/collector-contrib-approvers @dmitryax
receiver/influxdbreceiver/ @open-telemetry/collector-contrib-approvers @jacobmarble
receiver/iisreceiver/ @open-telemetry/collector-contrib-approvers @mrod1598 @djaglowski
receiver/jaegerreceiver/ @open-telemetry/collector-contrib-approvers @jpkrohling
receiver/jmxreceiver/ @open-telemetry/collector-contrib-approvers @rmfitzpatrick
receiver/journaldreceiver/ @open-telemetry/collector-contrib-approvers @pmm-sumo
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-and-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: install iis
run: Install-WindowsFeature -name Web-Server -IncludeManagementTools
- name: Setup Go
uses: actions/setup-go@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
### 🚩 Deprecations 🚩

### 🚀 New components 🚀

- `iisreceiver`: Add implementation of IIS Metric Receiver (#8832)
### 💡 Enhancements 💡

### 🧰 Bug fixes 🧰
Expand Down
3 changes: 3 additions & 0 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/fluentforwardreceiver v0.49.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudspannerreceiver v0.49.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.49.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/iisreceiver v0.0.0-00010101000000-000000000000 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/influxdbreceiver v0.49.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.49.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jmxreceiver v0.49.0 // indirect
Expand Down Expand Up @@ -727,6 +728,8 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostm

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/influxdbreceiver => ../../receiver/influxdbreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/iisreceiver => ../../receiver/iisreceiver
djaglowski marked this conversation as resolved.
Show resolved Hide resolved

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver => ../../receiver/jaegerreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jmxreceiver => ../../receiver/jmxreceiver
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/fluentforwardreceiver v0.49.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudspannerreceiver v0.49.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.49.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/iisreceiver v0.0.0-00010101000000-000000000000
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/influxdbreceiver v0.49.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.49.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jmxreceiver v0.49.0
Expand Down Expand Up @@ -731,6 +732,8 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostm

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/influxdbreceiver => ./receiver/influxdbreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/iisreceiver => ./receiver/iisreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver => ./receiver/jaegerreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jmxreceiver => ./receiver/jmxreceiver
Expand Down
2 changes: 2 additions & 0 deletions internal/components/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/fluentforwardreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudspannerreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/iisreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/influxdbreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jmxreceiver"
Expand Down Expand Up @@ -189,6 +190,7 @@ func Components() (component.Factories, error) {
googlecloudspannerreceiver.NewFactory(),
hostmetricsreceiver.NewFactory(),
influxdbreceiver.NewFactory(),
iisreceiver.NewFactory(),
jaegerreceiver.NewFactory(),
jmxreceiver.NewFactory(),
journaldreceiver.NewFactory(),
Expand Down
4 changes: 4 additions & 0 deletions internal/components/receivers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ func TestDefaultReceivers(t *testing.T) {
{
receiver: "influxdb",
},
{
receiver: "iis",
skipLifecyle: true, // Requires a running windows process
},
{
receiver: "jaeger",
},
Expand Down
1 change: 1 addition & 0 deletions receiver/iisreceiver/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.Common
26 changes: 26 additions & 0 deletions receiver/iisreceiver/README.md
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)
27 changes: 27 additions & 0 deletions receiver/iisreceiver/config.go
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"`
}
210 changes: 210 additions & 0 deletions receiver/iisreceiver/config_generator.go
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",
},
},
},
}
}
17 changes: 17 additions & 0 deletions receiver/iisreceiver/doc.go
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"
Loading