Skip to content

Commit

Permalink
Added context into OTelReceiver.Pipelines() (#1364)
Browse files Browse the repository at this point in the history
  • Loading branch information
avilevy18 authored Aug 3, 2023
1 parent b4438c2 commit a61363a
Show file tree
Hide file tree
Showing 38 changed files with 64 additions and 52 deletions.
2 changes: 1 addition & 1 deletion apps/active_directory_ds.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (r MetricsReceiverActiveDirectoryDS) Type() string {
return "active_directory_ds"
}

func (r MetricsReceiverActiveDirectoryDS) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverActiveDirectoryDS) Pipelines(_ context.Context) []otel.ReceiverPipeline {
return []otel.ReceiverPipeline{{
Receiver: otel.Component{
Type: "active_directory_ds",
Expand Down
4 changes: 3 additions & 1 deletion apps/activemq.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package apps

import (
"context"

"github.com/GoogleCloudPlatform/ops-agent/confgenerator"
"github.com/GoogleCloudPlatform/ops-agent/confgenerator/otel"
)
Expand All @@ -32,7 +34,7 @@ func (r MetricsReceiverActivemq) Type() string {
return "activemq"
}

func (r MetricsReceiverActivemq) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverActivemq) Pipelines(_ context.Context) []otel.ReceiverPipeline {

targetSystem := "activemq"

Expand Down
3 changes: 2 additions & 1 deletion apps/aerospike.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package apps

import (
"context"
"time"

"github.com/GoogleCloudPlatform/ops-agent/confgenerator"
Expand Down Expand Up @@ -50,7 +51,7 @@ var (
)

// Pipelines is the OTEL pipelines created from MetricsReceiverAerospike
func (r MetricsReceiverAerospike) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverAerospike) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if r.Endpoint == "" {
r.Endpoint = defaultAerospikeEndpoint
}
Expand Down
2 changes: 1 addition & 1 deletion apps/apache.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (r MetricsReceiverApache) Type() string {
return "apache"
}

func (r MetricsReceiverApache) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverApache) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if r.ServerStatusURL == "" {
r.ServerStatusURL = defaultServerStatusURL
}
Expand Down
2 changes: 1 addition & 1 deletion apps/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (r MetricsReceiverCassandra) Type() string {
return "cassandra"
}

func (r MetricsReceiverCassandra) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverCassandra) Pipelines(_ context.Context) []otel.ReceiverPipeline {
targetSystem := "cassandra"

return r.MetricsReceiverSharedJVM.
Expand Down
2 changes: 1 addition & 1 deletion apps/couchbase.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (r MetricsReceiverCouchbase) Type() string {
}

// Pipelines will construct the prometheus receiver configuration
func (r MetricsReceiverCouchbase) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverCouchbase) Pipelines(_ context.Context) []otel.ReceiverPipeline {
targets := []string{r.Endpoint}
if r.Endpoint == "" {
targets = []string{defaultCouchbaseEndpoint}
Expand Down
2 changes: 1 addition & 1 deletion apps/couchdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (MetricsReceiverCouchdb) Type() string {
return "couchdb"
}

func (r MetricsReceiverCouchdb) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverCouchdb) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if r.Endpoint == "" {
r.Endpoint = defaultCouchdbEndpoint
}
Expand Down
2 changes: 1 addition & 1 deletion apps/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (r MetricsReceiverElasticsearch) Type() string {
return "elasticsearch"
}

func (r MetricsReceiverElasticsearch) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverElasticsearch) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if r.Endpoint == "" {
r.Endpoint = defaultElasticsearchEndpoint
}
Expand Down
2 changes: 1 addition & 1 deletion apps/flink.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (MetricsReceiverFlink) Type() string {

const defaultFlinkEndpoint = "http://localhost:8081"

func (r MetricsReceiverFlink) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverFlink) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if r.Endpoint == "" {
r.Endpoint = defaultFlinkEndpoint
}
Expand Down
2 changes: 1 addition & 1 deletion apps/hadoop.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (r MetricsReceiverHadoop) Type() string {
return "hadoop"
}

func (r MetricsReceiverHadoop) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverHadoop) Pipelines(_ context.Context) []otel.ReceiverPipeline {
targetSystem := "hadoop"
if r.MetricsReceiverSharedCollectJVM.ShouldCollectJVMMetrics() {
targetSystem = fmt.Sprintf("%s,%s", targetSystem, "jvm")
Expand Down
2 changes: 1 addition & 1 deletion apps/hbase.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (r MetricsReceiverHbase) Type() string {
return "hbase"
}

func (r MetricsReceiverHbase) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverHbase) Pipelines(_ context.Context) []otel.ReceiverPipeline {
targetSystem := "hbase"
if r.MetricsReceiverSharedCollectJVM.ShouldCollectJVMMetrics() {
targetSystem = fmt.Sprintf("%s,%s", targetSystem, "jvm")
Expand Down
4 changes: 3 additions & 1 deletion apps/hostmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package apps

import (
"context"

"github.com/GoogleCloudPlatform/ops-agent/confgenerator"
"github.com/GoogleCloudPlatform/ops-agent/confgenerator/otel"
)
Expand All @@ -29,7 +31,7 @@ func (r MetricsReceiverHostmetrics) Type() string {
return "hostmetrics"
}

func (r MetricsReceiverHostmetrics) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverHostmetrics) Pipelines(_ context.Context) []otel.ReceiverPipeline {
return []otel.ReceiverPipeline{{
Receiver: otel.Component{
Type: "hostmetrics",
Expand Down
2 changes: 1 addition & 1 deletion apps/iis.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (r MetricsReceiverIis) Type() string {
return "iis"
}

func (r MetricsReceiverIis) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverIis) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if r.ReceiverVersion == "2" {
return []otel.ReceiverPipeline{{
Receiver: otel.Component{
Expand Down
2 changes: 1 addition & 1 deletion apps/jetty.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (r MetricsReceiverJetty) Type() string {
return "jetty"
}

func (r MetricsReceiverJetty) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverJetty) Pipelines(_ context.Context) []otel.ReceiverPipeline {
targetSystem := "jetty"
if r.MetricsReceiverSharedCollectJVM.ShouldCollectJVMMetrics() {
targetSystem = fmt.Sprintf("%s,%s", targetSystem, "jvm")
Expand Down
4 changes: 3 additions & 1 deletion apps/jvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package apps

import (
"context"

"github.com/GoogleCloudPlatform/ops-agent/confgenerator"
"github.com/GoogleCloudPlatform/ops-agent/confgenerator/otel"
)
Expand All @@ -31,7 +33,7 @@ func (r MetricsReceiverJVM) Type() string {
return "jvm"
}

func (r MetricsReceiverJVM) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverJVM) Pipelines(_ context.Context) []otel.ReceiverPipeline {
return r.MetricsReceiverSharedJVM.
WithDefaultEndpoint(defaultJVMEndpoint).
ConfigurePipelines(
Expand Down
2 changes: 1 addition & 1 deletion apps/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (r MetricsReceiverKafka) Type() string {
return "kafka"
}

func (r MetricsReceiverKafka) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverKafka) Pipelines(_ context.Context) []otel.ReceiverPipeline {
targetSystem := "kafka"
return r.MetricsReceiverSharedJVM.
WithDefaultEndpoint(defaultKafkaEndpoint).
Expand Down
4 changes: 3 additions & 1 deletion apps/memcached.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package apps

import (
"context"

"github.com/GoogleCloudPlatform/ops-agent/confgenerator"
"github.com/GoogleCloudPlatform/ops-agent/confgenerator/otel"
)
Expand All @@ -33,7 +35,7 @@ func (r MetricsReceiverMemcached) Type() string {
return "memcached"
}

func (r MetricsReceiverMemcached) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverMemcached) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if r.Endpoint == "" {
r.Endpoint = defaultMemcachedTCPEndpoint
}
Expand Down
2 changes: 1 addition & 1 deletion apps/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (r MetricsReceiverMongoDB) Type() string {
return "mongodb"
}

func (r MetricsReceiverMongoDB) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverMongoDB) Pipelines(_ context.Context) []otel.ReceiverPipeline {
transport := "tcp"
if r.Endpoint == "" {
r.Endpoint = defaultMongodbEndpoint
Expand Down
4 changes: 3 additions & 1 deletion apps/mssql.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package apps

import (
"context"

"github.com/GoogleCloudPlatform/ops-agent/confgenerator"
"github.com/GoogleCloudPlatform/ops-agent/confgenerator/otel"
"github.com/GoogleCloudPlatform/ops-agent/internal/platform"
Expand All @@ -32,7 +34,7 @@ func (MetricsReceiverMssql) Type() string {
return "mssql"
}

func (m MetricsReceiverMssql) Pipelines() []otel.ReceiverPipeline {
func (m MetricsReceiverMssql) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if m.ReceiverVersion == "2" {
return []otel.ReceiverPipeline{{
Receiver: otel.Component{
Expand Down
7 changes: 3 additions & 4 deletions apps/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ package apps

import (
"context"
"fmt"
"strings"

"github.com/GoogleCloudPlatform/ops-agent/confgenerator"
"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"

"fmt"
"strings"
)

type MetricsReceiverMySql struct {
Expand All @@ -45,7 +44,7 @@ func (r MetricsReceiverMySql) Type() string {
return "mysql"
}

func (r MetricsReceiverMySql) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverMySql) Pipelines(_ context.Context) []otel.ReceiverPipeline {
transport := "tcp"
if r.Endpoint == "" {
transport = "unix"
Expand Down
2 changes: 1 addition & 1 deletion apps/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (r MetricsReceiverNginx) Type() string {
return "nginx"
}

func (r MetricsReceiverNginx) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverNginx) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if r.StubStatusURL == "" {
r.StubStatusURL = defaultStubStatusURL
}
Expand Down
2 changes: 1 addition & 1 deletion apps/oracledb.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (r MetricsReceiverOracleDB) Type() string {
return "oracledb"
}

func (r MetricsReceiverOracleDB) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverOracleDB) Pipelines(_ context.Context) []otel.ReceiverPipeline {
endpoint := r.Endpoint
if r.Endpoint == "" {
endpoint = defaultOracleDBEndpoint
Expand Down
3 changes: 2 additions & 1 deletion apps/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package apps

import (
"context"
"fmt"
"regexp"
"strings"
Expand Down Expand Up @@ -119,7 +120,7 @@ func (r ReceiverOTLP) metricsProcessors() (otel.ExporterType, otel.ResourceDetec
}
}

func (r ReceiverOTLP) Pipelines() []otel.ReceiverPipeline {
func (r ReceiverOTLP) Pipelines(_ context.Context) []otel.ReceiverPipeline {
endpoint := r.GRPCEndpoint
if endpoint == "" {
endpoint = defaultGRPCEndpoint
Expand Down
5 changes: 2 additions & 3 deletions apps/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ package apps

import (
"context"
"strings"

"github.com/GoogleCloudPlatform/ops-agent/confgenerator"
"github.com/GoogleCloudPlatform/ops-agent/confgenerator/fluentbit"
"github.com/GoogleCloudPlatform/ops-agent/confgenerator/otel"
"github.com/GoogleCloudPlatform/ops-agent/internal/secret"

"strings"
)

type MetricsReceiverPostgresql struct {
Expand All @@ -46,7 +45,7 @@ func (r MetricsReceiverPostgresql) Type() string {
return "postgresql"
}

func (r MetricsReceiverPostgresql) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverPostgresql) Pipelines(_ context.Context) []otel.ReceiverPipeline {
transport := "tcp"
if r.Endpoint == "" {
transport = "unix"
Expand Down
2 changes: 1 addition & 1 deletion apps/rabbitmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (r MetricsReceiverRabbitmq) Type() string {
return "rabbitmq"
}

func (r MetricsReceiverRabbitmq) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverRabbitmq) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if r.Endpoint == "" {
r.Endpoint = defaultRabbitmqTCPEndpoint
}
Expand Down
2 changes: 1 addition & 1 deletion apps/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (r MetricsReceiverRedis) Type() string {
return "redis"
}

func (r MetricsReceiverRedis) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverRedis) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if r.Address == "" {
r.Address = defaultRedisEndpoint
}
Expand Down
2 changes: 1 addition & 1 deletion apps/saphana.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (s MetricsReceiverSapHana) Type() string {
return "saphana"
}

func (s MetricsReceiverSapHana) Pipelines() []otel.ReceiverPipeline {
func (s MetricsReceiverSapHana) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if s.Endpoint == "" {
s.Endpoint = defaultSapHanaEndpoint
}
Expand Down
2 changes: 1 addition & 1 deletion apps/solr.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (r MetricsReceiverSolr) Type() string {
return "solr"
}

func (r MetricsReceiverSolr) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverSolr) Pipelines(_ context.Context) []otel.ReceiverPipeline {
targetSystem := "solr"

return r.MetricsReceiverSharedJVM.
Expand Down
2 changes: 1 addition & 1 deletion apps/tomcat.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (r MetricsReceiverTomcat) Type() string {
return "tomcat"
}

func (r MetricsReceiverTomcat) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverTomcat) Pipelines(_ context.Context) []otel.ReceiverPipeline {
targetSystem := "tomcat"

return r.MetricsReceiverSharedJVM.
Expand Down
2 changes: 1 addition & 1 deletion apps/varnish.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (MetricsReceiverVarnish) Type() string {
return "varnish"
}

func (r MetricsReceiverVarnish) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverVarnish) Pipelines(_ context.Context) []otel.ReceiverPipeline {
return []otel.ReceiverPipeline{{
Receiver: otel.Component{
Type: "varnish",
Expand Down
2 changes: 1 addition & 1 deletion apps/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (r MetricsReceiverVault) Type() string {
return "vault"
}

func (r MetricsReceiverVault) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverVault) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if r.Endpoint == "" {
r.Endpoint = defaultVaultEndpoint
}
Expand Down
2 changes: 1 addition & 1 deletion apps/wildfly.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (r MetricsReceiverWildfly) Type() string {
return "wildfly"
}

func (r MetricsReceiverWildfly) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverWildfly) Pipelines(_ context.Context) []otel.ReceiverPipeline {
targetSystem := "wildfly"

if r.MetricsReceiverSharedJVM.Endpoint != "" && !strings.HasPrefix(r.MetricsReceiverSharedJVM.Endpoint, "service:jmx") {
Expand Down
2 changes: 1 addition & 1 deletion apps/zookeeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (MetricsReceiverZookeeper) Type() string {
return "zookeeper"
}

func (r MetricsReceiverZookeeper) Pipelines() []otel.ReceiverPipeline {
func (r MetricsReceiverZookeeper) Pipelines(_ context.Context) []otel.ReceiverPipeline {
if r.Endpoint == "" {
r.Endpoint = defaultZookeeperEndpoint
}
Expand Down
Loading

0 comments on commit a61363a

Please sign in to comment.