(http://fleegix.org)",license:"Apache-2.0",main:"./lib/ejs.js",repository:{type:"git",url:"git://github.com/mde/ejs.git"},bugs:"https://github.com/mde/ejs/issues",homepage:"https://github.com/mde/ejs",dependencies:{},devDependencies:{browserify:"^13.1.1",eslint:"^4.14.0","git-directory-deploy":"^1.5.1",jake:"^10.3.1",jsdoc:"^3.4.0","lru-cache":"^4.0.1",mocha:"^5.0.5","uglify-js":"^3.3.16"},engines:{node:">=0.10.0"},scripts:{test:"mocha",postinstall:"node --harmony ./postinstall.js"}}},{}]},{},[1])(1)});
diff --git a/cmd/agent/gui/views/private/js/javascript.js b/cmd/agent/gui/views/private/js/javascript.js
index 66d800a586e34e..d8c6c9eb25ed65 100644
--- a/cmd/agent/gui/views/private/js/javascript.js
+++ b/cmd/agent/gui/views/private/js/javascript.js
@@ -124,7 +124,7 @@ function checkStatus() {
if (checkStatus.uptime > last_ts) {
$("#restart_status").hide()
}
- checkStatus.uptime = last_ts
+ checkStatus.uptime = last_ts
},function() {
$("#agent_status").html("Not connected
to Agent");
$("#agent_status").css({
@@ -153,28 +153,6 @@ function loadStatus(page) {
sendMessage("agent/status/" + page, "", "post",
function(data, status, xhr){
$("#" + page + "_status").html(DOMPurify.sanitize(data));
-
- // Get the trace-agent status
- sendMessage("agent/getConfig/apm_config.receiver_port", "", "GET",
- function(data, status, xhr) {
- var apmPort = data["apm_config.debug.port"];
- if (apmPort == null) {
- apmPort = "5012";
- }
- var url = "http://127.0.0.1:"+apmPort+"/debug/vars"
- $.ajax({
- url: url,
- type: "GET",
- success: function(data) {
- $("#apmStats > .stat_data").html(ejs.render(apmTemplate, data));
- },
- error: function() {
- $("#apmStats > .stat_data").text("Status: Not running or not on localhost.");
- }
- })
- }, function() {
- $("#apmStats > .stat_data").html("Could not obtain trace-agent port from API.");
- })
},function(){
$("#" + page + "_status").html("An error occurred.");
});
diff --git a/cmd/agent/gui/views/templates/generalStatus.tmpl b/cmd/agent/gui/views/templates/generalStatus.tmpl
index fd993865c4cdc1..d60bcc18466cd7 100644
--- a/cmd/agent/gui/views/templates/generalStatus.tmpl
+++ b/cmd/agent/gui/views/templates/generalStatus.tmpl
@@ -478,9 +478,61 @@
-
+
APM
- Loading...
+
+ {{- with .apmStats -}}
+ {{- if .error }}
+ Not running or unreachable on localhost:{{.port}}
+ Error: {{.error}}
+ {{- else}}
+ Status: Running
+ Pid: {{.pid}}
+ Uptime: {{.uptime}} seconds
+ Mem alloc: {{humanize .memstats.Alloc}} bytes
+ Hostname: {{.config.Hostname}}
+ Receiver: {{.config.ReceiverHost}}:{{.config.ReceiverPort}}
+ Endpoints:
+
+ {{- range $i, $e := .config.Endpoints}}
+ {{ $e.Host }}
+ {{- end }}
+
+ Receiver (previous minute)
+
+ {{- if eq (len .receiver) 0}}
+ No traces received in the previous minute.
+ {{ else }}
+ {{ range $i, $ts := .receiver }}
+ From {{if $ts.Lang}}{{ $ts.Lang }} {{ $ts.LangVersion }} ({{ $ts.Interpreter }}), client {{ $ts.TracerVersion }}{{else}}unknown clients{{end}}
+
+ Traces received: {{ $ts.TracesReceived }} ({{ humanize $ts.TracesBytes }} bytes)
+ Spans received: {{ $ts.SpansReceived }}
+ {{ with $ts.WarnString }}
+
WARNING: {{ . }}
+ {{ end }}
+
+ {{ end }}
+ {{ end }}
+
+ {{range $key, $value := .ratebyservice_filtered -}}
+ {{- if eq $key "service:,env:" -}}
+ Default priority sampling rate: {{percent $value}}%
+ {{- else}}
+ Priority sampling rate for '{{ $key }}': {{percent $value}}%
+ {{- end}}
+ {{- end }}
+
+ Writer (previous minute)
+
+ Traces: {{.trace_writer.Payloads}} payloads, {{.trace_writer.Traces}} traces, {{.trace_writer.Events}} events, {{humanize .trace_writer.Bytes}} bytes
+ {{- if gt .trace_writer.Errors 0.0}}WARNING: Traces API errors (1 min): {{.trace_writer.Errors}}{{end}}
+ Stats: {{.stats_writer.Payloads}} payloads, {{.stats_writer.StatsBuckets}} stats buckets, {{humanize .stats_writer.Bytes}} bytes
+ {{- if gt .stats_writer.Errors 0.0}}WARNING: Stats API errors (1 min): {{.stats_writer.Errors}}{{end}}
+
+ {{- end }}
+ {{ end }}
+
@@ -532,7 +584,8 @@
{{- end }}
{{ end }}
-
+
+
diff --git a/cmd/agent/gui/views/templates/index.tmpl b/cmd/agent/gui/views/templates/index.tmpl
index 78723c4b4e7b4e..daed6e5788e092 100644
--- a/cmd/agent/gui/views/templates/index.tmpl
+++ b/cmd/agent/gui/views/templates/index.tmpl
@@ -8,7 +8,6 @@
-
diff --git a/pkg/status/apm/apm.go b/pkg/status/apm/apm.go
index dce29195b5abf8..e5576ded127930 100644
--- a/pkg/status/apm/apm.go
+++ b/pkg/status/apm/apm.go
@@ -24,7 +24,7 @@ var (
clientInitOnce sync.Once
)
-func getHTTPClient() *http.Client {
+func client() *http.Client {
clientInitOnce.Do(func() {
httpClient = apiutil.GetClient(false)
})
@@ -38,9 +38,9 @@ func getHTTPClient() *http.Client {
func GetAPMStatus() map[string]interface{} {
port := config.Datadog.GetInt("apm_config.debug.port")
- client := getHTTPClient()
+ c := client()
url := fmt.Sprintf("http://localhost:%d/debug/vars", port)
- resp, err := apiutil.DoGet(client, url, apiutil.CloseConnection)
+ resp, err := apiutil.DoGet(c, url, apiutil.CloseConnection)
if err != nil {
return map[string]interface{}{
"port": port,