in apps/iis.go [39:143]
func (r MetricsReceiverIis) Pipelines(_ context.Context) ([]otel.ReceiverPipeline, error) {
if r.ReceiverVersion == "2" {
return []otel.ReceiverPipeline{{
Receiver: otel.Component{
Type: "iis",
Config: map[string]interface{}{
"collection_interval": r.CollectionIntervalString(),
},
},
Processors: map[string][]otel.Component{"metrics": {
otel.TransformationMetrics(
otel.FlattenResourceAttribute("iis.site", "site"),
otel.FlattenResourceAttribute("iis.application_pool", "app_pool"),
),
// Drop all resource keys; Must be done in a separate transform,
// otherwise the above flatten resource attribute queries will only
// work for the first datapoint
otel.TransformationMetrics(
otel.RetainResource(),
),
otel.CondenseResourceMetrics(),
otel.MetricsTransform(
otel.UpdateMetricRegexp("^iis",
otel.AggregateLabels(
"sum",
"direction",
"request",
),
),
otel.AddPrefix("workload.googleapis.com"),
),
otel.NormalizeSums(),
otel.ModifyInstrumentationScope(r.Type(), "2.0"),
}},
}}, nil
}
// Return version 1 if version is anything other than 2
return []otel.ReceiverPipeline{{
Receiver: otel.Component{
Type: "windowsperfcounters",
Config: map[string]interface{}{
"collection_interval": r.CollectionIntervalString(),
"perfcounters": []map[string]interface{}{
{
"object": "Web Service",
"instances": []string{"_Total"},
"counters": []map[string]string{
{"name": "Current Connections"},
{"name": "Total Bytes Received"},
{"name": "Total Bytes Sent"},
{"name": "Total Connection Attempts (all instances)"},
{"name": "Total Delete Requests"},
{"name": "Total Get Requests"},
{"name": "Total Head Requests"},
{"name": "Total Options Requests"},
{"name": "Total Post Requests"},
{"name": "Total Put Requests"},
{"name": "Total Trace Requests"},
},
},
},
},
},
ExporterTypes: map[string]otel.ExporterType{
"metrics": otel.System,
},
Processors: map[string][]otel.Component{"metrics": {
otel.MetricsTransform(
otel.RenameMetric(
`\Web Service(_Total)\Current Connections`,
"iis/current_connections",
),
// $ needs to be escaped because reasons.
// https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/metricstransformprocessor#rename-multiple-metrics-using-substitution
otel.CombineMetrics(
`^\\Web Service\(_Total\)\\Total Bytes (?P<direction>.*)$$`,
"iis/network/transferred_bytes_count",
// change data type from double -> int64
otel.ToggleScalarDataType,
),
otel.RenameMetric(
`\Web Service(_Total)\Total Connection Attempts (all instances)`,
"iis/new_connection_count",
// change data type from double -> int64
otel.ToggleScalarDataType,
),
otel.CombineMetrics(
`^\\Web Service\(_Total\)\\Total (?P<http_method>.*) Requests$$`,
"iis/request_count",
// change data type from double -> int64
otel.ToggleScalarDataType,
),
otel.AddPrefix("agent.googleapis.com"),
),
otel.CastToSum(
"agent.googleapis.com/iis/network/transferred_bytes_count",
"agent.googleapis.com/iis/new_connection_count",
"agent.googleapis.com/iis/request_count",
),
otel.NormalizeSums(),
otel.ModifyInstrumentationScope(r.Type(), "1.0"),
}},
}}, nil
}