Documentation ¶
Overview ¶
Example (BasicCommand) ¶
package main import ( "context" "fmt" "os" instana "github.com/instana/go-sensor" "github.com/instana/go-sensor/instrumentation/instaredigo" ) func main() { // Create a sensor for instana instrumentation sensor := instana.NewSensor("mysensor") // Create an InstaRedigo connection conn, err := instaredigo.Dial(sensor, "tcp", ":7001") if err != nil { os.Exit(1) } defer conn.Close() // Send a command using the new connection ctx := context.Background() reply, err := conn.Do("SET", "greetings", "helloworld", ctx) if err != nil { fmt.Println("Error while sending command. Details: ", err.Error()) } fmt.Println("Response received: ", fmt.Sprintf("%s", reply)) }
Output:
Example (BatchCommands) ¶
package main import ( "fmt" "os" instana "github.com/instana/go-sensor" "github.com/instana/go-sensor/instrumentation/instaredigo" ) func main() { // Create a sensor for instana instrumentation sensor := instana.NewSensor("mysensor") //Create an InstaRedigo connection conn, err := instaredigo.Dial(sensor, "tcp", ":7001") if err != nil { os.Exit(1) } defer conn.Close() // Send a batch of commands using the new connection err = conn.Send("MULTI") err = conn.Send("INCR", "foo") err = conn.Send("INCR", "bar") reply, err := conn.Do("EXEC") if err != nil { fmt.Println("Error while sending command. Details: ", err.Error()) } fmt.Println("Response received: ", reply) }
Output:
Index ¶
- Constants
- func Dial(sensor instana.TracerLogger, network, address string, ...) (redis.Conn, error)
- func DialContext(sensor instana.TracerLogger, ctx context.Context, network, address string, ...) (redis.Conn, error)
- func DialURL(sensor instana.TracerLogger, rawurl string, options ...redis.DialOption) (redis.Conn, error)
- func DialURLContext(sensor instana.TracerLogger, ctx context.Context, rawurl string, ...) (redis.Conn, error)
- func NewConn(sensor instana.TracerLogger, netConn net.Conn, ...) redis.Conn
Examples ¶
Constants ¶
View Source
const Version = "0.20.0"
Version is the instrumentation module semantic version
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
func Dial(sensor instana.TracerLogger, network, address string, options ...redis.DialOption) (redis.Conn, error)
Dial connects to the Redis server at the given network and address using the specified options along with instrumentation code.
func DialContext ¶
func DialContext(sensor instana.TracerLogger, ctx context.Context, network, address string, options ...redis.DialOption) (redis.Conn, error)
DialContext connects to the Redis server at the given network and address using the specified options and context along with instrumentation code.
func DialURL ¶
func DialURL(sensor instana.TracerLogger, rawurl string, options ...redis.DialOption) (redis.Conn, error)
DialURL wraps DialURLContext using context.Background along with the instrumentation code.
func DialURLContext ¶
func DialURLContext(sensor instana.TracerLogger, ctx context.Context, rawurl string, options ...redis.DialOption) (redis.Conn, error)
DialURLContext connects to a Redis server at the given URL using the Redis URI scheme along with the instrumentation code.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.