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