Skip to content

Commit

Permalink
Various fixes; Changelog entry for Go MADV; doc cleanup; tutorial blo…
Browse files Browse the repository at this point in the history
…ckgen has own dockerfile.

Signed-off-by: Bartek Plotka <[email protected]>
  • Loading branch information
bwplotka committed May 28, 2019
1 parent 34ad98e commit cb510fe
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 43 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ We use *breaking* word for marking changes that are not backward compatible (rel
This release also disables gossip mode by default for all components.
See [this](docs/proposals/approved/201809_gossip-removal.md) for more details.

:warning: This release moves Thanos docker images and artifacts to Golang 1.12. This release includes change in GC's memory release which gives following effect (source: https://golang.org/doc/go1.12):

> On Linux, the runtime now uses MADV_FREE to release unused memory. This is more efficient but may result in higher reported RSS. The kernel will reclaim the unused data when it is needed. To revert to the Go 1.11 behavior (MADV_DONTNEED), set the environment variable GODEBUG=madvdontneed=1.
If you want to see exact memory allocation of Thanos process:
* Use `go_memstats_heap_alloc_bytes` metric exposed by Golang.
* Add `GODEBUG=madvdontneed=1` before running Thanos binary to revert to memory releasing to pre 1.12 logic.

Using cadvisor metric could be misleading e.g: https://github.com/google/cadvisor/issues/2242

### Added

- [thanos.io](https://thanos.io) website & automation :tada:
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,20 @@ deps:
# docker builds docker with no tag.
.PHONY: docker
docker: build
@echo ">> building docker image '${DOCKER_IMAGE_NAME}'"
@docker build -t "${DOCKER_IMAGE_NAME}" .
@echo ">> building docker image '$(DOCKER_IMAGE_NAME)'"
@docker build -t "$(DOCKER_IMAGE_NAME)" .

#docker-multi-stage builds docker image using multi-stage.
.PHONY: docker-multi-stage
docker-multi-stage:
@echo ">> building docker image '${DOCKER_IMAGE_NAME}' with Dockerfile.multi-stage"
@docker build -f Dockerfile.multi-stage -t "${DOCKER_IMAGE_NAME}" .
@echo ">> building docker image '$(DOCKER_IMAGE_NAME)' with Dockerfile.multi-stage"
@docker build -f Dockerfile.multi-stage -t "$(DOCKER_IMAGE_NAME)" .

# docker-push pushes docker image build under `${DOCKER_IMAGE_NAME}` to improbable/"$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
# docker-push pushes docker image build under `$(DOCKER_IMAGE_NAME)` to improbable/"$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
.PHONY: docker-push
docker-push:
@echo ">> pushing image"
@docker tag "${DOCKER_IMAGE_NAME}" improbable/"$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
@echo ">> pushing image improbable/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
@docker tag "$(DOCKER_IMAGE_NAME)" improbable/"$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
@docker push improbable/"$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"

# docs regenerates flags in docs for all thanos commands.
Expand Down
27 changes: 12 additions & 15 deletions cmd/thanos/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,29 +305,26 @@ func runSidecar(
}

func validatePrometheus(ctx context.Context, logger log.Logger, m *promMetadata) error {
flags := promclient.Flags{
TSDBMinTime: model.Duration(2 * time.Hour),
TSDBMaxTime: model.Duration(2 * time.Hour),
}
var (
flagErr error
flags promclient.Flags
)

if err := runutil.Retry(2*time.Second, ctx.Done(), func() error {

var err error
if flags, err = promclient.ConfiguredFlags(ctx, logger, m.promURL); err != nil {
if err == promclient.ErrFlagEndpointNotFound { // saw 404
level.Warn(logger).Log("msg", "failed to check Promteheus flags endpoint. No extra validation is done: %s", err)
return nil
}
level.Warn(logger).Log("msg", "failed to get Prometheus flags. Is Prometheus running? Retrying", "err", err)
return errors.Wrapf(err, "fetch Prometheus flags")
if flags, flagErr = promclient.ConfiguredFlags(ctx, logger, m.promURL); flagErr != nil && flagErr != promclient.ErrFlagEndpointNotFound {
level.Warn(logger).Log("msg", "failed to get Prometheus flags. Is Prometheus running? Retrying", "err", flagErr)
return errors.Wrapf(flagErr, "fetch Prometheus flags")
}

return nil

}); err != nil {
return errors.Wrapf(err, "fetch Prometheus flags")
}

if flagErr != nil {
level.Warn(logger).Log("msg", "failed to check Prometheus flags, due to potentially older Prometheus. No extra validation is done.", "err", flagErr)
return nil
}

// Check if compaction is disabled.
if flags.TSDBMinTime != flags.TSDBMaxTime {
return errors.Errorf("found that TSDB Max time is %s and Min time is %s. "+
Expand Down
21 changes: 0 additions & 21 deletions docs/contributing/dev.md

This file was deleted.

6 changes: 6 additions & 0 deletions tutorials/kubernetes-demo/blockgen/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM quay.io/prometheus/busybox:latest
LABEL maintainer="The Thanos Authors"

COPY blockgen /bin/blockgen

ENTRYPOINT [ "/bin/blockgen" ]
15 changes: 15 additions & 0 deletions tutorials/kubernetes-demo/blockgen/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))-$(shell date +%Y-%m-%d)-$(shell git rev-parse --short HEAD)

# docker builds docker with no tag.
.PHONY: docker
docker:
@echo ">> building blockgen"
@go build
@echo ">> building docker image blockgen"
@docker build -t "blockgen" .

.PHONY: docker-push
docker-push:
@echo ">> pushing image improbable/blockgen:$(DOCKER_IMAGE_TAG)"
@docker tag "blockgen" improbable/blockgen:"$(DOCKER_IMAGE_TAG)"
@docker push improbable/blockgen:"$(DOCKER_IMAGE_TAG)"

0 comments on commit cb510fe

Please sign in to comment.