tracing

package
v1.0.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2017 License: MIT Imports: 7 Imported by: 0

README

Tracing Package

The tracing package provides an API wrapper around the tracing library Jaeger. This package can be used to set up application-level instrumentation and report timing data. Jaeger can be configured with an optional logger that logs errors/spans and a stats reporter for emitting metrics. Using UberFx modules sets up Jaeger tracing by default. If you decide to use the tracing package standalone, read on for an example on how to initialize the tracer.

Sample usage

package main

import (
  "go.uber.org/fx/tracing"

  "github.com/uber-go/tally"
  "github.com/uber/jaeger-client-go/config"
  "go.uber.org/zap"
)

func main() {
  tracer, closer, err := tracing.InitGlobalTracer(
    &config.Configuration{},
    "service-name",
    zap.L(),
    tally.NoopScope,
  )
  if err != nil {
    logger.Fatal("Error initializing tracer", "error", err)
  }
  defer closer.Close()
  // Refer to the jaeger doc on how to use the tracer
}

Documentation

Overview

Package tracing is the Tracing Package.

The tracing package provides an API wrapper around the tracing library Jaeger (https://github.com/uber/jaeger-client-go). This package can be used to set up application-level instrumentation and report timing data. Jaeger can be configured with an optional logger that logs errors/spans and a stats reporter for emitting metrics. Using UberFx modules sets up Jaeger tracing by default. If you decide to use the tracing package standalone, read on for an example on how to initialize the tracer.

Sample usage

package main

import (
  "go.uber.org/fx/tracing"

  "github.com/uber-go/tally"
  "github.com/uber/jaeger-client-go/config"
  "go.uber.org/zap"
)

func main() {
  tracer, closer, err := tracing.InitGlobalTracer(
    &config.Configuration{},
    "service-name",
    zap.L(),
    tally.NoopScope,
  )
  if err != nil {
    logger.Fatal("Error initializing tracer", "error", err)
  }
  defer closer.Close()
  // Refer to the jaeger doc on how to use the tracer
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTracer

func CreateTracer(
	cfg *config.Configuration,
	serviceName string,
	logger *zap.Logger,
	scope tally.Scope,
) (opentracing.Tracer, io.Closer, error)

CreateTracer creates a tracer

func InitGlobalTracer

func InitGlobalTracer(
	cfg *config.Configuration,
	serviceName string,
	logger *zap.Logger,
	scope tally.Scope,
) (opentracing.Tracer, io.Closer, error)

InitGlobalTracer instantiates a new global tracer

Types

This section is empty.

Jump to

Keyboard shortcuts

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