forked from mirror/client_golang
Merge pull request #195 from prometheus/badlabel
Remove anti-pattern of having target labels in instrumentation example.
This commit is contained in:
commit
90c15b5efa
|
@ -14,7 +14,6 @@
|
||||||
package prometheus_test
|
package prometheus_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -48,16 +47,12 @@ func ExampleGauge() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleGaugeVec() {
|
func ExampleGaugeVec() {
|
||||||
binaryVersion := flag.String("binary_version", "debug", "Version of the binary: debug, canary, production.")
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
opsQueued := prometheus.NewGaugeVec(
|
opsQueued := prometheus.NewGaugeVec(
|
||||||
prometheus.GaugeOpts{
|
prometheus.GaugeOpts{
|
||||||
Namespace: "our_company",
|
Namespace: "our_company",
|
||||||
Subsystem: "blob_storage",
|
Subsystem: "blob_storage",
|
||||||
Name: "ops_queued",
|
Name: "ops_queued",
|
||||||
Help: "Number of blob storage operations waiting to be processed, partitioned by user and type.",
|
Help: "Number of blob storage operations waiting to be processed, partitioned by user and type.",
|
||||||
ConstLabels: prometheus.Labels{"binary_version": *binaryVersion},
|
|
||||||
},
|
},
|
||||||
[]string{
|
[]string{
|
||||||
// Which user has requested the operation?
|
// Which user has requested the operation?
|
||||||
|
@ -125,14 +120,10 @@ func ExampleCounter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleCounterVec() {
|
func ExampleCounterVec() {
|
||||||
binaryVersion := flag.String("environment", "test", "Execution environment: test, staging, production.")
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
httpReqs := prometheus.NewCounterVec(
|
httpReqs := prometheus.NewCounterVec(
|
||||||
prometheus.CounterOpts{
|
prometheus.CounterOpts{
|
||||||
Name: "http_requests_total",
|
Name: "http_requests_total",
|
||||||
Help: "How many HTTP requests processed, partitioned by status code and HTTP method.",
|
Help: "How many HTTP requests processed, partitioned by status code and HTTP method.",
|
||||||
ConstLabels: prometheus.Labels{"env": *binaryVersion},
|
|
||||||
},
|
},
|
||||||
[]string{"code", "method"},
|
[]string{"code", "method"},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue