• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..25-Jul-2019-

.travis.ymlH A D25-Jul-2019857 1914

CONTRIBUTING.mdH A D25-Jul-2019984 2517

LICENSEH A D25-Jul-201911.1 KiB202169

README.mdH A D25-Jul-20192 KiB6246

common.goH A D25-Jul-20191.2 KiB3918

connection.goH A D25-Jul-20192.5 KiB9856

go.modH A D25-Jul-2019385 119

go.sumH A D25-Jul-201912.5 KiB131130

nodeinfo.goH A D25-Jul-20191.5 KiB4724

ocagent.goH A D25-Jul-201913.1 KiB497379

options.goH A D25-Jul-20194 KiB12965

transform_spans.goH A D25-Jul-20196.8 KiB249197

transform_stats_to_metrics.goH A D25-Jul-20197.5 KiB275197

version.goH A D25-Jul-2019638 182

README.md

1# OpenCensus Agent Go Exporter
2
3[![Build Status][travis-image]][travis-url] [![GoDoc][godoc-image]][godoc-url]
4
5
6This repository contains the Go implementation of the OpenCensus Agent (OC-Agent) Exporter.
7OC-Agent is a deamon process running in a VM that can retrieve spans/stats/metrics from
8OpenCensus Library, export them to other backends and possibly push configurations back to
9Library. See more details on [OC-Agent Readme][OCAgentReadme].
10
11Note: This is an experimental repository and is likely to get backwards-incompatible changes.
12Ultimately we may want to move the OC-Agent Go Exporter to [OpenCensus Go core library][OpenCensusGo].
13
14## Installation
15
16```bash
17$ go get -u contrib.go.opencensus.io/exporter/ocagent
18```
19
20## Usage
21
22```go
23import (
24	"context"
25	"fmt"
26	"log"
27	"time"
28
29	"contrib.go.opencensus.io/exporter/ocagent"
30	"go.opencensus.io/trace"
31)
32
33func Example() {
34	exp, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithServiceName("your-service-name"))
35	if err != nil {
36		log.Fatalf("Failed to create the agent exporter: %v", err)
37	}
38	defer exp.Stop()
39
40	// Now register it as a trace exporter.
41	trace.RegisterExporter(exp)
42
43	// Then use the OpenCensus tracing library, like we normally would.
44	ctx, span := trace.StartSpan(context.Background(), "AgentExporter-Example")
45	defer span.End()
46
47	for i := 0; i < 10; i++ {
48		_, iSpan := trace.StartSpan(ctx, fmt.Sprintf("Sample-%d", i))
49		<-time.After(6 * time.Millisecond)
50		iSpan.End()
51	}
52}
53```
54
55[OCAgentReadme]: https://github.com/census-instrumentation/opencensus-proto/tree/master/opencensus/proto/agent#opencensus-agent-proto
56[OpenCensusGo]: https://github.com/census-instrumentation/opencensus-go
57[godoc-image]: https://godoc.org/contrib.go.opencensus.io/exporter/ocagent?status.svg
58[godoc-url]: https://godoc.org/contrib.go.opencensus.io/exporter/ocagent
59[travis-image]: https://travis-ci.org/census-ecosystem/opencensus-go-exporter-ocagent.svg?branch=master
60[travis-url]: https://travis-ci.org/census-ecosystem/opencensus-go-exporter-ocagent
61
62