Datadog (Stats and Tracing)
Introduction
Datadog is a real-time monitoring system that supports distributed tracing and monitoring.
Its OpenCensus Go exporter is available at https://godoc.org/github.com/DataDog/opencensus-go-exporter-datadog
Creating the exporter
To create the exporter, we’ll need: * Datadog credentials which you can get from Here * Create an exporter in code
This is possible by importing the exporter
import "github.com/DataDog/opencensus-go-exporter-datadog"
// then create the actual exporter
dd := datadog.NewExporter(datadog.Options{})
and then to add stats, tracing and then collectively
package main
import (
"log"
"github.com/DataDog/opencensus-go-exporter-datadog"
"go.opencensus.io/stats/view"
)
func main() {
dd, err := datadog.NewExporter(datadog.Options{})
if err != nil {
log.Fatalf("Failed to create the Datadog exporter: %v", err)
}
// It is imperative to invoke flush before your main function exits
defer dd.Stop()
// Register it as a metrics exporter
view.RegisterExporter(dd)
}
package main
import (
"log"
"github.com/DataDog/opencensus-go-exporter-datadog"
"go.opencensus.io/trace"
)
func main() {
dd, err := datadog.NewExporter(datadog.Options{})
if err != nil {
log.Fatalf("Failed to create the Datadog exporter: %v", err)
}
// It is imperative to invoke flush before your main function exits
defer dd.Stop()
// Register it as a metrics exporter
trace.RegisterExporter(dd)
// Allow Datadog to calculate APM metrics and do the sampling.
trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()})
}
package main
import (
"log"
"github.com/DataDog/opencensus-go-exporter-datadog"
"go.opencensus.io/stats/view"
"go.opencensus.io/trace"
)
func main() {
dd, err := datadog.NewExporter(datadog.Options{})
if err != nil {
log.Fatalf("Failed to create the Datadog exporter: %v", err)
}
// It is imperative to invoke flush before your main function exits
defer dd.Stop()
// Register it as a metrics exporter
view.RegisterExporter(dd)
// Register it as a metrics exporter
trace.RegisterExporter(dd)
// Allow Datadog to calculate APM metrics and do the sampling.
trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()})
}
Viewing your metrics
Please visit https://docs.datadoghq.com/graphing/
Viewing your traces
Please visit https://docs.datadoghq.com/tracing/