mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-28 06:59:40 -08:00
fix server example
Signed-off-by: Nicolás Pazos <npazosmendez@gmail.com>
This commit is contained in:
parent
66f93860ce
commit
d61fda90f2
|
@ -58,7 +58,7 @@ func main() {
|
||||||
})
|
})
|
||||||
|
|
||||||
http.HandleFunc("/receiveMinimized", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/receiveMinimized", func(w http.ResponseWriter, r *http.Request) {
|
||||||
req, err := remote.DecodeMinimizedWriteRequest(r.Body)
|
req, err := remote.DecodeMinimizedWriteRequestStr(r.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
|
@ -70,17 +70,12 @@ func main() {
|
||||||
|
|
||||||
for labelIdx < len(ts.LabelSymbols) {
|
for labelIdx < len(ts.LabelSymbols) {
|
||||||
// todo, check for overflow?
|
// todo, check for overflow?
|
||||||
offset := ts.LabelSymbols[labelIdx]
|
nameIdx := ts.LabelSymbols[labelIdx]
|
||||||
labelIdx++
|
labelIdx++
|
||||||
length := ts.LabelSymbols[labelIdx]
|
valueIdx := ts.LabelSymbols[labelIdx]
|
||||||
labelIdx++
|
labelIdx++
|
||||||
name := req.Symbols[offset : offset+length]
|
name := req.Symbols[nameIdx]
|
||||||
// todo, check for overflow?
|
value := req.Symbols[valueIdx]
|
||||||
offset = ts.LabelSymbols[labelIdx]
|
|
||||||
labelIdx++
|
|
||||||
length = ts.LabelSymbols[labelIdx]
|
|
||||||
labelIdx++
|
|
||||||
value := req.Symbols[offset : offset+length]
|
|
||||||
m[model.LabelName(name)] = model.LabelValue(value)
|
m[model.LabelName(name)] = model.LabelValue(value)
|
||||||
}
|
}
|
||||||
fmt.Println(m)
|
fmt.Println(m)
|
||||||
|
|
Loading…
Reference in a new issue