-
Notifications
You must be signed in to change notification settings - Fork 181
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
Introduce compat
package to ease migration from the old armon/go-metrice module name to the current hashicorp/go-metrics name
#169
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
//go:build armonmetrics || ignore || !hashicorpmetrics | ||
// +build armonmetrics ignore !hashicorpmetrics | ||
|
||
package metrics | ||
|
||
import ( | ||
"io" | ||
"net/url" | ||
"syscall" | ||
"time" | ||
|
||
"github.com/armon/go-metrics" | ||
) | ||
|
||
const ( | ||
// DefaultSignal is used with DefaultInmemSignal | ||
DefaultSignal = metrics.DefaultSignal | ||
) | ||
|
||
func AddSample(key []string, val float32) { | ||
metrics.AddSample(key, val) | ||
} | ||
func AddSampleWithLabels(key []string, val float32, labels []Label) { | ||
metrics.AddSampleWithLabels(key, val, labels) | ||
} | ||
func EmitKey(key []string, val float32) { | ||
metrics.EmitKey(key, val) | ||
} | ||
func IncrCounter(key []string, val float32) { | ||
metrics.IncrCounter(key, val) | ||
} | ||
func IncrCounterWithLabels(key []string, val float32, labels []Label) { | ||
metrics.IncrCounterWithLabels(key, val, labels) | ||
} | ||
func MeasureSince(key []string, start time.Time) { | ||
metrics.MeasureSince(key, start) | ||
} | ||
func MeasureSinceWithLabels(key []string, start time.Time, labels []Label) { | ||
metrics.MeasureSinceWithLabels(key, start, labels) | ||
} | ||
func SetGauge(key []string, val float32) { | ||
metrics.SetGauge(key, val) | ||
} | ||
func SetGaugeWithLabels(key []string, val float32, labels []Label) { | ||
metrics.SetGaugeWithLabels(key, val, labels) | ||
} | ||
func Shutdown() { | ||
metrics.Shutdown() | ||
} | ||
func UpdateFilter(allow, block []string) { | ||
metrics.UpdateFilter(allow, block) | ||
} | ||
func UpdateFilterAndLabels(allow, block, allowedLabels, blockedLabels []string) { | ||
metrics.UpdateFilterAndLabels(allow, block, allowedLabels, blockedLabels) | ||
} | ||
|
||
type AggregateSample = metrics.AggregateSample | ||
type BlackholeSink = metrics.BlackholeSink | ||
type Config = metrics.Config | ||
type Encoder = metrics.Encoder | ||
type FanoutSink = metrics.FanoutSink | ||
type GaugeValue = metrics.GaugeValue | ||
type InmemSignal = metrics.InmemSignal | ||
type InmemSink = metrics.InmemSink | ||
type IntervalMetrics = metrics.IntervalMetrics | ||
type Label = metrics.Label | ||
type MetricSink = metrics.MetricSink | ||
type Metrics = metrics.Metrics | ||
type MetricsSummary = metrics.MetricsSummary | ||
type PointValue = metrics.PointValue | ||
type SampledValue = metrics.SampledValue | ||
type ShutdownSink = metrics.ShutdownSink | ||
type StatsdSink = metrics.StatsdSink | ||
type StatsiteSink = metrics.StatsiteSink | ||
|
||
func DefaultConfig(serviceName string) *Config { | ||
return metrics.DefaultConfig(serviceName) | ||
} | ||
|
||
func DefaultInmemSignal(inmem *InmemSink) *InmemSignal { | ||
return metrics.DefaultInmemSignal(inmem) | ||
} | ||
func NewInmemSignal(inmem *InmemSink, sig syscall.Signal, w io.Writer) *InmemSignal { | ||
return metrics.NewInmemSignal(inmem, sig, w) | ||
} | ||
|
||
func NewInmemSink(interval, retain time.Duration) *InmemSink { | ||
return metrics.NewInmemSink(interval, retain) | ||
} | ||
|
||
func NewIntervalMetrics(intv time.Time) *IntervalMetrics { | ||
return metrics.NewIntervalMetrics(intv) | ||
} | ||
|
||
func NewInmemSinkFromURL(u *url.URL) (MetricSink, error) { | ||
return metrics.NewInmemSinkFromURL(u) | ||
} | ||
|
||
func NewMetricSinkFromURL(urlStr string) (MetricSink, error) { | ||
return metrics.NewMetricSinkFromURL(urlStr) | ||
} | ||
|
||
func NewStatsdSinkFromURL(u *url.URL) (MetricSink, error) { | ||
return metrics.NewStatsdSinkFromURL(u) | ||
} | ||
|
||
func NewStatsiteSinkFromURL(u *url.URL) (MetricSink, error) { | ||
return metrics.NewStatsiteSinkFromURL(u) | ||
} | ||
|
||
func Default() *Metrics { | ||
return metrics.Default() | ||
} | ||
|
||
func New(conf *Config, sink MetricSink) (*Metrics, error) { | ||
return metrics.New(conf, sink) | ||
} | ||
|
||
func NewGlobal(conf *Config, sink MetricSink) (*Metrics, error) { | ||
return metrics.NewGlobal(conf, sink) | ||
} | ||
|
||
func NewStatsdSink(addr string) (*StatsdSink, error) { | ||
return metrics.NewStatsdSink(addr) | ||
} | ||
|
||
func NewStatsiteSink(addr string) (*StatsiteSink, error) { | ||
return metrics.NewStatsiteSink(addr) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//go:build armonmetrics || ignore || !hashicorpmetrics | ||
// +build armonmetrics ignore !hashicorpmetrics | ||
|
||
package circonus | ||
|
||
import ( | ||
"github.com/armon/go-metrics/circonus" | ||
) | ||
|
||
type CirconusSink = circonus.CirconusSink | ||
type Config = circonus.Config | ||
|
||
func NewCirconusSink(cc *Config) (*CirconusSink, error) { | ||
return circonus.NewCirconusSink(cc) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//go:build hashicorpmetrics | ||
// +build hashicorpmetrics | ||
|
||
package circonus | ||
|
||
import ( | ||
"github.com/hashicorp/go-metrics/circonus" | ||
) | ||
|
||
type CirconusSink = circonus.CirconusSink | ||
type Config = circonus.Config | ||
|
||
func NewCirconusSink(cc *Config) (*CirconusSink, error) { | ||
return circonus.NewCirconusSink(cc) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//go:build armonmetrics || ignore || !hashicorpmetrics | ||
// +build armonmetrics ignore !hashicorpmetrics | ||
|
||
package datadog | ||
|
||
import ( | ||
"github.com/armon/go-metrics/datadog" | ||
) | ||
|
||
type DogStatsdSink = datadog.DogStatsdSink | ||
|
||
func NewDogStatsdSink(addr string, hostName string) (*DogStatsdSink, error) { | ||
return datadog.NewDogStatsdSink(addr, hostName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//go:build hashicorpmetrics | ||
// +build hashicorpmetrics | ||
|
||
package datadog | ||
|
||
import ( | ||
"github.com/hashicorp/go-metrics/datadog" | ||
) | ||
|
||
type DogStatsdSink = datadog.DogStatsdSink | ||
|
||
func NewDogStatsdSink(addr string, hostName string) (*DogStatsdSink, error) { | ||
return datadog.NewDogStatsdSink(addr, hostName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
//go:build hashicorpmetrics | ||
// +build hashicorpmetrics | ||
|
||
package metrics | ||
|
||
import ( | ||
"io" | ||
"net/url" | ||
"syscall" | ||
"time" | ||
|
||
"github.com/hashicorp/go-metrics" | ||
) | ||
|
||
const ( | ||
// DefaultSignal is used with DefaultInmemSignal | ||
DefaultSignal = metrics.DefaultSignal | ||
) | ||
|
||
func AddSample(key []string, val float32) { | ||
metrics.AddSample(key, val) | ||
} | ||
func AddSampleWithLabels(key []string, val float32, labels []Label) { | ||
metrics.AddSampleWithLabels(key, val, labels) | ||
} | ||
func EmitKey(key []string, val float32) { | ||
metrics.EmitKey(key, val) | ||
} | ||
func IncrCounter(key []string, val float32) { | ||
metrics.IncrCounter(key, val) | ||
} | ||
func IncrCounterWithLabels(key []string, val float32, labels []Label) { | ||
metrics.IncrCounterWithLabels(key, val, labels) | ||
} | ||
func MeasureSince(key []string, start time.Time) { | ||
metrics.MeasureSince(key, start) | ||
} | ||
func MeasureSinceWithLabels(key []string, start time.Time, labels []Label) { | ||
metrics.MeasureSinceWithLabels(key, start, labels) | ||
} | ||
func SetGauge(key []string, val float32) { | ||
metrics.SetGauge(key, val) | ||
} | ||
func SetGaugeWithLabels(key []string, val float32, labels []Label) { | ||
metrics.SetGaugeWithLabels(key, val, labels) | ||
} | ||
func Shutdown() { | ||
metrics.Shutdown() | ||
} | ||
func UpdateFilter(allow, block []string) { | ||
metrics.UpdateFilter(allow, block) | ||
} | ||
func UpdateFilterAndLabels(allow, block, allowedLabels, blockedLabels []string) { | ||
metrics.UpdateFilterAndLabels(allow, block, allowedLabels, blockedLabels) | ||
} | ||
|
||
type AggregateSample = metrics.AggregateSample | ||
type BlackholeSink = metrics.BlackholeSink | ||
type Config = metrics.Config | ||
type Encoder = metrics.Encoder | ||
type FanoutSink = metrics.FanoutSink | ||
type GaugeValue = metrics.GaugeValue | ||
type InmemSignal = metrics.InmemSignal | ||
type InmemSink = metrics.InmemSink | ||
type IntervalMetrics = metrics.IntervalMetrics | ||
type Label = metrics.Label | ||
type MetricSink = metrics.MetricSink | ||
type Metrics = metrics.Metrics | ||
type MetricsSummary = metrics.MetricsSummary | ||
type PointValue = metrics.PointValue | ||
type SampledValue = metrics.SampledValue | ||
type ShutdownSink = metrics.ShutdownSink | ||
type StatsdSink = metrics.StatsdSink | ||
type StatsiteSink = metrics.StatsiteSink | ||
|
||
func DefaultConfig(serviceName string) *Config { | ||
return metrics.DefaultConfig(serviceName) | ||
} | ||
|
||
func DefaultInmemSignal(inmem *InmemSink) *InmemSignal { | ||
return metrics.DefaultInmemSignal(inmem) | ||
} | ||
func NewInmemSignal(inmem *InmemSink, sig syscall.Signal, w io.Writer) *InmemSignal { | ||
return metrics.NewInmemSignal(inmem, sig, w) | ||
} | ||
|
||
func NewInmemSink(interval, retain time.Duration) *InmemSink { | ||
return metrics.NewInmemSink(interval, retain) | ||
} | ||
|
||
func NewIntervalMetrics(intv time.Time) *IntervalMetrics { | ||
return metrics.NewIntervalMetrics(intv) | ||
} | ||
|
||
func NewInmemSinkFromURL(u *url.URL) (MetricSink, error) { | ||
return metrics.NewInmemSinkFromURL(u) | ||
} | ||
|
||
func NewMetricSinkFromURL(urlStr string) (MetricSink, error) { | ||
return metrics.NewMetricSinkFromURL(urlStr) | ||
} | ||
|
||
func NewStatsdSinkFromURL(u *url.URL) (MetricSink, error) { | ||
return metrics.NewStatsdSinkFromURL(u) | ||
} | ||
|
||
func NewStatsiteSinkFromURL(u *url.URL) (MetricSink, error) { | ||
return metrics.NewStatsiteSinkFromURL(u) | ||
} | ||
|
||
func Default() *Metrics { | ||
return metrics.Default() | ||
} | ||
|
||
func New(conf *Config, sink MetricSink) (*Metrics, error) { | ||
return metrics.New(conf, sink) | ||
} | ||
|
||
func NewGlobal(conf *Config, sink MetricSink) (*Metrics, error) { | ||
return metrics.NewGlobal(conf, sink) | ||
} | ||
|
||
func NewStatsdSink(addr string) (*StatsdSink, error) { | ||
return metrics.NewStatsdSink(addr) | ||
} | ||
|
||
func NewStatsiteSink(addr string) (*StatsiteSink, error) { | ||
return metrics.NewStatsiteSink(addr) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: typo
... across all libraries
that
an application ...... To
facilitate
migrations ...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is fixed now.