contrib/elastic/go-elasticsearch.v6

contrib/elastic/go-elasticsearch.v6

Those integration are enabled by having the following import in the project’s orchestrion.tool.go file:

import (
	_ "github.com/DataDog/orchestrion"

	_ "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6" // integration
	//...
)

The official Go client for Elasticsearch

v6.Config

Join Point
Struct literal elasticsearch.Config
  • Value
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	elasticsearch "github.com/elastic/go-elasticsearch/v6"
	elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6"
)
func(cfg elasticsearch.Config) elasticsearch.Config {
	if cfg.Transport == nil {
		cfg.Transport = elastictrace.NewRoundTripper()
	} else {
		base := cfg.Transport
		cfg.Transport = elastictrace.NewRoundTripper(elastictrace.WithTransport(base))
	}
	return cfg
}({{ . }})

*v6.Config

Join Point
Struct literal elasticsearch.Config
  • Pointer
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	elasticsearch "github.com/elastic/go-elasticsearch/v6"
	elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6"
)
func(cfg *elasticsearch.Config) *elasticsearch.Config {
	if cfg.Transport == nil {
		cfg.Transport = elastictrace.NewRoundTripper()
	} else {
		base := cfg.Transport
		cfg.Transport = elastictrace.NewRoundTripper(elastictrace.WithTransport(base))
	}
	return cfg
}({{ . }})

v7.Config

Join Point
Struct literal elasticsearch.Config
  • Value
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	elasticsearch "github.com/elastic/go-elasticsearch/v7"
	elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6"
)
func(cfg elasticsearch.Config) elasticsearch.Config {
	if cfg.CACert != nil {
		// refuse to set transport as it will make the NewClient call fail.
		return cfg
	}
	if cfg.Transport == nil {
		cfg.Transport = elastictrace.NewRoundTripper()
	} else {
		base := cfg.Transport
		cfg.Transport = elastictrace.NewRoundTripper(elastictrace.WithTransport(base))
	}
	return cfg
}({{ . }})

*v7.Config

Join Point
Struct literal elasticsearch.Config
  • Pointer
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	elasticsearch "github.com/elastic/go-elasticsearch/v7"
	elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6"
)
func(cfg *elasticsearch.Config) *elasticsearch.Config {
	if cfg.CACert != nil {
		// refuse to set transport as it will make the NewClient call fail.
		return cfg
	}
	if cfg.Transport == nil {
		cfg.Transport = elastictrace.NewRoundTripper()
	} else {
		base := cfg.Transport
		cfg.Transport = elastictrace.NewRoundTripper(elastictrace.WithTransport(base))
	}
	return cfg
}({{ . }})

v8.Config

Join Point
Struct literal elasticsearch.Config
  • Value
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	elasticsearch "github.com/elastic/go-elasticsearch/v8"
	elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6"
)
func(cfg elasticsearch.Config) elasticsearch.Config {
	if cfg.CACert != nil {
		// refuse to set transport as it will make the NewClient call fail.
		return cfg
	}
	if cfg.Transport == nil {
		cfg.Transport = elastictrace.NewRoundTripper()
	} else {
		base := cfg.Transport
		cfg.Transport = elastictrace.NewRoundTripper(elastictrace.WithTransport(base))
	}
	return cfg
}({{ . }})

*v8.Config

Join Point
Struct literal elasticsearch.Config
  • Pointer
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	elasticsearch "github.com/elastic/go-elasticsearch/v8"
	elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6"
)
func(cfg *elasticsearch.Config) *elasticsearch.Config {
	if cfg.CACert != nil {
		// refuse to set transport as it will make the NewClient call fail.
		return cfg
	}
	if cfg.Transport == nil {
		cfg.Transport = elastictrace.NewRoundTripper()
	} else {
		base := cfg.Transport
		cfg.Transport = elastictrace.NewRoundTripper(elastictrace.WithTransport(base))
	}
	return cfg
}({{ . }})