github.com/Shopify/sarama
Sarama is a Go library for Apache Kafka
Wrap sarama.NewConsumer and sarama.NewConsumerClient
One of
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 sarama.NewSyncProducer and sarama.NewSyncProducerFromClient
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 sarama.NewAsyncProducer and sarama.NewAsyncProducerFromClient
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
}({{ . }})