From ed3b65a332288d36c2f2521e7ca0a3ae3d35ca0a Mon Sep 17 00:00:00 2001 From: Brandon Johnson Date: Wed, 28 Sep 2022 17:54:34 +0000 Subject: [PATCH] [receiver/iis] Emit metrics per-site and per-application-pool (#14545) Emit metrics per-site and per-application-pool --- receiver/iisreceiver/documentation.md | 7 + .../internal/metadata/generated_metrics.go | 14 ++ receiver/iisreceiver/metadata.yaml | 8 + receiver/iisreceiver/recorder.go | 30 ++- receiver/iisreceiver/scraper.go | 116 +++++++-- receiver/iisreceiver/scraper_test.go | 4 +- .../testdata/integration/expected.json | 223 +++++++++++++----- .../testdata/scraper/expected.json | 168 ++++++++----- unreleased/iis-per-site-metrics.yaml | 11 + 9 files changed, 423 insertions(+), 158 deletions(-) create mode 100755 unreleased/iis-per-site-metrics.yaml diff --git a/receiver/iisreceiver/documentation.md b/receiver/iisreceiver/documentation.md index c73842d54053..8aa5bd88f933 100644 --- a/receiver/iisreceiver/documentation.md +++ b/receiver/iisreceiver/documentation.md @@ -30,6 +30,13 @@ metrics: enabled: ``` +## Resource attributes + +| Name | Description | Type | +| ---- | ----------- | ---- | +| iis.application_pool | The application pool, which is associated with worker processes of one or more applications. | String | +| iis.site | The site of the web server. | String | + ## Metric attributes | Name | Description | Values | diff --git a/receiver/iisreceiver/internal/metadata/generated_metrics.go b/receiver/iisreceiver/internal/metadata/generated_metrics.go index 5cfcae916add..97d31c4f33a1 100644 --- a/receiver/iisreceiver/internal/metadata/generated_metrics.go +++ b/receiver/iisreceiver/internal/metadata/generated_metrics.go @@ -827,6 +827,20 @@ func (mb *MetricsBuilder) updateCapacity(rm pmetric.ResourceMetrics) { // ResourceMetricsOption applies changes to provided resource metrics. type ResourceMetricsOption func(pmetric.ResourceMetrics) +// WithIisApplicationPool sets provided value as "iis.application_pool" attribute for current resource. +func WithIisApplicationPool(val string) ResourceMetricsOption { + return func(rm pmetric.ResourceMetrics) { + rm.Resource().Attributes().PutString("iis.application_pool", val) + } +} + +// WithIisSite sets provided value as "iis.site" attribute for current resource. +func WithIisSite(val string) ResourceMetricsOption { + return func(rm pmetric.ResourceMetrics) { + rm.Resource().Attributes().PutString("iis.site", val) + } +} + // WithStartTimeOverride overrides start time for all the resource metrics data points. // This option should be only used if different start time has to be set on metrics coming from different resources. func WithStartTimeOverride(start pcommon.Timestamp) ResourceMetricsOption { diff --git a/receiver/iisreceiver/metadata.yaml b/receiver/iisreceiver/metadata.yaml index a73af88cd7d1..f219756676b1 100644 --- a/receiver/iisreceiver/metadata.yaml +++ b/receiver/iisreceiver/metadata.yaml @@ -1,5 +1,13 @@ name: iisreceiver +resource_attributes: + iis.site: + description: The site of the web server. + type: string + iis.application_pool: + description: The application pool, which is associated with worker processes of one or more applications. + type: string + attributes: direction: value: direction diff --git a/receiver/iisreceiver/recorder.go b/receiver/iisreceiver/recorder.go index 5ab56e32db9b..5d4feb4690a1 100644 --- a/receiver/iisreceiver/recorder.go +++ b/receiver/iisreceiver/recorder.go @@ -23,7 +23,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/iisreceiver/internal/metadata" ) -type recordFunc = func(*metadata.MetricsBuilder, pcommon.Timestamp, float64) +type recordFunc = func(md *metadata.MetricsBuilder, ts pcommon.Timestamp, val float64) type perfCounterRecorderConf struct { object string @@ -31,10 +31,22 @@ type perfCounterRecorderConf struct { recorders map[string]recordFunc } -var perfCounterRecorders = []perfCounterRecorderConf{ +var totalPerfCounterRecorders = []perfCounterRecorderConf{ { - object: "Web Service", + object: "Process", instance: "_Total", + recorders: map[string]recordFunc{ + "Thread Count": func(mb *metadata.MetricsBuilder, ts pcommon.Timestamp, val float64) { + mb.RecordIisThreadActiveDataPoint(ts, int64(val)) + }, + }, + }, +} + +var sitePerfCounterRecorders = []perfCounterRecorderConf{ + { + object: "Web Service", + instance: "*", recorders: map[string]recordFunc{ "Current Connections": func(mb *metadata.MetricsBuilder, ts pcommon.Timestamp, val float64) { mb.RecordIisConnectionActiveDataPoint(ts, int64(val)) @@ -87,6 +99,9 @@ var perfCounterRecorders = []perfCounterRecorderConf{ }, }, }, +} + +var appPoolPerfCounterRecorders = []perfCounterRecorderConf{ { object: "HTTP Service Request Queues", instance: "*", @@ -102,13 +117,4 @@ var perfCounterRecorders = []perfCounterRecorderConf{ }, }, }, - { - object: "Process", - instance: "_Total", - recorders: map[string]recordFunc{ - "Thread Count": func(mb *metadata.MetricsBuilder, ts pcommon.Timestamp, val float64) { - mb.RecordIisThreadActiveDataPoint(ts, int64(val)) - }, - }, - }, } diff --git a/receiver/iisreceiver/scraper.go b/receiver/iisreceiver/scraper.go index c71c134b89a5..a8fc4018f8ca 100644 --- a/receiver/iisreceiver/scraper.go +++ b/receiver/iisreceiver/scraper.go @@ -34,11 +34,13 @@ import ( ) type iisReceiver struct { - params component.TelemetrySettings - config *Config - consumer consumer.Metrics - watcherRecorders []watcherRecorder - metricBuilder *metadata.MetricsBuilder + params component.TelemetrySettings + config *Config + consumer consumer.Metrics + totalWatcherRecorders []watcherRecorder + siteWatcherRecorders []watcherRecorder + appPoolWatcherRecorders []watcherRecorder + metricBuilder *metadata.MetricsBuilder // for mocking newWatcher func(string, string, string) (winperfcounters.PerfCounterWatcher, error) @@ -63,21 +65,13 @@ func newIisReceiver(settings component.ReceiverCreateSettings, cfg *Config, cons // start builds the paths to the watchers func (rcvr *iisReceiver) start(ctx context.Context, host component.Host) error { - rcvr.watcherRecorders = []watcherRecorder{} + errs := &scrapererror.ScrapeErrors{} - var errors scrapererror.ScrapeErrors - for _, pcr := range perfCounterRecorders { - for perfCounterName, recorder := range pcr.recorders { - w, err := rcvr.newWatcher(pcr.object, pcr.instance, perfCounterName) - if err != nil { - errors.AddPartial(1, err) - continue - } - rcvr.watcherRecorders = append(rcvr.watcherRecorders, watcherRecorder{w, recorder}) - } - } + rcvr.totalWatcherRecorders = rcvr.buildWatcherRecorders(totalPerfCounterRecorders, errs) + rcvr.siteWatcherRecorders = rcvr.buildWatcherRecorders(sitePerfCounterRecorders, errs) + rcvr.appPoolWatcherRecorders = rcvr.buildWatcherRecorders(appPoolPerfCounterRecorders, errs) - return errors.Combine() + return errs.Combine() } // scrape pulls counter values from the watchers @@ -85,7 +79,15 @@ func (rcvr *iisReceiver) scrape(ctx context.Context) (pmetric.Metrics, error) { var errs error now := pcommon.NewTimestampFromTime(time.Now()) - for _, wr := range rcvr.watcherRecorders { + rcvr.scrapeInstanceMetrics(now, rcvr.siteWatcherRecorders, metadata.WithIisSite) + rcvr.scrapeInstanceMetrics(now, rcvr.appPoolWatcherRecorders, metadata.WithIisApplicationPool) + rcvr.scrapeTotalMetrics(now) + + return rcvr.metricBuilder.Emit(), errs +} + +func (rcvr *iisReceiver) scrapeTotalMetrics(now pcommon.Timestamp) { + for _, wr := range rcvr.totalWatcherRecorders { counterValues, err := wr.watcher.ScrapeData() if err != nil { rcvr.params.Logger.Warn("some performance counters could not be scraped; ", zap.Error(err)) @@ -98,13 +100,85 @@ func (rcvr *iisReceiver) scrape(ctx context.Context) (pmetric.Metrics, error) { wr.recorder(rcvr.metricBuilder, now, value) } - return rcvr.metricBuilder.Emit(), errs + // resource for total metrics is empty + // this makes it so that the order that the scrape functions are called doesn't matter + rcvr.metricBuilder.EmitForResource() +} + +type valRecorder struct { + val float64 + record recordFunc +} + +func (rcvr *iisReceiver) scrapeInstanceMetrics(now pcommon.Timestamp, wrs []watcherRecorder, resourceOption func(string) metadata.ResourceMetricsOption) { + // Maintain a map of instance -> {val, recordFunc} + // so that we can emit all metrics for a particular instance (site, app_pool) at once, + // keeping them in a single resource metric. + instanceToRecorders := map[string][]valRecorder{} + + for _, wr := range wrs { + counterValues, err := wr.watcher.ScrapeData() + if err != nil { + rcvr.params.Logger.Warn("some performance counters could not be scraped; ", zap.Error(err)) + continue + } + + // This avoids recording the _Total instance. + // The _Total instance may be the only instance, because some instances require elevated permissions + // to list and scrape. In these cases, the per-instance metric is not available, and should not be recorded. + if len(counterValues) == 1 && counterValues[0].InstanceName == "" { + rcvr.params.Logger.Warn("Performance counter was scraped, but only the _Total instance was available, skipping metric...", zap.String("path", wr.watcher.Path())) + continue + } + + for _, cv := range counterValues { + instanceToRecorders[cv.InstanceName] = append(instanceToRecorders[cv.InstanceName], + valRecorder{ + val: cv.Value, + record: wr.recorder, + }) + } + } + + // record all metrics for each instance, then emit them all as a single resource metric + for instanceName, recorders := range instanceToRecorders { + for _, recorder := range recorders { + recorder.record(rcvr.metricBuilder, now, recorder.val) + } + + rcvr.metricBuilder.EmitForResource(resourceOption(instanceName)) + } } // shutdown closes the watchers func (rcvr iisReceiver) shutdown(ctx context.Context) error { var errs error - for _, wr := range rcvr.watcherRecorders { + errs = multierr.Append(errs, closeWatcherRecorders(rcvr.totalWatcherRecorders)) + errs = multierr.Append(errs, closeWatcherRecorders(rcvr.siteWatcherRecorders)) + errs = multierr.Append(errs, closeWatcherRecorders(rcvr.appPoolWatcherRecorders)) + return errs +} + +func (rcvr *iisReceiver) buildWatcherRecorders(confs []perfCounterRecorderConf, scrapeErrors *scrapererror.ScrapeErrors) []watcherRecorder { + wrs := []watcherRecorder{} + + for _, pcr := range confs { + for perfCounterName, recorder := range pcr.recorders { + w, err := rcvr.newWatcher(pcr.object, pcr.instance, perfCounterName) + if err != nil { + scrapeErrors.AddPartial(1, err) + continue + } + wrs = append(wrs, watcherRecorder{w, recorder}) + } + } + + return wrs +} + +func closeWatcherRecorders(wrs []watcherRecorder) error { + var errs error + for _, wr := range wrs { err := wr.watcher.Close() if err != nil { errs = multierr.Append(errs, err) diff --git a/receiver/iisreceiver/scraper_test.go b/receiver/iisreceiver/scraper_test.go index c7b98fe1ef7d..955cac04b955 100644 --- a/receiver/iisreceiver/scraper_test.go +++ b/receiver/iisreceiver/scraper_test.go @@ -78,7 +78,7 @@ func TestScrapeFailure(t *testing.T) { expectedError := "failure to collect metric" mockWatcher, err := newMockWatcherFactory(fmt.Errorf(expectedError), 1)("", "", "") require.NoError(t, err) - scraper.watcherRecorders = []watcherRecorder{ + scraper.totalWatcherRecorders = []watcherRecorder{ { watcher: mockWatcher, recorder: func(mb *metadata.MetricsBuilder, ts pcommon.Timestamp, val float64) { @@ -115,7 +115,7 @@ func (mpc *mockPerfCounter) Path() string { // ScrapeData func (mpc *mockPerfCounter) ScrapeData() ([]winperfcounters.CounterValue, error) { - return []winperfcounters.CounterValue{{Value: 1}}, mpc.watchErr + return []winperfcounters.CounterValue{{InstanceName: "Instance", Value: 1}}, mpc.watchErr } // Close diff --git a/receiver/iisreceiver/testdata/integration/expected.json b/receiver/iisreceiver/testdata/integration/expected.json index 9cb56599fdf4..38a4a4c7dbce 100644 --- a/receiver/iisreceiver/testdata/integration/expected.json +++ b/receiver/iisreceiver/testdata/integration/expected.json @@ -1,7 +1,16 @@ { "resourceMetrics": [ { - "resource": {}, + "resource": { + "attributes": [ + { + "key": "iis.site", + "value": { + "stringValue": "Default Web Site" + } + } + ] + }, "scopeMetrics": [ { "metrics": [ @@ -13,8 +22,8 @@ "dataPoints": [ { "asInt": "0", - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" } ] }, @@ -27,9 +36,9 @@ "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", "dataPoints": [ { - "asInt": "5", - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "asInt": "0", + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" } ], "isMonotonic": true @@ -43,9 +52,9 @@ "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", "dataPoints": [ { - "asInt": "3", - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "asInt": "0", + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" } ], "isMonotonic": true @@ -60,8 +69,8 @@ "dataPoints": [ { "asInt": "0", - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" } ], "isMonotonic": true @@ -80,25 +89,25 @@ { "key": "direction", "value": { - "stringValue": "received" + "stringValue": "sent" } } ], - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" }, { - "asInt": "4", + "asInt": "0", "attributes": [ { "key": "direction", "value": { - "stringValue": "sent" + "stringValue": "received" } } ], - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" } ], "isMonotonic": true @@ -112,7 +121,7 @@ "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", "dataPoints": [ { - "asInt": "1934", + "asInt": "0", "attributes": [ { "key": "direction", @@ -121,11 +130,11 @@ } } ], - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" }, { - "asInt": "106804", + "asInt": "0", "attributes": [ { "key": "direction", @@ -134,8 +143,8 @@ } } ], - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" } ], "isMonotonic": true @@ -154,25 +163,25 @@ { "key": "request", "value": { - "stringValue": "delete" + "stringValue": "put" } } ], - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" }, { - "asInt": "5", + "asInt": "0", "attributes": [ { "key": "request", "value": { - "stringValue": "get" + "stringValue": "trace" } } ], - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" }, { "asInt": "0", @@ -180,12 +189,12 @@ { "key": "request", "value": { - "stringValue": "head" + "stringValue": "get" } } ], - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" }, { "asInt": "0", @@ -197,8 +206,8 @@ } } ], - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" }, { "asInt": "0", @@ -210,8 +219,8 @@ } } ], - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" }, { "asInt": "0", @@ -219,12 +228,12 @@ { "key": "request", "value": { - "stringValue": "put" + "stringValue": "delete" } } ], - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" }, { "asInt": "0", @@ -232,18 +241,54 @@ { "key": "request", "value": { - "stringValue": "trace" + "stringValue": "head" } } ], - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" } ], "isMonotonic": true }, "unit": "{requests}" }, + { + "description": "The amount of time the server has been up.", + "gauge": { + "dataPoints": [ + { + "asInt": "471", + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" + } + ] + }, + "name": "iis.uptime", + "unit": "s" + } + ], + "scope": { + "name": "otelcol/iisreceiver", + "version": "latest" + } + } + ] + }, + { + "resource": { + "attributes": [ + { + "key": "iis.application_pool", + "value": { + "stringValue": "---1" + } + } + ] + }, + "scopeMetrics": [ + { + "metrics": [ { "description": "Current number of requests in the queue.", "name": "iis.request.queue.count", @@ -252,8 +297,8 @@ "dataPoints": [ { "asInt": "0", - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" } ] }, @@ -267,42 +312,96 @@ "dataPoints": [ { "asInt": "0", - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" } ], "isMonotonic": true }, "unit": "{requests}" - }, + } + ], + "scope": { + "name": "otelcol/iisreceiver", + "version": "latest" + } + } + ] + }, + { + "resource": { + "attributes": [ + { + "key": "iis.application_pool", + "value": { + "stringValue": "DefaultAppPool" + } + } + ] + }, + "scopeMetrics": [ + { + "metrics": [ { - "description": "Current number of active threads.", - "name": "iis.thread.active", + "description": "Current number of requests in the queue.", + "name": "iis.request.queue.count", "sum": { "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", "dataPoints": [ { - "asInt": "4724", - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "asInt": "0", + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" } ] }, - "unit": "{threads}" + "unit": "{requests}" }, { - "description": "The amount of time the server has been up.", - "gauge": { + "description": "Total number of requests rejected.", + "name": "iis.request.rejected", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", "dataPoints": [ { - "asInt": "1029516", - "startTimeUnixNano": "1650295321014331300", - "timeUnixNano": "1650295321456400500" + "asInt": "0", + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" + } + ], + "isMonotonic": true + }, + "unit": "{requests}" + } + ], + "scope": { + "name": "otelcol/iisreceiver", + "version": "latest" + } + } + ] + }, + { + "resource": { + "attributes": [] + }, + "scopeMetrics": [ + { + "metrics": [ + { + "description": "Current number of active threads.", + "name": "iis.thread.active", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "1266", + "startTimeUnixNano": "1664375532837715300", + "timeUnixNano": "1664375533465547100" } ] }, - "name": "iis.uptime", - "unit": "s" + "unit": "{threads}" } ], "scope": { diff --git a/receiver/iisreceiver/testdata/scraper/expected.json b/receiver/iisreceiver/testdata/scraper/expected.json index c39eadb7d5db..cd51b64dc667 100644 --- a/receiver/iisreceiver/testdata/scraper/expected.json +++ b/receiver/iisreceiver/testdata/scraper/expected.json @@ -1,7 +1,16 @@ { "resourceMetrics": [ { - "resource": {}, + "resource": { + "attributes": [ + { + "key": "iis.site", + "value": { + "stringValue": "Instance" + } + } + ] + }, "scopeMetrics": [ { "metrics": [ @@ -13,8 +22,8 @@ "dataPoints": [ { "asInt": "1", - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" } ] }, @@ -28,8 +37,8 @@ "dataPoints": [ { "asInt": "1", - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" } ], "isMonotonic": true @@ -44,8 +53,8 @@ "dataPoints": [ { "asInt": "1", - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" } ], "isMonotonic": true @@ -60,8 +69,8 @@ "dataPoints": [ { "asInt": "1", - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" } ], "isMonotonic": true @@ -84,8 +93,8 @@ } } ], - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" }, { "asInt": "1", @@ -97,8 +106,8 @@ } } ], - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" } ], "isMonotonic": true @@ -117,12 +126,12 @@ { "key": "direction", "value": { - "stringValue": "received" + "stringValue": "sent" } } ], - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" }, { "asInt": "1", @@ -130,12 +139,12 @@ { "key": "direction", "value": { - "stringValue": "sent" + "stringValue": "received" } } ], - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" } ], "isMonotonic": true @@ -154,12 +163,12 @@ { "key": "request", "value": { - "stringValue": "delete" + "stringValue": "get" } } ], - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" }, { "asInt": "1", @@ -167,12 +176,12 @@ { "key": "request", "value": { - "stringValue": "get" + "stringValue": "options" } } ], - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" }, { "asInt": "1", @@ -180,12 +189,12 @@ { "key": "request", "value": { - "stringValue": "head" + "stringValue": "post" } } ], - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" }, { "asInt": "1", @@ -193,12 +202,12 @@ { "key": "request", "value": { - "stringValue": "options" + "stringValue": "delete" } } ], - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" }, { "asInt": "1", @@ -206,12 +215,12 @@ { "key": "request", "value": { - "stringValue": "post" + "stringValue": "head" } } ], - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" }, { "asInt": "1", @@ -223,8 +232,8 @@ } } ], - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" }, { "asInt": "1", @@ -236,22 +245,58 @@ } } ], - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" } ], "isMonotonic": true }, "unit": "{requests}" }, + { + "description": "The amount of time the server has been up.", + "gauge": { + "dataPoints": [ + { + "asInt": "1", + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" + } + ] + }, + "name": "iis.uptime", + "unit": "s" + } + ], + "scope": { + "name": "otelcol/iisreceiver", + "version": "latest" + } + } + ] + }, + { + "resource": { + "attributes": [ + { + "key": "iis.application_pool", + "value": { + "stringValue": "Instance" + } + } + ] + }, + "scopeMetrics": [ + { + "metrics": [ { "description": "Age of oldest request in the queue.", "gauge": { "dataPoints": [ { "asInt": "1", - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" } ] }, @@ -266,8 +311,8 @@ "dataPoints": [ { "asInt": "1", - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" } ] }, @@ -281,14 +326,29 @@ "dataPoints": [ { "asInt": "1", - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" } ], "isMonotonic": true }, "unit": "{requests}" - }, + } + ], + "scope": { + "name": "otelcol/iisreceiver", + "version": "latest" + } + } + ] + }, + { + "resource": { + "attributes": [] + }, + "scopeMetrics": [ + { + "metrics": [ { "description": "Current number of active threads.", "name": "iis.thread.active", @@ -297,26 +357,12 @@ "dataPoints": [ { "asInt": "1", - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" + "startTimeUnixNano": "1664375532831495700", + "timeUnixNano": "1664375532831495700" } ] }, "unit": "{threads}" - }, - { - "description": "The amount of time the server has been up.", - "gauge": { - "dataPoints": [ - { - "asInt": "1", - "startTimeUnixNano": "1649969943717902800", - "timeUnixNano": "1649969943717902800" - } - ] - }, - "name": "iis.uptime", - "unit": "s" } ], "scope": { diff --git a/unreleased/iis-per-site-metrics.yaml b/unreleased/iis-per-site-metrics.yaml new file mode 100755 index 000000000000..64c5939a6dfa --- /dev/null +++ b/unreleased/iis-per-site-metrics.yaml @@ -0,0 +1,11 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# 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: Emit metrics per-site and per-app-pool with new resource attributes. + +# One or more tracking issues related to the change +issues: [14448]