Skip to content

Commit

Permalink
Merge pull request #71 from weaveworks/70-refract-your-brain
Browse files Browse the repository at this point in the history
Rename Prism to Cortex
  • Loading branch information
jml committed Oct 25, 2016
2 parents b1fbace + cd9947d commit dda50a5
Show file tree
Hide file tree
Showing 26 changed files with 187 additions and 187 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cmd/prism/prism
cmd/cortex/cortex
.uptodate
.pkg
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ images:
$(info $(IMAGE_NAMES))

# List of exes please
PRISM_EXE := ./cmd/prism/prism
EXES = $(PRISM_EXE)
CORTEX_EXE := ./cmd/cortex/cortex
EXES = $(CORTEX_EXE)

all: $(UPTODATE_FILES)

# And what goes into each exe
$(PRISM_EXE): $(shell find . -name '*.go') $(shell find ui/static ui/templates)
$(CORTEX_EXE): $(shell find . -name '*.go') $(shell find ui/static ui/templates)

# And now what goes into each image
prism-build/$(UPTODATE): prism-build/*
cmd/prism/$(UPTODATE): $(PRISM_EXE)
cortex-build/$(UPTODATE): cortex-build/*
cmd/cortex/$(UPTODATE): $(CORTEX_EXE)

# All the boiler plate for building golang follows:
SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E")
Expand All @@ -53,23 +53,23 @@ NETGO_CHECK = @strings $@ | grep cgo_stub\\\.go >/dev/null || { \

ifeq ($(BUILD_IN_CONTAINER),true)

$(EXES) lint test assets: prism-build/$(UPTODATE)
$(EXES) lint test assets: cortex-build/$(UPTODATE)
@mkdir -p $(shell pwd)/.pkg
$(SUDO) docker run $(RM) -ti \
-v $(shell pwd)/.pkg:/go/pkg \
-v $(shell pwd):/go/src/github.com/weaveworks/prism \
$(IMAGE_PREFIX)/prism-build $@
-v $(shell pwd):/go/src/github.com/weaveworks/cortex \
$(IMAGE_PREFIX)/cortex-build $@

else

$(EXES): prism-build/$(UPTODATE)
$(EXES): cortex-build/$(UPTODATE)
go build $(GO_FLAGS) -o $@ ./$(@D)
$(NETGO_CHECK)

lint: prism-build/$(UPTODATE)
lint: cortex-build/$(UPTODATE)
./tools/lint -notestpackage -ignorespelling queriers -ignorespelling Queriers .

test: prism-build/$(UPTODATE)
test: cortex-build/$(UPTODATE)
./tools/test -no-go-get

# Manual step that needs to be run after making any changes to the web assets
Expand All @@ -78,7 +78,7 @@ test: prism-build/$(UPTODATE)
# TODO(juliusv): Figure out if we can make this an automatic part of the build
# process. It currently produces diffs (source file timestamps are getting
# baked into bindata.go) and those make CI fail.
assets: prism-build/$(UPTODATE)
assets: cortex-build/$(UPTODATE)
go-bindata -pkg ui -o ui/bindata.go -ignore '(.*\.map|bootstrap\.js|bootstrap-theme\.css|bootstrap\.css)' ui/templates/... ui/static/...

endif
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Prism: A multitenant, horizontally scalable Prometheus as a service
# Cortex: A multitenant, horizontally scalable Prometheus as a service

[![Circle CI](https://circleci.com/gh/weaveworks/prism/tree/master.svg?style=shield)](https://circleci.com/gh/weaveworks/prism/tree/master)
[![Circle CI](https://circleci.com/gh/weaveworks/cortex/tree/master.svg?style=shield)](https://circleci.com/gh/weaveworks/cortex/tree/master)
[![Slack Status](https://slack.weave.works/badge.svg)](https://slack.weave.works)

*NB this is a pre-release, pre-alpha service. Availability will not be 100%.
APIs will change. Data will be lost.*

Prism is an API compatible [Prometheus](https://prometheus.io)
Cortex is an API compatible [Prometheus](https://prometheus.io)
implementation, that natively supports multitenancy and scale-out clustering.

Prism is a [Weaveworks](https://weave.works) project that forms a major part
Cortex is a [Weaveworks](https://weave.works) project that forms a major part
of [Weave Cloud](https://cloud.weave.works). If you are interested in using
our hosted Prometheus as a service, please
contact [help@weave.works](mailto:help@weave.works).
Expand Down
6 changes: 3 additions & 3 deletions chunk/chunk_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ import (

var (
memcacheRequests = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: "prism",
Namespace: "cortex",
Name: "memcache_requests_total",
Help: "Total count of chunks requested from memcache.",
})

memcacheHits = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: "prism",
Namespace: "cortex",
Name: "memcache_hits_total",
Help: "Total count of chunks found in memcache.",
})

memcacheRequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: "prism",
Namespace: "cortex",
Name: "memcache_request_duration_seconds",
Help: "Total time spent in seconds doing memcache requests.",
Buckets: []float64{.001, .0025, .005, .01, .025, .05},
Expand Down
12 changes: 6 additions & 6 deletions chunk/chunk_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"github.com/weaveworks/scope/common/instrument"
"golang.org/x/net/context"

"github.com/weaveworks/prism/user"
"github.com/weaveworks/cortex/user"
)

const (
Expand All @@ -51,29 +51,29 @@ const (

var (
dynamoRequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: "prism",
Namespace: "cortex",
Name: "dynamo_request_duration_seconds",
Help: "Time spent doing DynamoDB requests.",
Buckets: []float64{.001, .0025, .005, .01, .025, .05, .1, .25, .5, 1},
}, []string{"operation", "status_code"})
dynamoRequestPages = prometheus.NewHistogram(prometheus.HistogramOpts{
Namespace: "prism",
Namespace: "cortex",
Name: "dynamo_request_pages",
Help: "Number of pages by DynamoDB request",
Buckets: prometheus.ExponentialBuckets(1, 2.0, 5),
})
dynamoConsumedCapacity = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: "prism",
Namespace: "cortex",
Name: "dynamo_consumed_capacity_total",
Help: "The capacity units consumed by operation.",
}, []string{"operation"})
droppedMatches = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: "prism",
Namespace: "cortex",
Name: "dropped_matches_total",
Help: "The number of chunks fetched but later dropped for not matching.",
})
s3RequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: "prism",
Namespace: "cortex",
Name: "s3_request_duration_seconds",
Help: "Time spent doing S3 requests.",
Buckets: []float64{.025, .05, .1, .25, .5, 1, 2},
Expand Down
2 changes: 1 addition & 1 deletion chunk/chunk_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/tomwilkie/go-mockaws"
"golang.org/x/net/context"

"github.com/weaveworks/prism/user"
"github.com/weaveworks/cortex/user"
)

func init() {
Expand Down
4 changes: 2 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ deployment:
branch: master
commands:
- docker login -e "$DOCKER_REGISTRY_EMAIL" -u "$DOCKER_REGISTRY_USER" -p "$DOCKER_REGISTRY_PASSWORD"
- docker push weaveworks/prism:$(./tools/image-tag)
- wcloud deploy -u circle weaveworks/prism:$(./tools/image-tag)
- docker push weaveworks/cortex:$(./tools/image-tag)
- wcloud deploy -u circle weaveworks/cortex:$(./tools/image-tag)
4 changes: 2 additions & 2 deletions cmd/prism/Dockerfile → cmd/cortex/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/prometheus/busybox:latest
COPY prism /bin/prism
COPY cortex /bin/cortex
EXPOSE 9094
ENTRYPOINT [ "/bin/prism" ]
ENTRYPOINT [ "/bin/cortex" ]
40 changes: 20 additions & 20 deletions cmd/prism/main.go → cmd/cortex/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ import (
"github.com/weaveworks/scope/common/middleware"
"golang.org/x/net/context"

"github.com/weaveworks/prism"
"github.com/weaveworks/prism/chunk"
"github.com/weaveworks/prism/ingester"
"github.com/weaveworks/prism/ring"
"github.com/weaveworks/prism/ui"
"github.com/weaveworks/prism/user"
"github.com/weaveworks/cortex"
"github.com/weaveworks/cortex/chunk"
"github.com/weaveworks/cortex/ingester"
"github.com/weaveworks/cortex/ring"
"github.com/weaveworks/cortex/ui"
"github.com/weaveworks/cortex/user"
)

const (
Expand All @@ -49,7 +49,7 @@ const (

var (
requestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: "prism",
Namespace: "cortex",
Name: "request_duration_seconds",
Help: "Time (in seconds) spent serving HTTP requests.",
Buckets: prometheus.DefBuckets,
Expand Down Expand Up @@ -78,7 +78,7 @@ type cfg struct {
numTokens int
logSuccess bool

distributorConfig prism.DistributorConfig
distributorConfig cortex.DistributorConfig
}

func main() {
Expand Down Expand Up @@ -120,8 +120,8 @@ func main() {
case modeDistributor:
ring := ring.New(consul)
cfg.distributorConfig.Ring = ring
cfg.distributorConfig.ClientFactory = func(address string) (*prism.IngesterClient, error) {
return prism.NewIngesterClient(address, cfg.remoteTimeout)
cfg.distributorConfig.ClientFactory = func(address string) (*cortex.IngesterClient, error) {
return cortex.NewIngesterClient(address, cfg.remoteTimeout)
}
defer ring.Stop()
setupDistributor(cfg.distributorConfig, chunkStore, cfg.logSuccess)
Expand Down Expand Up @@ -186,18 +186,18 @@ func setupChunkStore(cfg cfg) (chunk.Store, error) {
}

func setupDistributor(
cfg prism.DistributorConfig,
cfg cortex.DistributorConfig,
chunkStore chunk.Store,
logSuccess bool,
) {
distributor, err := prism.NewDistributor(cfg)
distributor, err := cortex.NewDistributor(cfg)
if err != nil {
log.Fatal(err)
}
prometheus.MustRegister(distributor)

prefix := "/api/prom"
http.Handle(prefix+"/push", instrument(logSuccess, prism.AppenderHandler(distributor)))
http.Handle(prefix+"/push", instrument(logSuccess, cortex.AppenderHandler(distributor)))

// TODO: Move querier to separate binary.
setupQuerier(distributor, chunkStore, prefix, logSuccess)
Expand All @@ -209,15 +209,15 @@ func setupDistributor(
// |
// `----------> ChunkQuerier -> DynamoDB/S3
func setupQuerier(
distributor *prism.Distributor,
distributor *cortex.Distributor,
chunkStore chunk.Store,
prefix string,
logSuccess bool,
) {
querier := prism.MergeQuerier{
Queriers: []prism.Querier{
querier := cortex.MergeQuerier{
Queriers: []cortex.Querier{
distributor,
&prism.ChunkQuerier{
&cortex.ChunkQuerier{
Store: chunkStore,
},
},
Expand Down Expand Up @@ -256,9 +256,9 @@ func setupIngester(
}
prometheus.MustRegister(ingester)

http.Handle("/push", instrument(logSuccess, prism.AppenderHandler(ingester)))
http.Handle("/query", instrument(logSuccess, prism.QueryHandler(ingester)))
http.Handle("/label_values", instrument(logSuccess, prism.LabelValuesHandler(ingester)))
http.Handle("/push", instrument(logSuccess, cortex.AppenderHandler(ingester)))
http.Handle("/query", instrument(logSuccess, cortex.QueryHandler(ingester)))
http.Handle("/label_values", instrument(logSuccess, cortex.LabelValuesHandler(ingester)))
return ingester
}

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion prism-build/build.sh → cortex-build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eu

SRC_PATH=$GOPATH/src/github.com/weaveworks/prism
SRC_PATH=$GOPATH/src/github.com/weaveworks/cortex

# If we run make directly, any files created on the bind mount
# will have awkward ownership. So we switch to a user with the
Expand Down
Loading

0 comments on commit dda50a5

Please sign in to comment.