mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
Full module path rebrand from Temporal to Hanzo Tasks: - go.mod module: github.com/hanzoai/tasks - All internal Go imports updated (1906 files) - cmd/server renamed to cmd/tasksd - Binary name: tasksd (was temporal-server) - Docker images: hanzoai/tasks (was temporalio/server) - README rewritten with Hanzo Tasks branding - LLM.md created with integration notes - Makefile, goreleaser, CI workflows updated - go.temporal.io/sdk and go.temporal.io/api imports preserved (separate repos) Fork of Temporal.io (MIT license).
59 lines
1.5 KiB
Go
59 lines
1.5 KiB
Go
package metrics
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/hanzoai/tasks/common/log"
|
|
)
|
|
|
|
var (
|
|
NoopMetricsHandler Handler = newNoopMetricsHandler()
|
|
)
|
|
|
|
type (
|
|
noopMetricsHandler struct{}
|
|
)
|
|
|
|
func newNoopMetricsHandler() *noopMetricsHandler { return &noopMetricsHandler{} }
|
|
|
|
// WithTags creates a new MetricProvder with provided []Tag
|
|
// Tags are merged with registered Tags from the source MetricsHandler
|
|
func (n *noopMetricsHandler) WithTags(...Tag) Handler {
|
|
return n
|
|
}
|
|
|
|
// Counter obtains a counter for the given name.
|
|
func (*noopMetricsHandler) Counter(string) CounterIface {
|
|
return NoopCounterMetricFunc
|
|
}
|
|
|
|
// Gauge obtains a gauge for the given name.
|
|
func (*noopMetricsHandler) Gauge(string) GaugeIface {
|
|
return NoopGaugeMetricFunc
|
|
}
|
|
|
|
// Timer obtains a timer for the given name.
|
|
func (*noopMetricsHandler) Timer(string) TimerIface {
|
|
return NoopTimerMetricFunc
|
|
}
|
|
|
|
// Histogram obtains a histogram for the given name.
|
|
func (*noopMetricsHandler) Histogram(string, MetricUnit) HistogramIface {
|
|
return NoopHistogramMetricFunc
|
|
}
|
|
|
|
func (*noopMetricsHandler) Stop(log.Logger) {}
|
|
|
|
func (*noopMetricsHandler) Close() error {
|
|
return nil
|
|
}
|
|
|
|
func (n *noopMetricsHandler) StartBatch(_ string) BatchHandler {
|
|
return n
|
|
}
|
|
|
|
var NoopCounterMetricFunc = CounterFunc(func(i int64, t ...Tag) {})
|
|
var NoopGaugeMetricFunc = GaugeFunc(func(f float64, t ...Tag) {})
|
|
var NoopTimerMetricFunc = TimerFunc(func(d time.Duration, t ...Tag) {})
|
|
var NoopHistogramMetricFunc = HistogramFunc(func(i int64, t ...Tag) {})
|