Skip to content

Commit 57f0fd1

Browse files
author
Herve Rousseau
committed
prometheus: expose "build_info" gauge
1 parent 3687181 commit 57f0fd1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

dnscrypt-proxy/monitoring_ui.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"html"
88
"net"
99
"net/http"
10+
"runtime"
1011
"sort"
1112
"strings"
1213
"sync"
@@ -473,6 +474,14 @@ func (mc *MetricsCollector) generatePrometheusMetrics() string {
473474
var result strings.Builder
474475

475476
// Write help and type information for each metric
477+
result.WriteString("# HELP dnscrypt_proxy_build_info A metric with a constant '1' value labeled by version, goversion from which dnscrypt_proxy was built, and the goos and goarch for the build.\n")
478+
result.WriteString("# TYPE dnscrypt_proxy_build_info gauge\n")
479+
result.WriteString(fmt.Sprintf("dnscrypt_proxy_build_info{goarch=\"%s\" goos=\"%s\" goversion=\"%s\" version=\"%s\"} 1\n", runtime.GOARCH, runtime.GOOS, runtime.Version(), AppVersion))
480+
481+
result.WriteString("# HELP dnscrypt_proxy_queries_total Total number of DNS queries processed\n")
482+
result.WriteString("# TYPE dnscrypt_proxy_queries_total counter\n")
483+
result.WriteString(fmt.Sprintf("dnscrypt_proxy_queries_total %d\n", totalQueries))
484+
476485
result.WriteString("# HELP dnscrypt_proxy_queries_total Total number of DNS queries processed\n")
477486
result.WriteString("# TYPE dnscrypt_proxy_queries_total counter\n")
478487
result.WriteString(fmt.Sprintf("dnscrypt_proxy_queries_total %d\n", totalQueries))

0 commit comments

Comments
 (0)