Skip to content

Commit ccc41fd

Browse files
committed
Move server to common.
1 parent aa15b6b commit ccc41fd

File tree

9 files changed

+85
-69
lines changed

9 files changed

+85
-69
lines changed

cmd/distributor/main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77
"github.com/prometheus/client_golang/prometheus"
88
"github.com/prometheus/common/log"
99

10+
"github.com/weaveworks/common/server"
1011
"github.com/weaveworks/cortex/distributor"
1112
"github.com/weaveworks/cortex/ring"
12-
"github.com/weaveworks/cortex/server"
1313
"github.com/weaveworks/cortex/util"
1414
)
1515

@@ -32,7 +32,9 @@ func main() {
3232
// object.
3333

3434
var (
35-
serverConfig server.Config
35+
serverConfig = server.Config{
36+
MetricsNamespace: "cortex",
37+
}
3638
ringConfig ring.Config
3739
distributorConfig distributor.Config
3840
)
@@ -52,7 +54,8 @@ func main() {
5254
defer dist.Stop()
5355
prometheus.MustRegister(dist)
5456

55-
server := server.New(serverConfig, r)
57+
server := server.New(serverConfig)
58+
server.HTTP.Handle("/ring", r)
5659
server.HTTP.Handle("/api/prom/push", http.HandlerFunc(dist.PushHandler))
5760
defer server.Stop()
5861

cmd/ingester/main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ import (
77
"github.com/prometheus/client_golang/prometheus"
88
"github.com/prometheus/common/log"
99

10+
"github.com/weaveworks/common/server"
1011
"github.com/weaveworks/cortex"
1112
"github.com/weaveworks/cortex/chunk"
1213
"github.com/weaveworks/cortex/ingester"
1314
"github.com/weaveworks/cortex/ring"
14-
"github.com/weaveworks/cortex/server"
1515
"github.com/weaveworks/cortex/util"
1616
)
1717

1818
func main() {
1919
var (
20-
serverConfig server.Config
20+
serverConfig = server.Config{
21+
MetricsNamespace: "cortex",
22+
}
2123
ingesterRegistrationConfig ring.IngesterRegistrationConfig
2224
chunkStoreConfig chunk.StoreConfig
2325
ingesterConfig ingester.Config
@@ -33,7 +35,7 @@ func main() {
3335
}
3436
defer registration.Ring.Stop()
3537

36-
server := server.New(serverConfig, registration.Ring)
38+
server := server.New(serverConfig)
3739
chunkStore, err := chunk.NewStore(chunkStoreConfig)
3840
if err != nil {
3941
log.Fatal(err)
@@ -45,6 +47,7 @@ func main() {
4547
}
4648
prometheus.MustRegister(ingester)
4749
cortex.RegisterIngesterServer(server.GRPC, ingester)
50+
server.HTTP.Handle("/ring", registration.Ring)
4851
server.HTTP.Path("/ready").Handler(http.HandlerFunc(ingester.ReadinessHandler))
4952

5053
// Deferring a func to make ordering obvious

cmd/querier/main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import (
1414
"github.com/prometheus/prometheus/retrieval"
1515
"github.com/prometheus/prometheus/web/api/v1"
1616

17+
"github.com/weaveworks/common/server"
1718
"github.com/weaveworks/common/user"
1819
"github.com/weaveworks/cortex/chunk"
1920
"github.com/weaveworks/cortex/distributor"
2021
"github.com/weaveworks/cortex/querier"
2122
"github.com/weaveworks/cortex/ring"
22-
"github.com/weaveworks/cortex/server"
2323
"github.com/weaveworks/cortex/util"
2424
)
2525

@@ -33,7 +33,9 @@ func (r dummyAlertmanagerRetriever) Alertmanagers() []string { return nil }
3333

3434
func main() {
3535
var (
36-
serverConfig server.Config
36+
serverConfig = server.Config{
37+
MetricsNamespace: "cortex",
38+
}
3739
ringConfig ring.Config
3840
distributorConfig distributor.Config
3941
chunkStoreConfig chunk.StoreConfig
@@ -54,7 +56,8 @@ func main() {
5456
defer dist.Stop()
5557
prometheus.MustRegister(dist)
5658

57-
server := server.New(serverConfig, r)
59+
server := server.New(serverConfig)
60+
server.HTTP.Handle("/ring", r)
5861
defer server.Stop()
5962

6063
chunkStore, err := chunk.NewStore(chunkStoreConfig)

cmd/ruler/main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ import (
66
"github.com/prometheus/client_golang/prometheus"
77
"github.com/prometheus/common/log"
88

9+
"github.com/weaveworks/common/server"
910
"github.com/weaveworks/cortex/chunk"
1011
"github.com/weaveworks/cortex/distributor"
1112
"github.com/weaveworks/cortex/ring"
1213
"github.com/weaveworks/cortex/ruler"
13-
"github.com/weaveworks/cortex/server"
1414
"github.com/weaveworks/cortex/util"
1515
)
1616

1717
func main() {
1818
var (
19-
serverConfig server.Config
19+
serverConfig = server.Config{
20+
MetricsNamespace: "cortex",
21+
}
2022
ringConfig ring.Config
2123
distributorConfig distributor.Config
2224
rulerConfig ruler.Config
@@ -55,7 +57,8 @@ func main() {
5557
}
5658
defer rulerServer.Stop()
5759

58-
server := server.New(serverConfig, r)
60+
server := server.New(serverConfig)
61+
server.HTTP.Handle("/ring", r)
5962
defer server.Stop()
6063
server.Run()
6164
}

cmd/table-manager/main.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,23 @@ import (
55

66
"github.com/prometheus/common/log"
77

8+
"github.com/weaveworks/common/server"
89
"github.com/weaveworks/cortex/chunk"
9-
"github.com/weaveworks/cortex/server"
1010
"github.com/weaveworks/cortex/util"
1111
)
1212

1313
func main() {
1414
var (
15-
serverConfig = server.Config{}
15+
serverConfig = server.Config{
16+
MetricsNamespace: "cortex",
17+
}
1618
tableManagerConfig = chunk.TableManagerConfig{}
1719
)
1820
util.RegisterFlags(&serverConfig, &tableManagerConfig)
1921
flag.Parse()
2022

2123
// Have to initialise server first, as its sets up tracing.
22-
server := server.New(serverConfig, nil)
24+
server := server.New(serverConfig)
2325

2426
tableManager, err := chunk.NewDynamoTableManager(tableManagerConfig)
2527
if err != nil {

vendor/github.com/weaveworks/common/exec/exec.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/server.go renamed to vendor/github.com/weaveworks/common/server/server.go

Lines changed: 47 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/weaveworks/common/test/exec/exec.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/manifest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,8 +869,8 @@
869869
"importpath": "github.com/weaveworks/common",
870870
"repository": "https://github.com/weaveworks/common",
871871
"vcs": "git",
872-
"revision": "ceec9d7f5c36c903ff37d06aaa34fd69621b08d7",
873-
"branch": "master",
872+
"revision": "db1ec394475d75bde9daeb6d221eb8ca75332b21",
873+
"branch": "standard-server",
874874
"notests": true
875875
},
876876
{

0 commit comments

Comments
 (0)