Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Tempo to Loki. #36

Merged
merged 2 commits into from
Dec 5, 2018
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
20 changes: 10 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ workflows:
# https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/
defaults: &defaults
docker:
- image: grafana/tempo-build-image:checkin-generated-files-86c363c
working_directory: /go/src/github.com/grafana/tempo
- image: grafana/loki-build-image:rename-49e21d5-WIP
working_directory: /go/src/github.com/grafana/loki

jobs:
test:
Expand All @@ -34,7 +34,7 @@ jobs:
- run:
name: Run Unit Tests
command: |
touch tempo-build-image/.uptodate &&
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false test

lint:
Expand All @@ -45,13 +45,13 @@ jobs:
- run:
name: Lint
command: |
touch tempo-build-image/.uptodate &&
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false lint

- run:
name: Check Generated Fies
command: |
touch tempo-build-image/.uptodate &&
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false check-generated-files

build:
Expand All @@ -63,17 +63,17 @@ jobs:
- run:
name: Build Images
command: |
touch tempo-build-image/.uptodate &&
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false

- run:
name: Save Images
command: |
touch tempo-build-image/.uptodate &&
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false save-images

- save_cache:
key: v1-tempo-{{ .Branch }}-{{ .Revision }}
key: v1-loki-{{ .Branch }}-{{ .Revision }}
paths:
- images/

Expand All @@ -84,12 +84,12 @@ jobs:
- setup_remote_docker

- restore_cache:
key: v1-tempo-{{ .Branch }}-{{ .Revision }}
key: v1-loki-{{ .Branch }}-{{ .Revision }}

- run:
name: Load Images
command: |
touch tempo-build-image/.uptodate &&
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false load-images

- run:
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.cache
*.output
mixin/vendor/
cmd/tempo/tempo
cmd/loki/loki
cmd/promtail/promtail
/tempo
/loki
/promtail
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ IMAGE_TAG := $(shell ./tools/image-tag)
UPTODATE := .uptodate

# Building Docker images is now automated. The convention is every directory
# with a Dockerfile in it builds an image calls quay.io/grafana/tempo-<dirname>.
# with a Dockerfile in it builds an image calls quay.io/grafana/loki-<dirname>.
# Dependencies (i.e. things that go in the image) still need to be explicitly
# declared.
%/$(UPTODATE): %/Dockerfile
Expand All @@ -17,7 +17,7 @@ UPTODATE := .uptodate
touch $@

# We don't want find to scan inside a bunch of directories, to accelerate the
# 'make: Entering directory '/go/src/github.com/grafana/tempo' phase.
# 'make: Entering directory '/go/src/github.com/grafana/loki' phase.
DONT_FIND := -name tools -prune -o -name vendor -prune -o -name .git -prune -o -name .cache -prune -o -name .pkg -prune -o

# Get a list of directories containing Dockerfiles
Expand Down Expand Up @@ -62,7 +62,7 @@ protos: $(PROTO_GOS)
yacc: $(YACC_GOS)

