File tree Expand file tree Collapse file tree 5 files changed +41
-20
lines changed
Expand file tree Collapse file tree 5 files changed +41
-20
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ VERSION ?= "$(shell git describe --tags --abbrev=0 | cut -c2-)"
2020COMMIT_HASH ?= "$(shell git describe --long --dirty --always --match "" || true) "
2121CLEAN_COMMIT ?= "$(shell git describe --long --always --match "" || true) "
2222COMMIT_TIME ?= "$(shell git show -s --format=% ct $(CLEAN_COMMIT ) || true) "
23+ BUILD_TAGS ?=
2324LDFLAGS ?= -s -w \
2425-X github.com/ethersphere/bee/v2.version="$(VERSION ) " \
2526-X github.com/ethersphere/bee/v2.commitHash="$(COMMIT_HASH ) " \
@@ -31,11 +32,14 @@ LDFLAGS ?= -s -w \
3132.PHONY : all
3233all : build lint test-race binary
3334
34- .PHONY : binary
35+ .PHONY : binary binary-nometrics
3536binary : export CGO_ENABLED=0
3637binary : dist FORCE
3738 $(GO ) version
38- $(GO ) build -trimpath -ldflags " $( LDFLAGS) " -o dist/bee ./cmd/bee
39+ $(GO ) build -trimpath -ldflags " $( LDFLAGS) " -tags " $( BUILD_TAGS) " -o dist/bee ./cmd/bee
40+
41+ binary-nometrics :
42+ $(MAKE ) binary BUILD_TAGS=nometrics
3943
4044dist :
4145 mkdir $@
Original file line number Diff line number Diff line change 22// Use of this source code is governed by a BSD-style
33// license that can be found in the LICENSE file.
44
5+ //go:build !nometrics
6+ // +build !nometrics
7+
58package exporter
69
710import (
811 exporter "contrib.go.opencensus.io/exporter/prometheus"
912 "github.com/prometheus/client_golang/prometheus"
1013)
1114
12- type MetricsSourcer interface {
13- MustRegister (... prometheus.Collector )
14- Register (prometheus.Collector ) error
15- Unregister (prometheus.Collector ) bool
16- }
17-
18- // The goroutine leak `go.opencensus.io/stats/view.(*worker).start` appears solely because of
19- // importing the `exporter.Options` type from `go.opencensus.io` package
20- // (either directly or transitively).
21- type ExporterOptions struct {
22- Namespace string
23- Registry MetricsSourcer
24- }
25-
2615func NewExporter (o ExporterOptions ) error {
2716 r , _ := o .Registry .(* prometheus.Registry )
2817 opts := exporter.Options {
Original file line number Diff line number Diff line change 1+ // Copyright 2020 The Swarm Authors. All rights reserved.
2+ // Use of this source code is governed by a BSD-style
3+ // license that can be found in the LICENSE file.
4+
5+ //go:build nometrics
6+ // +build nometrics
7+
8+ package exporter
9+
10+ func NewExporter (o ExporterOptions ) error {
11+ return nil
12+ }
Original file line number Diff line number Diff line change 1+ // Copyright 2020 The Swarm Authors. All rights reserved.
2+ // Use of this source code is governed by a BSD-style
3+ // license that can be found in the LICENSE file.
4+
5+ package exporter
6+
7+ import (
8+ "github.com/prometheus/client_golang/prometheus"
9+ )
10+
11+ type MetricsSourcer interface {
12+ MustRegister (... prometheus.Collector )
13+ Register (prometheus.Collector ) error
14+ Unregister (prometheus.Collector ) bool
15+ }
16+
17+ type ExporterOptions struct {
18+ Namespace string
19+ Registry MetricsSourcer
20+ }
Original file line number Diff line number Diff line change @@ -144,10 +144,6 @@ func NewRegistry() MetricsRegistererGatherer {
144144 return & registryNoop {}
145145}
146146
147- func NewExporter (o ExporterOptions ) error {
148- return nil
149- }
150-
151147func MustRegister (_ ... Collector ) {
152148 // pass
153149}
You can’t perform that action at this time.
0 commit comments