func()

in apps/mssql.go [37:107]


func (m MetricsReceiverMssql) Pipelines(_ context.Context) ([]otel.ReceiverPipeline, error) {
	if m.ReceiverVersion == "2" {
		return []otel.ReceiverPipeline{{
			Receiver: otel.Component{
				Type: "sqlserver",
				Config: map[string]interface{}{
					"collection_interval": m.CollectionIntervalString(),
				},
			},
			Processors: map[string][]otel.Component{"metrics": {
				otel.MetricsTransform(
					otel.RenameMetric(
						"sqlserver.transaction_log.usage",
						"sqlserver.transaction_log.percent_used",
					),
					otel.AddPrefix("workload.googleapis.com"),
				),
				otel.TransformationMetrics(
					otel.FlattenResourceAttribute("sqlserver.database.name", "database"),
				),
				otel.NormalizeSums(),
				otel.ModifyInstrumentationScope(m.Type(), "2.0"),
			}},
		}}, nil
	}

	return []otel.ReceiverPipeline{{
		Receiver: otel.Component{
			Type: "windowsperfcounters",
			Config: map[string]interface{}{
				"collection_interval": m.CollectionIntervalString(),
				"perfcounters": []map[string]interface{}{
					{
						"object":    "SQLServer:General Statistics",
						"instances": []string{"_Total"},
						"counters":  []map[string]string{{"name": "User Connections"}},
					},
					{
						"object":    "SQLServer:Databases",
						"instances": []string{"_Total"},
						"counters": []map[string]string{
							{"name": "Transactions/sec"},
							{"name": "Write Transactions/sec"},
						},
					},
				},
			},
		},
		ExporterTypes: map[string]otel.ExporterType{
			"metrics": otel.System,
		},
		Processors: map[string][]otel.Component{"metrics": {
			otel.MetricsTransform(
				otel.RenameMetric(
					`\SQLServer:General Statistics(_Total)\User Connections`,
					"mssql/connections/user",
				),
				otel.RenameMetric(
					`\SQLServer:Databases(_Total)\Transactions/sec`,
					"mssql/transaction_rate",
				),
				otel.RenameMetric(
					`\SQLServer:Databases(_Total)\Write Transactions/sec`,
					"mssql/write_transaction_rate",
				),
				otel.AddPrefix("agent.googleapis.com"),
			),
			otel.ModifyInstrumentationScope(m.Type(), "1.0"),
		}},
	}}, nil
}