Skip to content

Commit 3dbb994

Browse files
committed
[wip] redistimeseries v1.4 support
1 parent 56292c5 commit 3dbb994

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3115
-63
lines changed

.circleci/config.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Golang CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-go/ for more details
4+
version: 2
5+
jobs:
6+
build: # test with redisearch:latest
7+
docker:
8+
- image: circleci/golang:1.13
9+
10+
working_directory: /go/src/github.com/RedisTimeSeries/tsbs
11+
steps:
12+
- checkout
13+
- run: go get -t -v ./...
14+
- run: GO111MODULE=on go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
15+
- run: bash <(curl -s https://codecov.io/bash) -t ${CODECOV_TOKEN}
16+
17+
build-multiarch-docker:
18+
machine:
19+
enabled: true
20+
steps:
21+
- checkout
22+
- run: |
23+
echo "$DOCKER_REDISBENCH_PWD" | base64 --decode | docker login --username $DOCKER_REDISBENCH_USER --password-stdin
24+
- run:
25+
name: Build
26+
command: |
27+
make docker-release
28+
no_output_timeout: 20m
29+
30+
workflows:
31+
version: 2
32+
build_and_package:
33+
jobs:
34+
- build:
35+
filters:
36+
tags:
37+
only: /.*/
38+
- build-multiarch-docker:
39+
filters:
40+
tags:
41+
only: /.*/
42+
branches:
43+
only: master

.dockerignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# ignore .git and .cache folders
2+
.git
3+
.editorconfig
4+
.gitignore
5+
.dockerignore
6+
.travis.yml
7+
coverage.txt
8+
AUTHORS.md
9+
CONTRIBUTING.md
10+
LICENSE
11+
NOTICE
12+
README.md
13+
14+
*.out
15+
*.log
16+
.DS_Store
17+
.idea
18+
.vscode
19+
**/bin
20+
**/docs
21+
**/scripts
22+
23+
# High Dynamic Range (HDR) Histogram files
24+
*.hdr

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,12 @@
44
.idea
55
.vscode
66

7+
bin
8+
79
# High Dynamic Range (HDR) Histogram files
8-
*.hdr
10+
*.hdr
11+
12+
/docs/responses
13+
coverage.txt
14+
15+
bin/

Makefile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Go parameters
2+
GOCMD=go
3+
GOBUILD=$(GOCMD) build
4+
GOINSTALL=$(GOCMD) install
5+
GOCLEAN=$(GOCMD) clean
6+
GOTEST=$(GOCMD) test
7+
GOGET=$(GOCMD) get
8+
GOMOD=$(GOCMD) mod
9+
GOFMT=$(GOCMD) fmt
10+
11+
# DOCKER
12+
DOCKER_APP_NAME=tsbs
13+
DOCKER_ORG=redisbench
14+
DOCKER_REPO:=${DOCKER_ORG}/${DOCKER_APP_NAME}
15+
DOCKER_IMG:="$(DOCKER_REPO):$(DOCKER_TAG)"
16+
DOCKER_LATEST:="${DOCKER_REPO}:latest"
17+
18+
.PHONY: all generators loaders runners
19+
all: generators loaders runners
20+
21+
generators: tsbs_generate_data tsbs_generate_queries
22+
23+
loaders: tsbs_load_redistimeseries tsbs_load_cassandra tsbs_load_clickhouse tsbs_load_influx tsbs_load_mongo tsbs_load_siridb tsbs_load_timescaledb
24+
25+
runners: tsbs_run_queries_redistimeseries tsbs_run_queries_cassandra tsbs_run_queries_clickhouse tsbs_run_queries_influx tsbs_run_queries_mongo tsbs_run_queries_siridb tsbs_run_queries_timescaledb
26+
27+
test:
28+
GO111MODULE=on $(GOTEST) -v -race -coverprofile=coverage.txt -covermode=atomic ./...
29+
30+
tsbs_%: $(wildcard ./cmd/$@/*.go)
31+
$(GOGET) ./cmd/$@
32+
$(GOBUILD) -o bin/$@ ./cmd/$@
33+
$(GOINSTALL) ./cmd/$@
34+
35+
# DOCKER TASKS
36+
# Build the container
37+
docker-build:
38+
docker build -t $(DOCKER_APP_NAME):latest -f docker/Dockerfile .
39+
40+
# Build the container without caching
41+
docker-build-nc:
42+
docker build --no-cache -t $(DOCKER_APP_NAME):latest -f docker/Dockerfile .
43+
44+
# Make a release by building and publishing the `{version}` ans `latest` tagged containers to ECR
45+
docker-release: docker-build-nc docker-publish
46+
47+
# Docker publish
48+
docker-publish: docker-publish-latest
49+
50+
## login to DockerHub with credentials found in env
51+
docker-repo-login:
52+
docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
53+
54+
## Publish the `latest` tagged container to ECR
55+
docker-publish-latest: docker-tag-latest
56+
@echo 'publish latest to $(DOCKER_REPO)'
57+
docker push $(DOCKER_LATEST)
58+
59+
# Docker tagging
60+
docker-tag: docker-tag-latest
61+
62+
## Generate container `{version}` tag
63+
docker-tag-latest:
64+
@echo 'create tag latest'
65+
docker tag $(DOCKER_APP_NAME) $(DOCKER_LATEST)

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ scripts). The easiest way to get and install the Go programs is to use
108108
$ go get github.com/timescale/tsbs
109109
$ cd $GOPATH/src/github.com/timescale/tsbs/cmd
110110
$ go get ./...
111+
$ git remote add redistimeseries https://github.com/RedisTimeSeries/tsbs.git
112+
$ git fetch
113+
$ git checkout redistimeseries
114+
$ cd $GOPATH/src/github.com/timescale/tsbs
115+
$ make
116+
$ FORMATS="redistimeseries" SCALE=100 SEED=123 TS_END="2016-01-31T00:00:00Z" ./scripts/generate_data.sh
117+
# Benchmark part. in PREFIX add a text that will be prefixed on the output results file
118+
$ NUM_WORKERS=1 BATCH_SIZE=10000 PIPELINE=200 CONNECTIONS=10 PREFIX=1.2.0 ./scripts/load_redistimeseries.sh
111119

112120
# Install desired binaries. At a minimum this includes tsbs_generate_data,
113121
# tsbs_generate_queries, one tsbs_load_* binary, and one tsbs_run_queries_*
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package redistimeseries
2+
3+
import (
4+
"github.com/timescale/tsbs/cmd/tsbs_generate_queries/uses/devops"
5+
"github.com/timescale/tsbs/cmd/tsbs_generate_queries/utils"
6+
"github.com/timescale/tsbs/query"
7+
"time"
8+
)
9+
10+
// BaseGenerator contains settings specific for RedisTimeSeries database.
11+
type BaseGenerator struct {
12+
}
13+
14+
// GenerateEmptyQuery returns an empty query.Cassandra.
15+
func (g *BaseGenerator) GenerateEmptyQuery() query.Query {
16+
return query.NewRedisTimeSeries()
17+
}
18+
19+
// fill Query fills the query struct with data
20+
func (d *BaseGenerator) fillInQueryStrings(qi query.Query, humanLabel, humanDesc string) {
21+
q := qi.(*query.RedisTimeSeries)
22+
q.HumanLabel = []byte(humanLabel)
23+
q.HumanDescription = []byte(humanDesc)
24+
}
25+
26+
// AddQuery adds a command to be executed in the full flow of this Query
27+
func (d *BaseGenerator) AddQuery(qi query.Query, tq [][]byte, commandname []byte) {
28+
q := qi.(*query.RedisTimeSeries)
29+
q.AddQuery(tq, commandname)
30+
}
31+
32+
// SetApplyFunctor sets SetApplyFunctor used for this Query
33+
func (d *BaseGenerator) SetApplyFunctor(qi query.Query, value bool, functor string) {
34+
q := qi.(*query.RedisTimeSeries)
35+
q.SetApplyFunctor(value)
36+
q.SetFunctor(functor)
37+
}
38+
39+
// NewDevops creates a new devops use case query generator.
40+
func (g *BaseGenerator) NewDevops(start, end time.Time, scale int) (utils.QueryGenerator, error) {
41+
core, err := devops.NewCore(start, end, scale)
42+
43+
if err != nil {
44+
return nil, err
45+
}
46+
47+
var devops utils.QueryGenerator = &Devops{
48+
BaseGenerator: g,
49+
Core: core,
50+
}
51+
52+
return devops, nil
53+
}

0 commit comments

Comments
 (0)