github.com/Shopify/sarama

github.com/Shopify/sarama

Sarama is a Go library for Apache Kafka

Wrap NewConsumer and NewConsumerClient

Join Point
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	sarama "github.com/Shopify/sarama"
	saramatrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/Shopify/sarama"
)
func(c sarama.Consumer, err error) (sarama.Consumer, error) {
	if c != nil {
		c = saramatrace.WrapConsumer(c)
	}
	return c, err
}({{ . }})

Wrap NewSyncProducer and NewSyncProducerFromClient

Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	sarama "github.com/Shopify/sarama"
	saramatrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/Shopify/sarama"
)
{{- $cfg := .Function.ArgumentOfType "sarama.Config" -}}
func(p sarama.SyncProducer, err error) (sarama.SyncProducer, error) {
	if p != nil {
		p = saramatrace.WrapSyncProducer(
			{{- if $cfg -}}
			{{ $cfg }},
			{{- else -}}
			nil,
			{{- end -}}
			p,
		)
	}
	return p, err
}({{ . }})

Wrap NewAsyncProducer and NewAsyncProducerFromClient

Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	sarama "github.com/Shopify/sarama"
	saramatrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/Shopify/sarama"
)
{{- $cfg := .Function.ArgumentOfType "sarama.Config" -}}
func(p sarama.AsyncProducer, err error) (sarama.AsyncProducer, error) {
	if p != nil {
		p = saramatrace.WrapAsyncProducer(
			{{- if $cfg -}}
			{{ $cfg }},
			{{- else -}}
			nil,
			{{- end -}}
			p,
		)
	}
	return p, err
}({{ . }})