opentracing

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0 Imports: 13 Imported by: 115

README

opentracing

Opentracing tracer for Kitex

Server usage

import (
    ...
    "github.com/cloudwego/kitex/server"
    internal_opentracing "github.com/kitex-contrib/tracer-opentracing"
    ...
)

func main() {
    ...
    tracer := internal_opentracing.NewDefaultServerSuite()
    svr := echo.NewServer(new(EchoImpl), server.WithSuite(tracer))
    ...
}

DefaultServerOption will use opentracing global tracer as tracer, and {Service Name}::{Method Name} as operation name. You can customize both by ServerOption.

Client usage

import (
    ...
    "github.com/cloudwego/kitex/client"
    internal_opentracing "github.com/kitex-contrib/tracer-opentracing"
    ...
)

func main() {
    ...
    tracer := internal_opentracing.NewDefaultClientSuite()
    client, err := echo.NewClient("echo", client.WithSuite(tracer))
	if err != nil {
		log.Fatal(err)
	}
    ...
}

Just like server, DefaultClientOption will use opentracing global tracer as tracer, and {Service Name}::{Method Name} as operation name. You can customize both by ClientOption.

Example

Executable Example

Documentation

Overview

Package opentracing implements KiteX tracer with opentracing.

Index

Constants

View Source
const (
	SpanContextKey = "JaegerSpanContext"
)

Variables

This section is empty.

Functions

func NewClientSuite added in v0.0.2

func NewClientSuite(tracer opentracing.Tracer, formOperationName func(c context.Context) string) client.Suite

func NewDefaultClientSuite added in v0.0.2

func NewDefaultClientSuite() client.Suite

func NewDefaultServerSuite added in v0.0.2

func NewDefaultServerSuite() server.Suite

func NewServerSuite added in v0.0.2

func NewServerSuite(tracer opentracing.Tracer, formOperationName func(c context.Context) string) server.Suite

func SpanContextExtractMW added in v0.0.2

func SpanContextExtractMW(next endpoint.Endpoint) endpoint.Endpoint

func SpanContextInjectMW added in v0.0.2

func SpanContextInjectMW(next endpoint.Endpoint) endpoint.Endpoint

Types

This section is empty.

Jump to

Keyboard shortcuts

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