otgoredis

package module
v0.0.0-...-3b26ef7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2020 License: MIT Imports: 9 Imported by: 0

README

opentracing-go-redis

OpenTracing instrumentation for go-redis.

This instrumentation bases on internal tracing of go-redis.

Install

go get -u github.com/lyb0307/opentracing-go-redis

Usage

Example:


package main

import (
"github.com/go-redis/redis/v8"
"github.com/lyb0307/otgoredis"
)

func main() {
    tracer := ... // init your tracer

    rdb := redis.NewClient(&redis.Options{
        Addr: "localhost:6379",
        DB: 0,
    })
    
    rdb.AddHook(otgoredis.NewHookWithTracer(tracer))
}

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendArg

func AppendArg(b []byte, v interface{}) []byte

func Bytes

func Bytes(s string) []byte

Bytes converts string to byte slice.

func String

func String(b []byte) string

String converts byte slice to string.

Types

type OpenTracingHook

type OpenTracingHook struct {
	Tracker opentracing.Tracer
}

func NewHook

func NewHook() *OpenTracingHook

func NewHookWithTracer

func NewHookWithTracer(tracker opentracing.Tracer) *OpenTracingHook

func (*OpenTracingHook) AfterProcess

func (h *OpenTracingHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error

func (*OpenTracingHook) AfterProcessPipeline

func (h *OpenTracingHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error

func (*OpenTracingHook) BeforeProcess

func (h *OpenTracingHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

func (*OpenTracingHook) BeforeProcessPipeline

func (h *OpenTracingHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL