go.opencensus.io: go.opencensus.io/exporter/jaeger Index | Examples | Files | Directories

package jaeger

import "go.opencensus.io/exporter/jaeger"

Package jaeger contains an OpenCensus tracing exporter for Jaeger.

Index

Examples

Package Files

agent.go jaeger.go

type Exporter Uses

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

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

func NewExporter Uses

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

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

Code:

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

Code:

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

ExampleNewExporter_processTags shows how to set ProcessTags on a Jaeger exporter. These tags will be added to the exported Jaeger process.

Code:

// Register the Jaeger exporter to be able to retrieve
// the collected spans.
exporter, err := jaeger.NewExporter(jaeger.Options{
    AgentEndpoint: "localhost:6831",
    Process: jaeger.Process{
        ServiceName: "trace-demo",
        Tags: []jaeger.Tag{
            jaeger.StringTag("ip", "127.0.0.1"),
            jaeger.BoolTag("demo", true),
        },
    },
})
if err != nil {
    log.Fatal(err)
}
trace.RegisterExporter(exporter)

func (*Exporter) ExportSpan Uses

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

ExportSpan exports a SpanData to Jaeger.

func (*Exporter) Flush Uses

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 Uses

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

    // CollectorEndpoint is the full url to the Jaeger HTTP Thrift collector.
    // For example, http://localhost:14268/api/traces
    CollectorEndpoint 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.
    // Deprecated: Specify Process instead.
    ServiceName string

    // Process contains the information about the exporting process.
    Process Process

    //BufferMaxCount defines the total number of traces that can be buffered in memory
    BufferMaxCount int
}

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

type Process Uses

type Process struct {
    // ServiceName is the Jaeger service name.
    ServiceName string

    // Tags are added to Jaeger Process exports
    Tags []Tag
}

Process contains the information exported to jaeger about the source of the trace data.

type Tag Uses

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

Tag defines a key-value pair It is limited to the possible conversions to *jaeger.Tag by attributeToTag

func BoolTag Uses

func BoolTag(key string, value bool) Tag

BoolTag creates a new tag of type bool, exported as jaeger.TagType_BOOL

func Int64Tag Uses

func Int64Tag(key string, value int64) Tag

Int64Tag creates a new tag of type int64, exported as jaeger.TagType_LONG

func StringTag Uses

func StringTag(key string, value string) Tag

StringTag creates a new tag of type string, exported as jaeger.TagType_STRING

Directories

PathSynopsis
exampleCommand jaeger is an example program that creates spans and uploads to Jaeger.
internal/gen-go/jaeger
internal/gen-go/jaeger/collector-remote

Package jaeger imports 13 packages (graph) and is imported by 24 packages. Updated 2019-04-02. Refresh now. Tools for package owners.