From 0ff0787797a88012a3421c8a96c3f35c4a7b9105 Mon Sep 17 00:00:00 2001
From: Nikolay <nik@victoriametrics.com>
Date: Tue, 15 Dec 2020 15:20:51 +0300
Subject: [PATCH] adds custom apiPathLinks for victoria-metrics / api help
 (#968)

* adds custom apiPathLinks for victoria-metrics / api help

* adds custom paths for PMM
---
 app/victoria-metrics/main.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/app/victoria-metrics/main.go b/app/victoria-metrics/main.go
index 517c10aea7..a5881a7222 100644
--- a/app/victoria-metrics/main.go
+++ b/app/victoria-metrics/main.go
@@ -32,6 +32,12 @@ var (
 		"Unknown config entries are allowed in -promscrape.config by default. This can be changed with -promscrape.config.strictParse")
 )
 
+// custom api help links [["/api","doc"]] without http.pathPrefix.
+var customAPIPathList = [][]string{
+	{"/graph/explore", "explore metrics grafana page"},
+	{"/graph/d/prometheus-advanced/advanced-data-exploration", "PMM grafana dashboard"},
+}
+
 func main() {
 	// Write flags and help message to stdout, since it is easier to grep or pipe.
 	flag.CommandLine.SetOutput(os.Stdout)
@@ -114,4 +120,8 @@ func writeAPIHelp(w io.Writer, pathList [][]string) {
 		p = path.Join(pathPrefix, p)
 		fmt.Fprintf(w, "<a href='%s'>%q</a> - %s<br/>", p, p, doc)
 	}
+	for _, p := range customAPIPathList {
+		p, doc := p[0], p[1]
+		fmt.Fprintf(w, "<a href='%s'>%q</a> - %s<br/>", p, p, doc)
+	}
 }