Document tps-reports (#1509)

It's not obvious from the name what the tps-reports API endpoint does.

Added a few comments to clarify.

Signed-off-by: Alex Leong <alex@buoyant.io>
This commit is contained in:
Alex Leong 2018-08-24 13:26:35 -07:00 committed by GitHub
parent 1d3580ba0c
commit 1f42996889
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 2 deletions

View File

@ -288,7 +288,7 @@ class Tap extends React.Component {
pendingRequests: true
});
let url = "/api/tps-reports?resource_type=all&all_namespaces=true";
let url = this.api.urlsForResource("all");
this.api.setCurrentRequests([this.api.fetchMetrics(url)]);
this.serverPromise = Promise.all(this.api.getCurrentPromises())
.then(rsp => {

View File

@ -98,7 +98,7 @@ class Top extends React.Component {
pendingRequests: true
});
let url = "/api/tps-reports?resource_type=all&all_namespaces=true";
let url = this.api.urlsForResource("all");
this.api.setCurrentRequests([this.api.fetchMetrics(url)]);
this.serverPromise = Promise.all(this.api.getCurrentPromises())
.then(rsp => {

View File

@ -97,6 +97,7 @@ const ApiHelpers = (pathPrefix, defaultMetricsWindow = '1m') => {
};
const urlsForResource = (type, namespace) => {
// Traffic Performance Summary. This retrieves stats for the given resource.
let baseUrl = '/api/tps-reports?resource_type=' + type;
return !namespace ? baseUrl + '&all_namespaces=true' : baseUrl + '&namespace=' + namespace;
};

View File

@ -101,6 +101,9 @@ func NewServer(addr, templateDir, staticDir, uuid, controllerNamespace, webpackD
// webapp api routes
server.router.GET("/api/version", handler.handleApiVersion)
// Traffic Performance Summary. This route used to be called /api/stat
// but was renamed to avoid triggering ad blockers.
// See: https://github.com/linkerd/linkerd2/issues/970
server.router.GET("/api/tps-reports", handler.handleApiStat)
server.router.GET("/api/pods", handler.handleApiPods)
server.router.GET("/api/tap", handler.handleApiTap)