Skip to content

Commit

Permalink
Updates OTEL dependencies to v0.112.0 (#1816)
Browse files Browse the repository at this point in the history
Co-authored-by: Ridwan Sharif <[email protected]>
  • Loading branch information
StefanKurek and ridwanmsharif authored Nov 5, 2024
1 parent dda6278 commit 6637ca8
Show file tree
Hide file tree
Showing 708 changed files with 17,556 additions and 6,758 deletions.
8 changes: 4 additions & 4 deletions apps/couchbase.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ var metrics = map[string]couchbaseMetric{
}

func (r MetricsReceiverCouchbase) transformMetrics() []otel.TransformQuery {
operations := []otel.TransformQuery{}
queries := []otel.TransformQuery{}

// persisting order so config generation is non-random
keys := []string{}
Expand All @@ -223,11 +223,11 @@ func (r MetricsReceiverCouchbase) transformMetrics() []otel.TransformQuery {
for _, metricName := range keys {
m := metrics[metricName]
if m.castToSum {
operations = append(operations, otel.ConvertGaugeToSum(metricName))
queries = append(queries, otel.ConvertGaugeToSum(metricName))
}
operations = append(operations, otel.SetDescription(metricName, m.description), otel.SetUnit(metricName, m.unit))
queries = append(queries, otel.SetDescription(metricName, m.description), otel.SetUnit(metricName, m.unit))
}
return operations
return queries
}

func init() {
Expand Down
64 changes: 2 additions & 62 deletions apps/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import (
"github.com/GoogleCloudPlatform/ops-agent/confgenerator/fluentbit"
"github.com/GoogleCloudPlatform/ops-agent/confgenerator/otel"
"github.com/GoogleCloudPlatform/ops-agent/internal/secret"

"github.com/go-sql-driver/mysql"
)

type MetricsReceiverMySql struct {
Expand Down Expand Up @@ -57,35 +55,7 @@ func (r MetricsReceiverMySql) Pipelines(_ context.Context) ([]otel.ReceiverPipel
r.Username = "root"
}

// MySQL replication metrics are implemented separate to the main metrics pipeline so that 5.7 and 8.0 are both supported
sqlReceiverDriverConfig := mysql.Config{
User: r.Username,
Passwd: r.Password.SecretValue(),
Net: transport,
Addr: r.Endpoint,
// This defaults to true in the mysql receiver, but we need to set it explicitly here
AllowNativePasswords: true,
}

return []otel.ReceiverPipeline{
{
Receiver: otel.Component{
Type: "sqlquery",
Config: map[string]interface{}{
"collection_interval": r.CollectionIntervalString(),
"driver": "mysql",
"datasource": sqlReceiverDriverConfig.FormatDSN(),
"queries": sqlReceiverQueriesConfig(mysqlLegacyReplicationQueries),
},
},
Processors: map[string][]otel.Component{"metrics": {
otel.NormalizeSums(),
otel.MetricsTransform(
otel.AddPrefix("workload.googleapis.com"),
),
otel.ModifyInstrumentationScope(r.Type(), "1.0"),
}},
},
{
Receiver: otel.Component{
Type: "mysql",
Expand Down Expand Up @@ -124,10 +94,10 @@ func (r MetricsReceiverMySql) Pipelines(_ context.Context) ([]otel.ReceiverPipel
"enabled": false,
},
"mysql.replica.sql_delay": map[string]interface{}{
"enabled": false,
"enabled": true,
},
"mysql.replica.time_behind_source": map[string]interface{}{
"enabled": false,
"enabled": true,
},
},
},
Expand Down Expand Up @@ -156,36 +126,6 @@ func (r MetricsReceiverMySql) Pipelines(_ context.Context) ([]otel.ReceiverPipel
}, nil
}

var mysqlLegacyReplicationQueries = []sqlReceiverQuery{
{
query: `SHOW SLAVE STATUS`,
metrics: []sqlReceiverMetric{
{
metric_name: "mysql.replica.sql_delay",
value_column: "SQL_Delay",
unit: "s",
description: "The number of seconds that the replica must lag the source.",
data_type: "sum",
monotonic: "false",
value_type: "int",
attribute_columns: []string{},
static_attributes: map[string]string{},
},
{
metric_name: "mysql.replica.time_behind_source",
value_column: "Seconds_Behind_Master",
unit: "s",
description: "This field is an indication of how “late” the replica is.",
data_type: "sum",
monotonic: "false",
value_type: "int",
attribute_columns: []string{},
static_attributes: map[string]string{},
},
},
},
}

func init() {
confgenerator.MetricsReceiverTypes.RegisterType(func() confgenerator.MetricsReceiver { return &MetricsReceiverMySql{} })
}
Expand Down
Loading

0 comments on commit 6637ca8

Please sign in to comment.