jaeger

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package jaeger contains an OpenCensus tracing exporter for Jaeger.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

type Exporter struct {
	// contains filtered or unexported fields
}

Exporter is an implementation of trace.Exporter that uploads spans to Jaeger.

func NewExporter

func NewExporter(o Options) (*Exporter, error)

NewExporter returns a trace.Exporter implementation that exports the collected spans to Jaeger.

Example (Agent)
package main

import (
	"log"

	"go.opencensus.io/exporter/jaeger"
	"go.opencensus.io/trace"
)

func main() {
	// Register the Jaeger exporter to be able to retrieve
	// the collected spans.
	exporter, err := jaeger.NewExporter(jaeger.Options{
		AgentEndpoint: "localhost:6831",
		ServiceName:   "trace-demo",
	})
	if err != nil {
		log.Fatal(err)
	}
	trace.RegisterExporter(exporter)
}
Output:

Example (Collector)
package main

import (
	"log"

	"go.opencensus.io/exporter/jaeger"
	"go.opencensus.io/trace"
)

func main() {
	// Register the Jaeger exporter to be able to retrieve
	// the collected spans.
	exporter, err := jaeger.NewExporter(jaeger.Options{
		Endpoint:    "http://localhost:14268",
		ServiceName: "trace-demo",
	})
	if err != nil {
		log.Fatal(err)
	}
	trace.RegisterExporter(exporter)
}
Output:

func (*Exporter) ExportSpan

func (e *Exporter) ExportSpan(data *trace.SpanData)

ExportSpan exports a SpanData to Jaeger.

func (*Exporter) Flush

func (e *Exporter) Flush()

Flush waits for exported trace spans to be uploaded.

This is useful if your program is ending and you do not want to lose recent spans.

type Options

type Options struct {
	// Endpoint is the Jaeger HTTP Thrift endpoint.
	// For example, http://localhost:14268.
	Endpoint string

	// AgentEndpoint instructs exporter to send spans to jaeger-agent at this address.
	// For example, localhost:6831.
	AgentEndpoint string

	// OnError is the hook to be called when there is
	// an error occurred when uploading the stats data.
	// If no custom hook is set, errors are logged.
	// Optional.
	OnError func(err error)

	// Username to be used if basic auth is required.
	// Optional.
	Username string

	// Password to be used if basic auth is required.
	// Optional.
	Password string

	// ServiceName is the Jaeger service name.
	ServiceName string
}

Options are the options to be used when initializing a Jaeger exporter.

Directories

Path Synopsis
Command jaeger is an example program that creates spans and uploads to Jaeger.
Command jaeger is an example program that creates spans and uploads to Jaeger.
internal

Jump to

Keyboard shortcuts

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