Skip to content

Commit

Permalink
Merge pull request #44 from Stackdriver/droperr
Browse files Browse the repository at this point in the history
Don't log expected error
  • Loading branch information
fabxc authored Aug 16, 2018
2 parents b49d515 + 500528e commit 08d8b23
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bench/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ echo "Starting sidecar"
./stackdriver-prometheus-sidecar \
--stackdriver.project-id=test \
--web.listen-address="0.0.0.0:9091" \
--stackdriver.global-label=_debug=debug \
--stackdriver.debug \
--stackdriver.api-address="http://127.0.0.1:9092/?auth=false" \
2>&1 | sed -e "s/^/[sidecar] /" &

Expand All @@ -35,7 +35,7 @@ if [ -n "${SIDECAR_OLD}" ]; then
--log.level=debug \
--stackdriver.project-id=test \
--web.listen-address="0.0.0.0:9093" \
--stackdriver.global-label=_debug=debug \
--stackdriver.debug \
--stackdriver.api-address="http://127.0.0.1:9092/?auth=false" \
2>&1 | sed -e "s/^/[sidecar-old] /" &
fi
Expand Down
7 changes: 7 additions & 0 deletions cmd/stackdriver-prometheus-sidecar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func main() {
projectIdResource string
kubernetesLabels kubernetesConfig
stackdriverAddress *url.URL
stackdriverDebug bool
walDirectory string
prometheusURL *url.URL
listenAddress string
Expand All @@ -177,6 +178,9 @@ func main() {
a.Flag("stackdriver.kubernetes.cluster-name", "Value of the 'cluster_name' label in the Kubernetes Stackdriver MonitoredResources.").
StringVar(&cfg.kubernetesLabels.clusterName)

a.Flag("stackdriver.debug", "Use the debug monitored resource to send data to a fake receiver.").
BoolVar(&cfg.stackdriverDebug)

a.Flag("prometheus.wal-directory", "Directory from where to read the Prometheus TSDB WAL.").
Default("data/wal").StringVar(&cfg.walDirectory)

Expand Down Expand Up @@ -218,6 +222,9 @@ func main() {
retrieval.KubernetesLocationLabel: cfg.kubernetesLabels.location,
retrieval.KubernetesClusterNameLabel: cfg.kubernetesLabels.clusterName,
}
if cfg.stackdriverDebug {
staticLabels["_debug"] = "debug"
}

cfg.projectIdResource = fmt.Sprintf("projects/%v", *projectId)
targetsURL, err := cfg.prometheusURL.Parse(targets.DefaultAPIEndpoint)
Expand Down
3 changes: 3 additions & 0 deletions retrieval/series_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ func (c *seriesCache) run(ctx context.Context) {
// recent checkpoint.
func (c *seriesCache) garbageCollect() error {
cpDir, cpNum, err := tsdb.LastCheckpoint(c.dir)
if errors.Cause(err) == tsdb.ErrNotFound {
return nil // Nothing to do.
}
if err != nil {
return errors.Wrap(err, "find last checkpoint")
}
Expand Down

0 comments on commit 08d8b23

Please sign in to comment.