zipkin

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

README

Summary

github.com/micro/go-plugins is very huge, and contains a log of package dependency. This repository is only a zipkin opentracing wapper for go-micro project, so the usage of this module is more simple and lightweight.

Usage

package main

import (
	"github.com/micro/go-micro"
	"github.com/x-punch/micro-zipkin"
)

func main() {
	zipkin.SetGlobalTracer("test.srv", ":80", "https://zipkin/api/v1/spans")
	service := micro.NewService(micro.WrapHandler(zipkin.NewHandlerWrapper()))
	service.Init(micro.Name("test.srv"), micro.Address(":80"))
	if err := service.Run(); err != nil {
		panic("Failed to run service: " + err.Error())
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandlerWrapper

func NewHandlerWrapper() server.HandlerWrapper

NewHandlerWrapper accepts an opentracing Tracer and returns a Handler Wrapper

func SetGlobalTracer

func SetGlobalTracer(serviceName string, serviceAddress string, zipkinURL string) error

SetGlobalTracer sets the [singleton] opentracing.Tracer returned by GlobalTracer(). Those who use GlobalTracer (rather than directly manage an opentracing.Tracer instance) should call SetGlobalTracer as early as possible in main(), prior to calling the `StartSpan` global func below. Prior to calling `SetGlobalTracer`, any Spans started via the `StartSpan` (etc) globals are noops.

func StartSpanFromContext

func StartSpanFromContext(ctx context.Context, name string, opts ...opentracing.StartSpanOption) (context.Context, opentracing.Span, error)

StartSpanFromContext returns a new span with the given operation name and options. If a span is found in the context, it will be used as the parent of the resulting span.

Types

This section is empty.

Jump to

Keyboard shortcuts

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