This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
Releases: census-ecosystem/opencensus-go-exporter-ocagent
Releases · census-ecosystem/opencensus-go-exporter-ocagent
Release v0.7.1
Release v0.7.0 (Roaring 20s)
Release v0.6.0
Release v0.5.0
TLS for all
Added a new option WithTLSCredentials
which allows ocagent to dial to servers using TLS Credentials.
This feature was requested in #44 and added with PR #45
This provides parity with ocagent's new TLS backed OpenCensus receiver with #45
Example
func Example_withTLS() {
// Please take at look at:
// https://godoc.org/google.golang.org/grpc/credentials#TransportCredentials
// for ways on how to initialize gRPC TransportCredentials.
creds, err := credentials.NewClientTLSFromFile("my-cert.pem", "")
if err != nil {
log.Fatalf("Failed to create gRPC client TLS credentials: %v", err)
}
exp, err := ocagent.NewExporter(ocagent.WithTLSCredentials(creds), ocagent.WithServiceName("engine"))
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(), "Securely-Talking-To-Agent-Span")
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()
}
}
Background redial
No more failing fast, that is:
- The ocagent-exporter will not stop working if an agent isn't yet available. It will automatically
attempt reconnect in the background if the agent is ever taken down, indefinitely.
OpenCensus Agent Go Exporter 0.2.0
First release -- config and trace streaming only
This is the first release of the agent-exporter in Go. It'll require an OpenCensus Agent to have been setup.
The agent-exporter makes a gRPC connection to the OpenCensus Agent, and streams up spans while also receiving trace configurations sent down by the OpenCensus Agent.
By default the agent connects on port 55678 on localhost, however we provide options to connect to different addresses such as ocagent.WithAddress("the address here")
Sample usage
package main
import (
"context"
"fmt"
"log"
"time"
"contrib.go.opencensus.io/exporter/ocagent/v1"
"go.opencensus.io/trace"
)
func main() {
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()
}
}