Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/prometheus/common/route"
"github.com/prometheus/common/version"
"github.com/prometheus/prometheus/pkg/labels"
"golang.org/x/net/context"

"github.com/prometheus/alertmanager/config"
"github.com/prometheus/alertmanager/dispatch"
Expand Down Expand Up @@ -83,17 +82,14 @@ type API struct {

groups groupsFn

// context is an indirection for testing.
context func(r *http.Request) context.Context
mtx sync.RWMutex
mtx sync.RWMutex
}

type groupsFn func([]*labels.Matcher) dispatch.AlertOverview

// New returns a new API.
func New(alerts provider.Alerts, silences *silence.Silences, gf groupsFn, router *mesh.Router) *API {
return &API{
context: route.Context,
alerts: alerts,
silences: silences,
groups: gf,
Expand Down Expand Up @@ -412,7 +408,7 @@ func (api *API) addSilence(w http.ResponseWriter, r *http.Request) {
}

func (api *API) getSilence(w http.ResponseWriter, r *http.Request) {
sid := route.Param(api.context(r), "sid")
sid := route.Param(r.Context(), "sid")

sils, err := api.silences.Query(silence.QIDs(sid))
if err != nil || len(sils) == 0 {
Expand All @@ -432,7 +428,7 @@ func (api *API) getSilence(w http.ResponseWriter, r *http.Request) {
}

func (api *API) delSilence(w http.ResponseWriter, r *http.Request) {
sid := route.Param(api.context(r), "sid")
sid := route.Param(r.Context(), "sid")

if err := api.silences.Expire(sid); err != nil {
respondError(w, apiError{
Expand Down
2 changes: 1 addition & 1 deletion cmd/alertmanager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func main() {
os.Exit(1)
}

router := route.New(nil)
router := route.New()

webReload := make(chan struct{})
ui.Register(router.WithPrefix(amURL.Path), webReload)
Expand Down
4 changes: 2 additions & 2 deletions ui/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ func Register(r *route.Router, reloadCh chan<- struct{}) {

r.Get("/app/*filepath", ihf("app_files",
func(w http.ResponseWriter, req *http.Request) {
fp := route.Param(route.Context(req), "filepath")
fp := route.Param(req.Context(), "filepath")
serveAsset(w, req, filepath.Join("ui/app", fp))
},
))
r.Get("/lib/*filepath", ihf("lib_files",
func(w http.ResponseWriter, req *http.Request) {
fp := route.Param(route.Context(req), "filepath")
fp := route.Param(req.Context(), "filepath")
serveAsset(w, req, filepath.Join("ui/lib", fp))
},
))
Expand Down
47 changes: 32 additions & 15 deletions vendor/github.com/prometheus/common/expfmt/decode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions vendor/github.com/prometheus/common/expfmt/expfmt.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions vendor/github.com/prometheus/common/log/syslog_formatter.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 6 additions & 43 deletions vendor/github.com/prometheus/common/route/route.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,40 +221,40 @@
"revisionTime": "2016-11-21T14:22:35Z"
},
{
"checksumSHA1": "mHyjbJ3BWOfUV6q9f5PBt0gaY1k=",
"checksumSHA1": "Wtpzndm/+bdwwNU5PCTfb4oUhc8=",
"path": "github.com/prometheus/common/expfmt",
"revision": "0d5de9d6d8629cb8bee6d4674da4127cd8b615a3",
"revisionTime": "2016-11-14T13:47:43Z"
"revision": "9e0844febd9e2856f839c9cb974fbd676d1755a8",
"revisionTime": "2017-04-18T15:52:10Z"
},
{
"checksumSHA1": "GWlM3d2vPYyNATtTFgftS10/A9w=",
"path": "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg",
"revision": "0d5de9d6d8629cb8bee6d4674da4127cd8b615a3",
"revisionTime": "2016-11-14T13:47:43Z"
"revision": "9e0844febd9e2856f839c9cb974fbd676d1755a8",
"revisionTime": "2017-04-18T15:52:10Z"
},
{
"checksumSHA1": "UU6hIfhVjnAYDADQEfE/3T7Ddm8=",
"checksumSHA1": "ZA4MLHNAP905WiAOLy4BBzmcuxM=",
"path": "github.com/prometheus/common/log",
"revision": "0d5de9d6d8629cb8bee6d4674da4127cd8b615a3",
"revisionTime": "2016-11-14T13:47:43Z"
"revision": "9e0844febd9e2856f839c9cb974fbd676d1755a8",
"revisionTime": "2017-04-18T15:52:10Z"
},
{
"checksumSHA1": "0LL9u9tfv1KPBjNEiMDP6q7lpog=",
"path": "github.com/prometheus/common/model",
"revision": "49fee292b27bfff7f354ee0f64e1bc4850462edf",
"revisionTime": "2017-02-20T10:38:46Z"
"revision": "9e0844febd9e2856f839c9cb974fbd676d1755a8",
"revisionTime": "2017-04-18T15:52:10Z"
},
{
"checksumSHA1": "QQKJYoGcY10nIHxhBEHwjwUZQzk=",
"checksumSHA1": "9aDxDuzZt1l7FQJ9qpn2kPcF7NU=",
"path": "github.com/prometheus/common/route",
"revision": "0d5de9d6d8629cb8bee6d4674da4127cd8b615a3",
"revisionTime": "2016-11-14T13:47:43Z"
"revision": "9e0844febd9e2856f839c9cb974fbd676d1755a8",
"revisionTime": "2017-04-18T15:52:10Z"
},
{
"checksumSHA1": "91KYK0SpvkaMJJA2+BcxbVnyRO0=",
"path": "github.com/prometheus/common/version",
"revision": "0d5de9d6d8629cb8bee6d4674da4127cd8b615a3",
"revisionTime": "2016-11-14T13:47:43Z"
"revision": "9e0844febd9e2856f839c9cb974fbd676d1755a8",
"revisionTime": "2017-04-18T15:52:10Z"
},
{
"checksumSHA1": "gc+7liWFv9C7S5kS2l7qLajiWdc=",
Expand Down