You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prometheus/vendor/contrib.go.opencensus.io/exporter/ocagent
Julius Volz b5c833ca21
Update go.mod dependencies before release (#5883)
5 years ago
..
.gitignore Update go.mod dependencies before release (#5883) 5 years ago
.travis.yml Update dependencies. (#5449) 6 years ago
CONTRIBUTING.md Use the latest versions of azure go sdk and go-autorest (#5015) 6 years ago
LICENSE Use the latest versions of azure go sdk and go-autorest (#5015) 6 years ago
README.md Use the latest versions of azure go sdk and go-autorest (#5015) 6 years ago
common.go Use the latest versions of azure go sdk and go-autorest (#5015) 6 years ago
connection.go Update go.mod dependencies before release (#5883) 5 years ago
go.mod Update go.mod dependencies before release (#5883) 5 years ago
go.sum Update go.mod dependencies before release (#5883) 5 years ago
nodeinfo.go Use the latest versions of azure go sdk and go-autorest (#5015) 6 years ago
ocagent.go Update go.mod dependencies before release (#5883) 5 years ago
options.go Update go.mod dependencies before release (#5883) 5 years ago
transform_spans.go Use the latest versions of azure go sdk and go-autorest (#5015) 6 years ago
transform_stats_to_metrics.go Update dependencies. (#5449) 6 years ago
version.go Use the latest versions of azure go sdk and go-autorest (#5015) 6 years ago

README.md

OpenCensus Agent Go Exporter

Build Status GoDoc

This repository contains the Go implementation of the OpenCensus Agent (OC-Agent) Exporter. OC-Agent is a deamon process running in a VM that can retrieve spans/stats/metrics from OpenCensus Library, export them to other backends and possibly push configurations back to Library. See more details on OC-Agent Readme.

Note: This is an experimental repository and is likely to get backwards-incompatible changes. Ultimately we may want to move the OC-Agent Go Exporter to OpenCensus Go core library.

Installation

$ go get -u contrib.go.opencensus.io/exporter/ocagent

Usage

import (
	"context"
	"fmt"
	"log"
	"time"

	"contrib.go.opencensus.io/exporter/ocagent"
	"go.opencensus.io/trace"
)

func Example() {
	exp, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithServiceName("your-service-name"))
	if err != nil {
		log.Fatalf("Failed to create the agent exporter: %v", err)
	}
	defer exp.Stop()

	// Now register it as a trace exporter.
	trace.RegisterExporter(exp)

	// Then use the OpenCensus tracing library, like we normally would.
	ctx, span := trace.StartSpan(context.Background(), "AgentExporter-Example")
	defer span.End()

	for i := 0; i < 10; i++ {
		_, iSpan := trace.StartSpan(ctx, fmt.Sprintf("Sample-%d", i))
		<-time.After(6 * time.Millisecond)
		iSpan.End()
	}
}