From 044a5b4e14ca616681e52f7becf28fe831798dd7 Mon Sep 17 00:00:00 2001 From: "Matt T. Proud" Date: Wed, 28 Nov 2012 22:58:14 +0100 Subject: [PATCH] Add nascent Travis CI configuration. --- .travis.yml | 9 ++ CONTRIBUTORS.md | 2 +- Makefile.TRAVIS | 144 ++++++++++++++++++++++++++++++ model/generated/.gitignore | 1 + storage/metric/interface.go | 1 - storage/metric/leveldb/leveldb.go | 22 ++--- 6 files changed, 167 insertions(+), 12 deletions(-) create mode 100644 .travis.yml create mode 100644 Makefile.TRAVIS create mode 100644 model/generated/.gitignore diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..394b3d8d7 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: go + +before_script: +- gvm install go1.0.3 || true +- gvm use go1.0.3 || true + +script: + - make -f Makefile.TRAVIS + diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 0130405a5..fc5cbd19c 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,3 +1,3 @@ -= Prometheus Team +# Prometheus Team - Julius Volz - Matt T. Proud diff --git a/Makefile.TRAVIS b/Makefile.TRAVIS new file mode 100644 index 000000000..91de6b8f8 --- /dev/null +++ b/Makefile.TRAVIS @@ -0,0 +1,144 @@ +# Copyright 2012 Prometheus Team +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +OVERLAY_ROOT := ${HOME}/overlay_root + +export PATH := $(PATH):$(OVERLAY_ROOT)/bin +export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):$(OVERLAY_ROOT)/lib +export CFLAGS := $(CFLAGS) -I$(OVERLAY_ROOT)/include +export CXXFLAGS := $(CXXFLAGS) -I$(OVERLAY_ROOT)/include +export CPPFLAGS := $(CPPFLAGS) -I$(OVERLAY_ROOT)/include +export LDFLAGS := $(LDFLAGS) -L$(OVERLAY_ROOT)/lib +export CGO_CFLAGS := $(CFLAGS) +export CGO_LDFLAGS := $(LDFLAGS) + +GO_GET := go get -v -x +APT_GET_INSTALL := sudo apt-get install -y +WGET := wget -c + +all: test + +preparation: preparation-stamp + +preparation-stamp: build-dependencies + touch $@ + +build-dependencies: build-dependencies-stamp + +build-dependencies-stamp: bison cc mercurial protoc goprotobuf go leveldb levigo gorest + touch $@ + +bison: bison-stamp + +bison-stamp: + [ -x "$$(which bison)" ] || $(APT_GET_INSTALL) bison + +cc: cc-stamp + +cc-stamp: + [ -x "$$(which cc)" ] || $(APT_GET_INSTALL) build-essential + touch $@ + +go: go-stamp + +go-stamp: bison + gvm install go1.0.3 || true + gvm use go1.0.3 || true + [ -x "$$(which go)" ] + touch $@ + +mercurial: mercurial-stamp + +mercurial-stamp: + [ -x "$$(which hg)" ] || $(APT_GET_INSTALL) mercurial + touch $@ + +wget: wget-stamp + +wget-stamp: + [ -x "$$(which wget)" ] || $(APT_GET_INSTALL) wget + touch $@ + +protobuf-2.4.1.tar.bz2: wget + $(WGET) http://protobuf.googlecode.com/files/$@ + +protoc: protoc-stamp + +protoc-stamp: cc protobuf-2.4.1.tar.bz2 + ([ ! -x "$$(which protoc)" ] && tar xjvf protobuf-2.4.1.tar.bz2) || true + ([ ! -x "$$(which protoc)" ] && cd protobuf-2.4.1 && ./configure --prefix="$(OVERLAY_ROOT)") || true + ([ ! -x "$$(which protoc)" ] && $(MAKE) -C protobuf-2.4.1) || true + ([ ! -x "$$(which protoc)" ] && $(MAKE) -C protobuf-2.4.1 install) || true + [ -x "$$(which protoc)" ] + touch $@ + +goprotobuf: goprotobuf-stamp + +goprotobuf-stamp: go protoc source + $(GO_GET) code.google.com/p/goprotobuf/proto + $(GO_GET) code.google.com/p/goprotobuf/protoc-gen-go + touch $@ + +leveldb: leveldb-stamp + +leveldb-stamp: cc rsync leveldb-1.7.0.tar.gz + tar xzvf leveldb-1.7.0.tar.gz + $(MAKE) -C leveldb-1.7.0 + rsync -av "leveldb-1.7.0/include/" "$(OVERLAY_ROOT)/include/" + rsync -av "leveldb-1.7.0/"*.so* "$(OVERLAY_ROOT)/lib/" + touch $@ + +leveldb-1.7.0.tar.gz: wget + $(WGET) http://leveldb.googlecode.com/files/leveldb-1.7.0.tar.gz + +levigo: levigo-stamp + +levigo-stamp: leveldb go source + $(GO_GET) github.com/jmhodges/levigo + touch $@ + +rsync: rsync-stamp + +rsync-stamp: + [ -x "$$(which rsync)" ] || $(APT_GET_INSTALL) rsync + +test: test-stamp + +test-stamp: preparation source + cd ${GOPATH}/src/github.com/matttproud + $(MAKE) test + touch $@ + +source: source-stamp + +source-stamp: + -mkdir -vp ${GOPATH}/src/github.com/matttproud + ln -sf $${PWD} ${GOPATH}/src/github.com/matttproud/prometheus + touch $@ + + +gorest: gorest-stamp + +gorest-stamp: go source + $(GO_GET) code.google.com/p/gorest + touch $@ + +clean: + -rm *-stamp + -rm protobuf-2.4.1.tar.bz2 + -rm -rf "$(OVERLAY_ROOT)" + -rm -rf leveldb-1.7.0 + -rm -rf protobuf-2.4.1 + + +.PHONY: all preparation build-dependencies mercurial clean cc wget protoc goprotobuf bison go leveldb rsync levigo test gorest source diff --git a/model/generated/.gitignore b/model/generated/.gitignore new file mode 100644 index 000000000..e796b66a8 --- /dev/null +++ b/model/generated/.gitignore @@ -0,0 +1 @@ +*.go diff --git a/storage/metric/interface.go b/storage/metric/interface.go index 39b950553..495fb70ed 100644 --- a/storage/metric/interface.go +++ b/storage/metric/interface.go @@ -29,6 +29,5 @@ type MetricPersistence interface { GetMetricFingerprintsForLabelPairs(labelSets []*model.LabelPairs) ([]*model.Fingerprint, error) GetFingerprintLabelPairs(fingerprint model.Fingerprint) (model.LabelPairs, error) - RecordLabelNameFingerprint(sample *model.Sample) error RecordFingerprintWatermark(sample *model.Sample) error } diff --git a/storage/metric/leveldb/leveldb.go b/storage/metric/leveldb/leveldb.go index 38aba87cc..d0f5080e7 100644 --- a/storage/metric/leveldb/leveldb.go +++ b/storage/metric/leveldb/leveldb.go @@ -539,27 +539,19 @@ func (l *LevelDBMetricPersistence) GetLabelPairs() ([]model.LabelPairs, error) { } func (l *LevelDBMetricPersistence) GetMetrics() ([]model.LabelPairs, error) { - log.Printf("GetMetrics()\n") - if getAll, getAllError := l.labelPairFingerprints.GetAll(); getAllError == nil { - log.Printf("getAll: %q\n", getAll) result := make([]model.LabelPairs, 0) fingerprintCollection := &data.FingerprintCollectionDDO{} fingerprints := make(utility.Set) for _, pair := range getAll { - log.Printf("pair: %q\n", pair) if unmarshalError := proto.Unmarshal(pair.Right, fingerprintCollection); unmarshalError == nil { for _, member := range fingerprintCollection.Member { - log.Printf("member: %q\n", member) if !fingerprints.Has(*member.Signature) { - log.Printf("!Has: %q\n", member.Signature) fingerprints.Add(*member.Signature) - log.Printf("fingerprints %q\n", fingerprints) fingerprintEncoded := coding.NewProtocolBufferEncoder(member) if labelPairCollectionRaw, labelPairCollectionRawError := l.fingerprintLabelPairs.Get(fingerprintEncoded); labelPairCollectionRawError == nil { - log.Printf("labelPairCollectionRaw: %q\n", labelPairCollectionRaw) labelPairCollectionDDO := &data.LabelPairCollectionDDO{} @@ -570,8 +562,6 @@ func (l *LevelDBMetricPersistence) GetMetrics() ([]model.LabelPairs, error) { intermediate[*member.Name] = *member.Value } - log.Printf("intermediate: %q\n", intermediate) - result = append(result, intermediate) } else { return nil, labelPairCollectionDDOMarshalError @@ -726,3 +716,15 @@ func (l *LevelDBMetricPersistence) GetSamplesForMetric(metric model.Metric, inte return nil, errors.New("Unknown error occurred while querying metric watermarks.") } + +func (l *LevelDBMetricPersistence) GetFingerprintLabelPairs(f model.Fingerprint) (model.LabelPairs, error) { + panic("NOT IMPLEMENTED") +} + +func (l *LevelDBMetricPersistence) GetMetricFingerprintsForLabelPairs(p []*model.LabelPairs) ([]*model.Fingerprint, error) { + panic("NOT IMPLEMENTED") +} + +func (l *LevelDBMetricPersistence) RecordFingerprintWatermark(s *model.Sample) error { + panic("NOT IMPLEMENTED") +}