Skip to content

Commit

Permalink
docs: use more links
Browse files Browse the repository at this point in the history
  • Loading branch information
alebabai committed Feb 21, 2024
1 parent 5d9dee5 commit a36f0a3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tracing/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const (
KeyOffset KafkaContextKey = "kafka.offset"
)

// MessageToContext returns new context with topic, partition and offset values from msg.
// MessageToContext returns new [context.Context] with topic, partition and offset values from msg.
func MessageToContext(ctx context.Context, msg *kafka.Message) context.Context {
ctx = context.WithValue(ctx, KeyTopic, msg.Topic)
ctx = context.WithValue(ctx, KeyPartition, msg.Partition)
Expand All @@ -23,7 +23,7 @@ func MessageToContext(ctx context.Context, msg *kafka.Message) context.Context {
return ctx
}

// ContextToTags returns new map of tags from ctx.
// ContextToTags returns new map of tags from the [context.Context].
func ContextToTags(ctx context.Context) map[string]interface{} {
tags := make(map[string]interface{})

Expand Down
2 changes: 1 addition & 1 deletion tracing/opentracing/propagation.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func ContextToKafka(tracer opentracing.Tracer, logger log.Logger) transport.Requ
// KafkaToContext returns an [transport.RequestFunc] that tries to join with an
// OpenTracing trace found in msg and starts a new Span called
// operationName accordingly. If no trace could be found in msg, the Span
// will be a trace root. The Span is incorporated in the returned Context and
// will be a trace root. The Span is incorporated in the returned [context.Context] and
// can be retrieved with opentracing.SpanFromContext(ctx).
func KafkaToContext(tracer opentracing.Tracer, operationName string, logger log.Logger) transport.RequestFunc {
return func(ctx context.Context, msg *kafka.Message) context.Context {
Expand Down
4 changes: 2 additions & 2 deletions transport/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/go-kit/kit/transport"
)

// Consumer wraps an endpoint and implements [kafka.Handler].
// Consumer wraps an [endpoint.Endpoint] and implements [kafka.Handler].
type Consumer struct {
e endpoint.Endpoint
dec DecodeRequestFunc
Expand All @@ -18,7 +18,7 @@ type Consumer struct {
errorHandler transport.ErrorHandler
}

// NewConsumer constructs a new consumer, which implements kafka.Handler and wraps the provided endpoint.
// NewConsumer constructs a new consumer, which implements [kafka.Handler] and wraps the provided [endpoint.Endpoint].
func NewConsumer(
e endpoint.Endpoint,
dec DecodeRequestFunc,
Expand Down
10 changes: 5 additions & 5 deletions transport/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

// Producer wraps single Kafka topic for message producing
// and implements endpoint.Endpoint.
// and implements [endpoint.Endpoint].
type Producer struct {
handler kafka.Handler
topic string
Expand Down Expand Up @@ -50,15 +50,15 @@ func ProducerResponse(response interface{}) ProducerOption {
}
}

// ProducerBefore sets the RequestFuncs that are applied to the outgoing producer
// ProducerBefore sets the [RequestFunc]s that are applied to the outgoing producer
// request before it's invoked.
func ProducerBefore(before ...RequestFunc) ProducerOption {
return func(p *Producer) {
p.before = append(p.before, before...)
}
}

// ProducerAfter adds one or more ProducerResponseFuncs, which are applied to the
// ProducerAfter adds one or more [ProducerResponseFunc]s, which are applied to the
// context after successful message producing.
// This is useful for context-manipulation operations.
func ProducerAfter(after ...ProducerResponseFunc) ProducerOption {
Expand All @@ -67,7 +67,7 @@ func ProducerAfter(after ...ProducerResponseFunc) ProducerOption {
}
}

// ProducerFinalizer adds one or more ProducerFinalizerFuncs to be executed at the
// ProducerFinalizer adds one or more [ProducerFinalizerFunc]s to be executed at the
// end of producing Kafka message. Finalizers are executed in the order in which they
// were added. By default, no finalizer is registered.
func ProducerFinalizer(f ...ProducerFinalizerFunc) ProducerOption {
Expand Down Expand Up @@ -118,7 +118,7 @@ func (p Producer) Endpoint() endpoint.Endpoint {
type ProducerFinalizerFunc func(ctx context.Context, err error)

// EncodeJSONRequest is an [EncodeRequestFunc] that serializes the request as a
// JSON object to the Message value.
// JSON object to the [Message] value.
// Many services can use it as a sensible default.
func EncodeJSONRequest(_ context.Context, msg *kafka.Message, request interface{}) error {
rawJSON, err := json.Marshal(request)
Expand Down

0 comments on commit a36f0a3

Please sign in to comment.