# And now what goes into each image
tempo-build-image/$(UPTODATE): tempo-build-image/*
loki-build-image/$(UPTODATE): loki-build-image/*

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

ifeq ($(BUILD_IN_CONTAINER),true)

$(EXES) $(PROTO_GOS) $(YACC_GOS) lint test shell check-generated-files: tempo-build-image/$(UPTODATE)
$(EXES) $(PROTO_GOS) $(YACC_GOS) lint test shell check-generated-files: loki-build-image/$(UPTODATE)
@mkdir -p $(shell pwd)/.pkg
@mkdir -p $(shell pwd)/.cache
$(SUDO) docker run $(RM) $(TTY) -i \
-v $(shell pwd)/.cache:/go/cache \
-v $(shell pwd)/.pkg:/go/pkg \
-v $(shell pwd):/go/src/github.com/grafana/tempo \
$(IMAGE_PREFIX)tempo-build-image $@;
-v $(shell pwd):/go/src/github.com/grafana/loki \
$(IMAGE_PREFIX)loki-build-image $@;

else

$(EXES): tempo-build-image/$(UPTODATE)
$(EXES): loki-build-image/$(UPTODATE)
go build $(GO_FLAGS) -o $@ ./$(@D)
$(NETGO_CHECK)

%.pb.go: tempo-build-image/$(UPTODATE)
%.pb.go: loki-build-image/$(UPTODATE)
case "$@" in \
vendor*) \
protoc -I ./vendor:./$(@D) --gogoslick_out=plugins=grpc:./vendor ./$(patsubst %.pb.go,%.proto,$@); \
Expand All @@ -115,16 +115,16 @@ $(EXES): tempo-build-image/$(UPTODATE)
%.go: %.y
goyacc -p $(basename $(notdir $<)) -o $@ $<

lint: tempo-build-image/$(UPTODATE)
lint: loki-build-image/$(UPTODATE)
gometalinter ./...

check-generated-files: tempo-build-image/$(UPTODATE) yacc protos
check-generated-files: loki-build-image/$(UPTODATE) yacc protos
@git diff-files || (echo "changed files; failing check" && exit 1)

test: tempo-build-image/$(UPTODATE)
test: loki-build-image/$(UPTODATE)
go test ./...

shell: tempo-build-image/$(UPTODATE)
shell: loki-build-image/$(UPTODATE)
bash

endif
Expand Down Expand Up @@ -157,5 +157,5 @@ push-images:

clean:
$(SUDO) docker rmi $(IMAGE_NAMES) >/dev/null 2>&1 || true
rm -rf $(UPTODATE_FILES) $(EXES) $(PROTO_GOS) $(YACC_GOS) .cache
rm -rf $(UPTODATE_FILES) $(EXES) .cache
go clean ./...
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Tempo: Like Prometheus, but for logs.
# Loki: Like Prometheus, but for logs.

[![CircleCI](https://circleci.com/gh/grafana/tempo/tree/master.svg?style=svg&circle-token=618193e5787b2951c1ea3352ad5f254f4f52313d)](https://circleci.com/gh/grafana/tempo/tree/master) [Design doc](https://docs.google.com/document/d/11tjK_lvp1-SVsFZjgOTr1vV3-q6vBAsZYIQ5ZeYBkyM/edit)
[![CircleCI](https://circleci.com/gh/grafana/loki/tree/master.svg?style=svg&circle-token=618193e5787b2951c1ea3352ad5f254f4f52313d)](https://circleci.com/gh/grafana/loki/tree/master) [Design doc](https://docs.google.com/document/d/11tjK_lvp1-SVsFZjgOTr1vV3-q6vBAsZYIQ5ZeYBkyM/edit)

Tempo is a horizontally-scalable, highly-available, multi-tenant, log aggregation
Loki is a horizontally-scalable, highly-available, multi-tenant, log aggregation
system inspired by Prometheus. It is designed to be very cost effective, as it does
not index the contents of the logs, but rather a set of labels for each log stream.

## Run it locally

Tempo can be run in a single host, no-dependencies mode using the following commands.
Loki can be run in a single host, no-dependencies mode using the following commands.

Tempo consists of 3 components; `tempo` is the main server, responsible for storing
Loki consists of 3 components; `loki` is the main server, responsible for storing
logs and processing queries. `promtail` is the agent, responsible for gather logs
and sending them to tempo and `grafana` as the UI.
and sending them to loki and `grafana` as the UI.

To run tempo, use the following commands:
To run loki, use the following commands:

```
$ go build ./cmd/tempo
$ ./tempo -config.file=./docs/tempo-local-config.yaml
$ go build ./cmd/loki
$ ./loki -config.file=./docs/loki-local-config.yaml
...
```

Expand All @@ -30,7 +30,7 @@ $ ./promtail -config.file=./docs/promtail-local-config.yaml
...
```

Grafana is Tempo's UI, so you'll also want to run one of those:
Grafana is Loki's UI, so you'll also want to run one of those:

```
$ docker run -ti -p 3000:3000 -e "GF_EXPLORE_ENABLED=true" grafana/grafana-dev:master-377eaa891c1eefdec9c83a2ee4dcf5c81665ab1f
Expand All @@ -40,12 +40,12 @@ In the Grafana UI (http://localhost:3000), loging with "admin"/"admin", add a ne

## Usage Instructions

Tempo is running in the ops-tools1 cluster. You can query logs from that cluster
Loki is running in the ops-tools1 cluster. You can query logs from that cluster
using the following commands:

```
$ go get github.com/grafana/tempo/cmd/logcli
$ . $GOPATH/src/github.com/grafana/tempo/env # env vars inc. URL, username etc
$ go get github.com/grafana/loki/cmd/logcli
$ . $GOPATH/src/github.com/grafana/loki/env # env vars inc. URL, username etc
$ logcli labels job
https://logs-dev-ops-tools1.grafana.net/api/prom/label/job/values
cortex-ops/consul
Expand All @@ -58,14 +58,14 @@ Common labels: {job="cortex-ops/consul", namespace="cortex-ops"}
2018-06-25T12:52:09Z {instance="consul-8576459955-pl75w"} 2018/06/25 12:52:09 [INFO] raft: Compacting logs from 456973 to 465169
```

The `logcli` command is temporary until we have Grafana integration. The URLs of
The `logcli` command is lokirary until we have Grafana integration. The URLs of
the requests are printed to help with integration work.

```
$ logcli help
usage: logcli [<flags>] <command> [<args> ...]

A command-line for tempo.
A command-line for loki.

Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
Expand Down
2 changes: 1 addition & 1 deletion cmd/logcli/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/url"
"time"

"github.com/grafana/tempo/pkg/logproto"
"github.com/grafana/loki/pkg/logproto"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion cmd/logcli/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/grafana/tempo/pkg/logproto"
"github.com/grafana/loki/pkg/logproto"
)

func doLabels() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/logcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

var (
app = kingpin.New("logcli", "A command-line for tempo.")
app = kingpin.New("logcli", "A command-line for loki.")
addr = app.Flag("addr", "Server address.").Default("https://log-us.grafana.net").Envar("GRAFANA_ADDR").String()
username = app.Flag("username", "Username for HTTP basic auth.").Default("").Envar("GRAFANA_USERNAME").String()
password = app.Flag("password", "Password for HTTP basic auth.").Default("").Envar("GRAFANA_PASSWORD").String()
Expand Down
6 changes: 3 additions & 3 deletions cmd/logcli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/fatih/color"
"github.com/prometheus/prometheus/pkg/labels"

"github.com/grafana/tempo/pkg/iter"
"github.com/grafana/tempo/pkg/logproto"
"github.com/grafana/tempo/pkg/parser"
"github.com/grafana/loki/pkg/iter"
"github.com/grafana/loki/pkg/logproto"
"github.com/grafana/loki/pkg/parser"
)

func doQuery() {
Expand Down
4 changes: 2 additions & 2 deletions cmd/logcli/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"time"

"github.com/grafana/tempo/pkg/iter"
"github.com/grafana/tempo/pkg/logproto"
"github.com/grafana/loki/pkg/iter"
"github.com/grafana/loki/pkg/logproto"
)

const tailIteratorIncrement = 10 * time.Second
Expand Down
4 changes: 4 additions & 0 deletions cmd/loki/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM alpine:3.4
COPY loki /bin/loki
EXPOSE 80
ENTRYPOINT [ "/bin/loki" ]
14 changes: 7 additions & 7 deletions cmd/tempo/main.go → cmd/loki/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
"os"

"github.com/go-kit/kit/log/level"
"github.com/grafana/tempo/pkg/helpers"
"github.com/grafana/tempo/pkg/tempo"
"github.com/grafana/loki/pkg/helpers"
"github.com/grafana/loki/pkg/loki"

"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/flagext"
)

func main() {
var (
cfg tempo.Config
cfg loki.Config
configFile = ""
)
flag.StringVar(&configFile, "config.file", "", "Configuration file to load.")
Expand All @@ -30,18 +30,18 @@ func main() {
}
}

t, err := tempo.New(cfg)
t, err := loki.New(cfg)
if err != nil {
level.Error(util.Logger).Log("msg", "error initialising tempo", "err", err)
level.Error(util.Logger).Log("msg", "error initialising loki", "err", err)
os.Exit(1)
}

if err := t.Run(); err != nil {
level.Error(util.Logger).Log("msg", "error running tempo", "err", err)
level.Error(util.Logger).Log("msg", "error running loki", "err", err)
}

if err := t.Stop(); err != nil {
level.Error(util.Logger).Log("msg", "error stopping tempo", "err", err)
level.Error(util.Logger).Log("msg", "error stopping loki", "err", err)
os.Exit(1)
}
}
8 changes: 4 additions & 4 deletions cmd/promtail/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/flagext"

"github.com/grafana/tempo/pkg/helpers"
"github.com/grafana/tempo/pkg/promtail"
"github.com/grafana/loki/pkg/helpers"
"github.com/grafana/loki/pkg/promtail"
)

func main() {
Expand All @@ -33,12 +33,12 @@ func main() {

p, err := promtail.New(config)
if err != nil {
level.Error(util.Logger).Log("msg", "error creating tempo", "error", err)
level.Error(util.Logger).Log("msg", "error creating loki", "error", err)
os.Exit(1)
}

if err := p.Run(); err != nil {
level.Error(util.Logger).Log("msg", "error starting tempo", "error", err)
level.Error(util.Logger).Log("msg", "error starting loki", "error", err)
os.Exit(1)
}

Expand Down
4 changes: 0 additions & 4 deletions cmd/tempo/Dockerfile

This file was deleted.

File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tempo-build-image/build.sh → loki-build-image/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/grafana/tempo
SRC_PATH=$GOPATH/src/github.com/grafana/loki

# 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