Skip to content

Commit b5bb25a

Browse files
committed
Review feedback & minor fixups.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
1 parent 39c0b7d commit b5bb25a

File tree

8 files changed

+17
-29
lines changed

8 files changed

+17
-29
lines changed

‎.gitignore

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
cmd/alertmanager/alertmanager
2-
cmd/configs/configs
3-
cmd/distributor/distributor
4-
cmd/ingester/ingester
5-
cmd/querier/querier
6-
cmd/query-frontend/query-frontend
7-
cmd/ruler/ruler
8-
cmd/table-manager/table-manager
9-
cmd/lite/lite
101
cmd/test-exporter/test-exporter
112
cmd/cortex/cortex
12-
cmd/*/.migrations
133
.uptodate
144
.pkg
155
.cache

‎cmd/cortex/main.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,16 @@ func main() {
5252
defer trace.Close()
5353

5454
t, err := cortex.New(cfg)
55-
if err != nil {
56-
level.Error(util.Logger).Log("msg", "error initialising cortex", "err", err)
57-
os.Exit(1)
58-
}
55+
util.CheckFatal("initializing cortex", err)
5956

6057
level.Info(util.Logger).Log("msg", "Starting Cortex", "version", version.Info())
6158

6259
if err := t.Run(); err != nil {
63-
level.Error(util.Logger).Log("msg", "error running loki", "err", err)
60+
level.Error(util.Logger).Log("msg", "error running Cortex", "err", err)
6461
}
6562

66-
if err := t.Stop(); err != nil {
67-
level.Error(util.Logger).Log("msg", "error stopping loki", "err", err)
68-
os.Exit(1)
69-
}
63+
err = t.Stop()
64+
util.CheckFatal("initializing cortex", err)
7065
}
7166

7267
// LoadConfig read YAML-formatted config from filename into cfg.

‎docs/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ See [the architecture doc](architecture.md) For more information about the micro
88

99
Separately from single process vs microservices decision, Cortex can be configured to use local storage or cloud storage (DynamoDB, Bigtable, Cassandra, S3, GCS etc).
1010
This document will focus on using local storage.
11-
Local storage is explicity not production ready at this time.
11+
Local storage is explicitly not production ready at this time.
1212
Cortex can also make use of external memcacheds for caching and although these are not mandatory, they should be used in production.
1313

1414
## Single instance, single process.

‎pkg/chunk/aws/dynamodb_table_client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func TestTableManagerAutoScaling(t *testing.T) {
154154
},
155155
{
156156
IndexType: "aws-dynamo",
157-
From: chunk.DayTime{model.TimeFromUnix(0)},
157+
From: chunk.DayTime{Time: model.TimeFromUnix(0)},
158158
IndexTables: fixturePeriodicTableConfig(tablePrefix),
159159
ChunkTables: fixturePeriodicTableConfig(chunkTablePrefix),
160160
}},

‎pkg/chunk/local/fixtures.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (f *fixture) Clients() (
5151
schemaConfig = chunk.SchemaConfig{
5252
Configs: []chunk.PeriodConfig{{
5353
IndexType: "boltdb",
54-
From: chunk.DayTime{model.Now()},
54+
From: chunk.DayTime{Time: model.Now()},
5555
ChunkTables: chunk.PeriodicTableConfig{
5656
Prefix: "chunks",
5757
Period: 10 * time.Minute,

‎pkg/chunk/storage/factory_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ func TestFactoryStop(t *testing.T) {
2121
flagext.DefaultValues(&cfg, &storeConfig, &schemaConfig, &defaults)
2222
schemaConfig.Configs = []chunk.PeriodConfig{
2323
{
24-
From: chunk.DayTime{model.Time(0)},
24+
From: chunk.DayTime{Time: model.Time(0)},
2525
IndexType: "inmemory",
2626
},
2727
{
28-
From: chunk.DayTime{model.Time(1)},
28+
From: chunk.DayTime{Time: model.Time(1)},
2929
IndexType: "inmemory",
3030
},
3131
}

‎pkg/cortex/cortex.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import (
5050
// - First argument for a components constructor should be its matching config
5151
// object.
5252

53-
// Config is the root config for Loki.
53+
// Config is the root config for Cortex.
5454
type Config struct {
5555
Target moduleName `yaml:"target,omitempty"`
5656
AuthEnabled bool `yaml:"auth_enabled,omitempty"`
@@ -127,7 +127,7 @@ type Cortex struct {
127127
alertmanager *alertmanager.MultitenantAlertmanager
128128
}
129129

130-
// New makes a new Loki.
130+
// New makes a new Cortex.
131131
func New(cfg Config) (*Cortex, error) {
132132
if cfg.PrintConfig {
133133
if err := yaml.NewEncoder(os.Stdout).Encode(&cfg); err != nil {
@@ -155,7 +155,7 @@ func New(cfg Config) (*Cortex, error) {
155155
return nil, err
156156
}
157157

158-
return &cortex, nil
158+
return cortex, nil
159159
}
160160

161161
func (t *Cortex) setupAuthMiddleware(cfg *Config) {
@@ -207,12 +207,12 @@ func (t *Cortex) initModule(cfg *Config, m moduleName) error {
207207
return nil
208208
}
209209

210-
// Run starts Loki running, and blocks until a signal is received.
210+
// Run starts Cortex running, and blocks until a signal is received.
211211
func (t *Cortex) Run() error {
212212
return t.server.Run()
213213
}
214214

215-
// Stop gracefully stops a Loki.
215+
// Stop gracefully stops a Cortex.
216216
func (t *Cortex) Stop() error {
217217
t.server.Shutdown()
218218
t.stop(t.target)

‎pkg/cortex/modules.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ func (t *Cortex) initAlertmanager(cfg *Config) (err error) {
369369
go t.alertmanager.Run()
370370

371371
t.server.HTTP.PathPrefix("/status").Handler(t.alertmanager.GetStatusHandler())
372+
373+
// TODO this clashed with the queirer and the distributor, so we cannot
374+
// run them in the same process.
372375
t.server.HTTP.PathPrefix("/api/prom").Handler(middleware.AuthenticateUser.Wrap(t.alertmanager))
373376
return
374377
}

0 commit comments

Comments
 (0)