mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 22:19: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) {
|
||||
req, err := remote.DecodeMinimizedWriteRequest(r.Body)
|
||||
req, err := remote.DecodeMinimizedWriteRequestStr(r.Body)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
|
@ -70,17 +70,12 @@ func main() {
|
|||
|
||||
for labelIdx < len(ts.LabelSymbols) {
|
||||
// todo, check for overflow?
|
||||
offset := ts.LabelSymbols[labelIdx]
|
||||
nameIdx := ts.LabelSymbols[labelIdx]
|
||||
labelIdx++
|
||||
length := ts.LabelSymbols[labelIdx]
|
||||
valueIdx := ts.LabelSymbols[labelIdx]
|
||||
labelIdx++
|
||||
name := req.Symbols[offset : offset+length]
|
||||
// todo, check for overflow?
|
||||
offset = ts.LabelSymbols[labelIdx]
|
||||
labelIdx++
|
||||
length = ts.LabelSymbols[labelIdx]
|
||||
labelIdx++
|
||||
value := req.Symbols[offset : offset+length]
|
||||
name := req.Symbols[nameIdx]
|
||||
value := req.Symbols[valueIdx]
|
||||
m[model.LabelName(name)] = model.LabelValue(value)
|
||||
}
|
||||
fmt.Println(m)
|
||||
|
|
Loading…
Reference in a new issue