Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove reporter and userscope interfaces #3044

Merged
merged 1 commit into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions common/metrics/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import (
"time"

"github.com/uber-go/tally/v4"

"go.temporal.io/server/common/log"
)

type (
Expand Down Expand Up @@ -90,36 +88,6 @@ type (
// information to metrics
Tagged(tags ...Tag) Scope
}

// UserScope is an interface for reporting metrics by user code
// Deprecated
UserScope interface {
// IncCounter increments a counter metric
IncCounter(counter string)
// AddCounter adds delta to the counter metric
AddCounter(counter string, delta int64)
// StartTimer starts a timer for the given metric name.
// Time will be recorded when stopwatch is stopped.
StartTimer(timer string) Stopwatch
// RecordTimer records a timer for the given metric name
RecordTimer(timer string, d time.Duration)
// RecordDistribution records a distribution (wrapper on top of timer) for the given
// metric name
RecordDistribution(id string, unit MetricUnit, d int)
// UpdateGauge reports Gauge type absolute value metric
UpdateGauge(gauge string, value float64)
// Tagged returns a new scope with added and/or overriden tags values that can be used
// to provide additional information to metrics
Tagged(tags map[string]string) UserScope
}

// Reporter is an interface for base constructor for metrics client.
// Deprecated
Reporter interface {
MetricsHandler() MetricsHandler
Stop(logger log.Logger)
UserScope() UserScope
}
)

var sanitizer = tally.NewSanitizer(tally.SanitizeOptions{
Expand Down
175 changes: 0 additions & 175 deletions common/metrics/interfaces_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 4 additions & 44 deletions common/metrics/noop_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,59 +31,19 @@ import (
)

var (
NoopReporter Reporter = newNoopReporter()
NoopClient Client = newNoopClient()
NoopScope Scope = newNoopScope()
NoopUserScope UserScope = newNoopUserScope()
NoopStopwatch Stopwatch = newNoopStopwatch()
NoopMetricsHandler MetricsHandler = newNoopMetricsHandler()
)

type (
noopReporterImpl struct{}
noopClientImpl struct{}
noopMetricsUserScope struct{}
noopStopwatchImpl struct{}
noopScopeImpl struct{}
noopMetricsHandler struct{}
noopClientImpl struct{}
noopStopwatchImpl struct{}
noopScopeImpl struct{}
noopMetricsHandler struct{}
)

func newNoopReporter() *noopReporterImpl {
return &noopReporterImpl{}
}

func (*noopReporterImpl) MetricsHandler() MetricsHandler {
return NoopMetricsHandler
}

func (*noopReporterImpl) Stop(logger log.Logger) {}

func (*noopReporterImpl) UserScope() UserScope {
return NoopUserScope
}

func newNoopUserScope() *noopMetricsUserScope {
return &noopMetricsUserScope{}
}

func (n *noopMetricsUserScope) IncCounter(counter string) {}

func (n *noopMetricsUserScope) AddCounter(counter string, delta int64) {}

func (n *noopMetricsUserScope) StartTimer(timer string) Stopwatch {
return NoopStopwatch
}

func (n *noopMetricsUserScope) RecordTimer(timer string, d time.Duration) {}

func (n *noopMetricsUserScope) RecordDistribution(id string, unit MetricUnit, d int) {}

func (n *noopMetricsUserScope) UpdateGauge(gauge string, value float64) {}

func (n *noopMetricsUserScope) Tagged(tags map[string]string) UserScope {
return n
}

func newNoopClient() *noopClientImpl {
return &noopClientImpl{}
}
Expand Down
53 changes: 0 additions & 53 deletions common/metrics/reporter.go

This file was deleted.

Loading