in apps/mysql.go [45:127]
func (r MetricsReceiverMySql) Pipelines(_ context.Context) ([]otel.ReceiverPipeline, error) {
transport := "tcp"
if r.Endpoint == "" {
transport = "unix"
r.Endpoint = defaultMySqlUnixEndpoint
} else if strings.HasPrefix(r.Endpoint, "/") {
transport = "unix"
}
if r.Username == "" {
r.Username = "root"
}
return []otel.ReceiverPipeline{
{
Receiver: otel.Component{
Type: "mysql",
Config: map[string]interface{}{
"collection_interval": r.CollectionIntervalString(),
"endpoint": r.Endpoint,
"username": r.Username,
"password": r.Password.SecretValue(),
"transport": transport,
"metrics": map[string]interface{}{
"mysql.commands": map[string]interface{}{
"enabled": true,
},
"mysql.index.io.wait.count": map[string]interface{}{
"enabled": false,
},
"mysql.index.io.wait.time": map[string]interface{}{
"enabled": false,
},
"mysql.mysqlx_connections": map[string]interface{}{
"enabled": false,
},
"mysql.opened_resources": map[string]interface{}{
"enabled": false,
},
"mysql.tmp_resources": map[string]interface{}{
"enabled": false,
},
"mysql.prepared_statements": map[string]interface{}{
"enabled": false,
},
"mysql.table.io.wait.count": map[string]interface{}{
"enabled": false,
},
"mysql.table.io.wait.time": map[string]interface{}{
"enabled": false,
},
"mysql.replica.sql_delay": map[string]interface{}{
"enabled": true,
},
"mysql.replica.time_behind_source": map[string]interface{}{
"enabled": true,
},
},
},
},
Processors: map[string][]otel.Component{"metrics": {
otel.NormalizeSums(),
otel.MetricsTransform(
// The following changes are here to ensure maximum backwards compatibility after the fixes
// introduced https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/7924
otel.ChangePrefix("mysql\\.buffer_pool\\.", "mysql.buffer_pool_"),
otel.UpdateMetric("mysql.buffer_pool_pages",
otel.ToggleScalarDataType,
),
otel.UpdateMetric("mysql.threads",
otel.ToggleScalarDataType,
),
otel.RenameMetric("mysql.buffer_pool_usage", "mysql.buffer_pool_size",
otel.RenameLabel("status", "kind"),
otel.ToggleScalarDataType,
),
otel.AddPrefix("workload.googleapis.com"),
),
otel.ModifyInstrumentationScope(r.Type(), "1.0"),
}},
},
}, nil
}