From 6b475fc32b9c02c7a67c41d4f5809194d9676c20 Mon Sep 17 00:00:00 2001 From: Mads Hartmann Date: Sat, 20 Jul 2019 03:05:51 +0200 Subject: [PATCH] Add support for specifying service name in config (#602) * Add support for specifying service name in config The datadog exporter will currently drop the service name which is specified in the spans. See https://github.com/census-instrumentation/opencensus-service/issues/198 for more information. This aligns the datadog exporter with jaeger, wavefront, and zipkin. They already have this option. A better solution would be to add support for multiple services, as many of the other exporters have, but that is a bit over the level of contribution I can do at the moment. * Fix typo in comment --- exporter/datadogexporter/datadog.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exporter/datadogexporter/datadog.go b/exporter/datadogexporter/datadog.go index e2c20ea8..a7fa755d 100644 --- a/exporter/datadogexporter/datadog.go +++ b/exporter/datadogexporter/datadog.go @@ -23,6 +23,9 @@ import ( ) type datadogConfig struct { + // ServiceName specifies the service name used for tracing. + ServiceName string `mapstructure:"service_name,omitempty"` + // Namespace specifies the namespaces to which metric keys are appended. Namespace string `mapstructure:"namespace,omitempty"` @@ -61,6 +64,7 @@ func DatadogTraceExportersFromViper(v *viper.Viper) (tps []consumer.TraceConsume // TODO(jbd): Create new exporter for each service name. de := datadog.NewExporter(datadog.Options{ + Service: dc.ServiceName, Namespace: dc.Namespace, TraceAddr: dc.TraceAddr, StatsAddr: dc.MetricsAddr,