Skip to content

contrib/garyburd/redigo: add godoc links #3646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### :warning: WARNING! This branch is no longer maintained. Development is now on the [`v1` branch](https://github.com/DataDog/dd-trace-go/tree/v1). Please consider upgrading using our [migration guide](https://github.com/DataDog/dd-trace-go/blob/v1/MIGRATING.md).

---

[![CircleCI](https://circleci.com/gh/DataDog/dd-trace-go/tree/master.svg?style=svg)](https://circleci.com/gh/DataDog/dd-trace-go/tree/master)
[![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/DataDog/dd-trace-go/opentracing)

Expand Down
24 changes: 12 additions & 12 deletions contrib/garyburd/redigo/redigo.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package redigo provides functions to trace the garyburd/redigo package (https://github.com/garyburd/redigo).
// Package redigo provides functions to trace the [github.com/garyburd/redigo/redis] package.
package redigo

import (
Expand All @@ -15,23 +15,23 @@ import (
"github.com/DataDog/dd-trace-go/tracer/ext"
)

// Conn is an implementation of the redis.Conn interface that supports tracing
// Conn is an implementation of the [redis.Conn] interface that supports tracing.
type Conn struct {
redis.Conn
*params
}

// params contains fields and metadata useful for command tracing
// params contains fields and metadata useful for command tracing.
type params struct {
config *dialConfig
network string
host string
port string
}

// parseOptions parses a set of arbitrary options (which can be of type redis.DialOption
// or the local DialOption) and returns the corresponding redis.DialOption set as well as
// a configured dialConfig.
// parseOptions parses a set of arbitrary options (which can be of type [redis.DialOption]
// or the local [DialOption]) and returns the corresponding [redis.DialOption] set as well as
// a configured [dialConfig].
func parseOptions(options ...interface{}) ([]redis.DialOption, *dialConfig) {
dialOpts := []redis.DialOption{}
cfg := new(dialConfig)
Expand All @@ -47,8 +47,8 @@ func parseOptions(options ...interface{}) ([]redis.DialOption, *dialConfig) {
return dialOpts, cfg
}

// Dial dials into the network address and returns a traced redis.Conn.
// The set of supported options must be either of type redis.DialOption or this package's DialOption.
// Dial dials into the network address and returns a traced [redis.Conn].
// The set of supported options must be either of type [redis.DialOption] or this package's [DialOption].
func Dial(network, address string, options ...interface{}) (redis.Conn, error) {
dialOpts, cfg := parseOptions(options...)
c, err := redis.Dial(network, address, dialOpts...)
Expand All @@ -67,7 +67,7 @@ func Dial(network, address string, options ...interface{}) (redis.Conn, error) {
// DialURL connects to a Redis server at the given URL using the Redis
// URI scheme. URLs should follow the draft IANA specification for the
// scheme (https://www.iana.org/assignments/uri-schemes/prov/redis).
// The returned redis.Conn is traced.
// The returned [redis.Conn] is traced.
func DialURL(rawurl string, options ...interface{}) (redis.Conn, error) {
dialOpts, cfg := parseOptions(options...)
u, err := url.Parse(rawurl)
Expand All @@ -88,7 +88,7 @@ func DialURL(rawurl string, options ...interface{}) (redis.Conn, error) {
return tc, err
}

// newChildSpan creates a span inheriting from the given context. It adds to the span useful metadata about the traced Redis connection
// newChildSpan creates a span inheriting from the given context. It adds to the span useful metadata about the traced Redis connection.
func (tc Conn) newChildSpan(ctx context.Context) *tracer.Span {
p := tc.params
span := p.config.tracer.NewChildSpanFromContext("redis.command", ctx)
Expand All @@ -99,9 +99,9 @@ func (tc Conn) newChildSpan(ctx context.Context) *tracer.Span {
return span
}

// Do wraps redis.Conn.Do. It sends a command to the Redis server and returns the received reply.
// Do wraps [redis.Conn.Do]. It sends a command to the Redis server and returns the received reply.
// In the process it emits a span containing key information about the command sent.
// When passed a context.Context as the final argument, Do will ensure that any span created
// When passed a [context.Context] as the final argument, Do will ensure that any span created
// inherits from this context. The rest of the arguments are passed through to the Redis server unchanged.
func (tc Conn) Do(commandName string, args ...interface{}) (reply interface{}, err error) {
var (
Expand Down
2 changes: 1 addition & 1 deletion tracer/ext/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
const (
Lang = "go"
Interpreter = runtime.Compiler + "-" + runtime.GOARCH + "-" + runtime.GOOS
TracerVersion = "v0.5.0"
TracerVersion = "v0.6.1"
)

var LangVersion = strings.TrimPrefix(runtime.Version(), Lang)