mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 17:51:21 +00:00
Add metric counting report publish attempts and errors
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/armon/go-metrics"
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/hashicorp/go-cleanhttp"
|
||||
log "github.com/sirupsen/logrus"
|
||||
@@ -299,6 +300,10 @@ func (c *appClient) publish(r io.Reader) error {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
metrics.IncrCounterWithLabels([]string{"publishes"}, 1, []metrics.Label{
|
||||
{Name: "destination", Value: req.Host},
|
||||
{Name: "status", Value: fmt.Sprint(resp.StatusCode)},
|
||||
})
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
text, _ := ioutil.ReadAll(resp.Body)
|
||||
return fmt.Errorf(resp.Status + ": " + string(text))
|
||||
|
||||
Reference in New Issue
Block a user