Datadog Opentracing support - part 2

This commit is part 2 of 2, adding configuration of the
Datadog Opentracing module to the controller.

Fixes half of #3752
This commit is contained in:
Alan J Castonguay 2019-02-15 15:20:10 -05:00
parent b72dfa99d8
commit a29c27ed4c
6 changed files with 59 additions and 3 deletions

View file

@ -943,6 +943,13 @@ const jaegerTmpl = `{
}
}`
const datadogTmpl = `{
"service": "{{ .DatadogServiceName }}",
"agent_host": "{{ .DatadogCollectorHost }}",
"agent_port": {{ .DatadogCollectorPort }},
"operation_name_override": "{{ .DatadogOperationNameOverride }}"
}`
func createOpentracingCfg(cfg ngx_config.Configuration) error {
var tmpl *template.Template
var err error
@ -957,6 +964,11 @@ func createOpentracingCfg(cfg ngx_config.Configuration) error {
if err != nil {
return err
}
} else if cfg.DatadogCollectorHost != "" {
tmpl, err = template.New("datadog").Parse(datadogTmpl)
if err != nil {
return err
}
} else {
tmpl, _ = template.New("empty").Parse("{}")
}