Skip to content

Commit

Permalink
Rule component: Adding new API end point for rules and alerts in (#851)
Browse files Browse the repository at this point in the history
* Adding new API end point for rules and alerts

* reusing methods in query api

* Adding unitest for rule API (similar to prometheus rule/alert API end point unitest)

* Adding SetCORS

* Removing comments

* Related to issue #850
  • Loading branch information
davtsur authored and bwplotka committed Mar 4, 2019
1 parent ca759be commit 55aaf76
Show file tree
Hide file tree
Showing 6 changed files with 510 additions and 70 deletions.
5 changes: 3 additions & 2 deletions benchmark/cmd/thanosbench/resources.go
Expand Up @@ -12,6 +12,7 @@ import (
prom "github.com/prometheus/prometheus/config"
"gopkg.in/yaml.v2"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -207,7 +208,7 @@ func createPrometheus(opts *opts, name string, bucket string) *appsv1.StatefulSe
Name: name,
Namespace: promNamespace,
Labels: map[string]string{
"app": name,
"app": name,
"thanos-gossip-member": "true",
},
}
Expand Down Expand Up @@ -370,7 +371,7 @@ func createThanosQuery(opts *opts) (*v1.Service, *v1.Pod) {
Name: "thanos-query",
Namespace: thanosNamespace,
Labels: map[string]string{
"app": "thanos-query",
"app": "thanos-query",
"thanos-gossip-member": "true",
},
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/thanos/rule.go
Expand Up @@ -10,6 +10,7 @@ import (
"net/url"
"os"
"os/signal"
"path"
"path/filepath"
"sort"
"strconv"
Expand All @@ -29,6 +30,7 @@ import (
"github.com/improbable-eng/thanos/pkg/extprom"
"github.com/improbable-eng/thanos/pkg/objstore/client"
"github.com/improbable-eng/thanos/pkg/promclient"
"github.com/improbable-eng/thanos/pkg/rule/api"
"github.com/improbable-eng/thanos/pkg/runutil"
"github.com/improbable-eng/thanos/pkg/shipper"
"github.com/improbable-eng/thanos/pkg/store"
Expand Down Expand Up @@ -565,6 +567,9 @@ func runRule(

ui.NewRuleUI(logger, mgr, alertQueryURL.String(), flagsMap).Register(router.WithPrefix(webRoutePrefix))

api := v1.NewAPI(logger, mgr)
api.Register(router.WithPrefix(path.Join(webRoutePrefix, "/api/v1")), tracer, logger)

mux := http.NewServeMux()
registerMetrics(mux, reg)
registerProfile(mux)
Expand Down

0 comments on commit 55aaf76

Please sign in to comment.