in apps/oracledb.go [52:121]
func (r MetricsReceiverOracleDB) Pipelines(_ context.Context) ([]otel.ReceiverPipeline, error) {
endpoint := r.Endpoint
if r.Endpoint == "" {
endpoint = defaultOracleDBEndpoint
}
// put all parameters that are provided to the datasource as query params
// in an url.Values so they can be easily encoded
params := url.Values{}
if r.SID != "" {
params.Add("SID", r.SID)
}
if r.Wallet != "" {
params.Add("WALLET", r.Wallet)
}
if r.Insecure != nil && *r.Insecure == false {
params.Add("SSL", "ENABLE")
}
if r.InsecureSkipVerify != nil && *r.InsecureSkipVerify == false {
params.Add("SSL VERIFY", "ENABLE")
}
if strings.HasPrefix(r.Endpoint, "/") {
params.Add("UNIX SOCKET", r.Endpoint)
endpoint = defaultOracleDBEndpoint
}
auth := url.QueryEscape(r.Username)
secretPassword := r.Password.SecretValue()
if len(secretPassword) > 0 {
auth = fmt.Sprintf("%s:%s", auth, url.QueryEscape(secretPassword))
}
// create a datasource in the form oracle://username:password@host:port/ServiceName?SID=sid&ssl=enable&...
datasource := fmt.Sprintf("oracle://%s@%s/%s?%s",
auth,
endpoint,
url.QueryEscape(r.ServiceName),
params.Encode(),
)
config := map[string]interface{}{
"collection_interval": r.CollectionIntervalString(),
"driver": "oracle",
"datasource": datasource,
"queries": sqlReceiverQueriesConfig(oracleQueries),
}
return []otel.ReceiverPipeline{{
Receiver: otel.Component{
Type: "sqlquery",
Config: config,
},
Processors: map[string][]otel.Component{"metrics": {
otel.NormalizeSums(),
otel.MetricsTransform(
otel.AddPrefix("workload.googleapis.com",
// sql query receiver is not able to create these attributes with lowercase names
otel.RenameLabel("DATABASE_ID", "database_id"),
otel.RenameLabel("GLOBAL_NAME", "global_name"),
otel.RenameLabel("INSTANCE_ID", "instance_id"),
otel.RenameLabel("TABLESPACE_NAME", "tablespace_name"),
otel.RenameLabel("CONTENTS", "contents"),
otel.RenameLabel("STATUS", "status"),
otel.RenameLabel("PROGRAM", "program"),
otel.RenameLabel("WAIT_CLASS", "wait_class"),
),
),
otel.ModifyInstrumentationScope(r.Type(), "1.0"),
}},
}}, nil
}