Add datadog environment as a configuration option

(cherry picked from commit 4306558baa595606cd6befff08c8c815d6fe2bd4)
This commit is contained in:
Aditya Purandare 2020-10-01 14:42:22 -07:00
parent 4061ef375d
commit 57b10f5693
No known key found for this signature in database
GPG key ID: 664EAB008736E55B
4 changed files with 16 additions and 2 deletions

View file

@ -584,6 +584,10 @@ type Configuration struct {
// Default: 8126
DatadogCollectorPort int `json:"datadog-collector-port"`
// DatadogEnvironment specifies the environment this trace belongs to.
// Default: prod
DatadogEnvironment string `json:"datadog-environment"`
// DatadogServiceName specifies the service name to use for any traces created
// Default: nginx
DatadogServiceName string `json:"datadog-service-name"`
@ -823,6 +827,7 @@ func NewDefault() Configuration {
JaegerSamplerPort: 5778,
JaegerSamplerHost: "http://127.0.0.1",
DatadogServiceName: "nginx",
DatadogEnvironment: "prod",
DatadogCollectorPort: 8126,
DatadogOperationNameOverride: "nginx.handle",
DatadogSampleRate: 1.0,

View file

@ -1046,6 +1046,7 @@ const datadogTmpl = `{
"service": "{{ .DatadogServiceName }}",
"agent_host": "{{ .DatadogCollectorHost }}",
"agent_port": {{ .DatadogCollectorPort }},
"environment": "{{ .DatadogEnvironment }}",
"operation_name_override": "{{ .DatadogOperationNameOverride }}",
"sample_rate": {{ .DatadogSampleRate }},
"dd.priority.sampling": {{ .DatadogPrioritySampling }}