Documentation ¶
Index ¶
- func GetGlobalMetricRegistry() prometheus.Registerer
- func HTTPHandlerForMetric() http.Handler
- func HTTPHandlerForMetricImpl(gather prometheus.Gatherer) http.Handler
- func NewOnlyRegRegister(r prometheus.Registerer) prometheus.Registerer
- func NewOnlyUnregRegister(r prometheus.Registerer) prometheus.Registerer
- func UnregisterWorkerMetrics(workerID frameModel.WorkerID)
- type AutoRegisterFactory
- func (f *AutoRegisterFactory) NewCounter(opts prometheus.CounterOpts) prometheus.Counter
- func (f *AutoRegisterFactory) NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec
- func (f *AutoRegisterFactory) NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
- func (f *AutoRegisterFactory) NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec
- func (f *AutoRegisterFactory) NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
- func (f *AutoRegisterFactory) NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec
- type Factory
- func NewAutoRegisterFactory(f Factory, r *Registry, id frameModel.WorkerID) Factory
- func NewFactory4Framework() Factory
- func NewFactory4FrameworkImpl(reg *Registry) Factory
- func NewFactory4Master(info tenant.ProjectInfo, jobType engineModel.JobType, jobID engineModel.JobID) Factory
- func NewFactory4MasterImpl(reg *Registry, info tenant.ProjectInfo, prefix string, jobID engineModel.JobID) Factory
- func NewFactory4Test(testKey string) Factory
- func NewFactory4TestImpl(reg *Registry, testID string) Factory
- func NewFactory4Worker(info tenant.ProjectInfo, jobType engineModel.JobType, jobID engineModel.JobID, ...) Factory
- func NewFactory4WorkerImpl(reg *Registry, info tenant.ProjectInfo, prefix string, jobID engineModel.JobID, ...) Factory
- func NewPromFactory() Factory
- func NewWrappingFactory(f Factory, prefix string, labels prometheus.Labels) Factory
- type PromFactory
- func (f *PromFactory) NewCounter(opts prometheus.CounterOpts) prometheus.Counter
- func (f *PromFactory) NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec
- func (f *PromFactory) NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
- func (f *PromFactory) NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec
- func (f *PromFactory) NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
- func (f *PromFactory) NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec
- type RegOnlyRegister
- type Registry
- type UnregOnlyRegister
- type WrappingFactory
- func (f *WrappingFactory) NewCounter(opts prometheus.CounterOpts) prometheus.Counter
- func (f *WrappingFactory) NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec
- func (f *WrappingFactory) NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
- func (f *WrappingFactory) NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec
- func (f *WrappingFactory) NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
- func (f *WrappingFactory) NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGlobalMetricRegistry ¶
func GetGlobalMetricRegistry() prometheus.Registerer
GetGlobalMetricRegistry returns the global metric registry where auto-registering metrics are registered. The register to it should be only be done by its derived factories from NewFactory4Master, ... And the returned registry can be only used for unregister.
func HTTPHandlerForMetric ¶
HTTPHandlerForMetric return http.Handler for prometheus metric
func HTTPHandlerForMetricImpl ¶
func HTTPHandlerForMetricImpl(gather prometheus.Gatherer) http.Handler
HTTPHandlerForMetricImpl return http.Handler for prometheus metric
func NewOnlyRegRegister ¶
func NewOnlyRegRegister(r prometheus.Registerer) prometheus.Registerer
NewOnlyRegRegister creates an RegOnlyRegister.
func NewOnlyUnregRegister ¶
func NewOnlyUnregRegister(r prometheus.Registerer) prometheus.Registerer
NewOnlyUnregRegister creates an UnregOnlyRegister.
func UnregisterWorkerMetrics ¶
func UnregisterWorkerMetrics(workerID frameModel.WorkerID)
UnregisterWorkerMetrics unregisters all metrics of workerID IF 'worker' is a job master, use job id as workerID IF 'worker' is a worker, use worker id as workerID
Types ¶
type AutoRegisterFactory ¶
type AutoRegisterFactory struct {
// contains filtered or unexported fields
}
AutoRegisterFactory uses inner Factory to create metrics and register metrics to Registry with id. Panic if it can't register successfully.
func (*AutoRegisterFactory) NewCounter ¶
func (f *AutoRegisterFactory) NewCounter(opts prometheus.CounterOpts) prometheus.Counter
NewCounter implements Factory.NewCounter.
func (*AutoRegisterFactory) NewCounterVec ¶
func (f *AutoRegisterFactory) NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec
NewCounterVec implements Factory.NewCounterVec.
func (*AutoRegisterFactory) NewGauge ¶
func (f *AutoRegisterFactory) NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
NewGauge implements Factory.NewGauge.
func (*AutoRegisterFactory) NewGaugeVec ¶
func (f *AutoRegisterFactory) NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec
NewGaugeVec implements Factory.NewGaugeVec.
func (*AutoRegisterFactory) NewHistogram ¶
func (f *AutoRegisterFactory) NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
NewHistogram implements Factory.NewHistogram.
func (*AutoRegisterFactory) NewHistogramVec ¶
func (f *AutoRegisterFactory) NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec
NewHistogramVec implements Factory.NewHistogramVec.
type Factory ¶
type Factory interface { // NewCounter works like the function of the same name in the prometheus // package. NewCounter(opts prometheus.CounterOpts) prometheus.Counter // NewCounterVec works like the function of the same name in the // prometheus package. NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec // NewGauge works like the function of the same name in the prometheus // package. NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge // NewGaugeVec works like the function of the same name in the prometheus // package. NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec // NewHistogram works like the function of the same name in the prometheus // package. NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram // NewHistogramVec works like the function of the same name in the // prometheus package. NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec }
Factory is the interface to create some native prometheus metric
func NewAutoRegisterFactory ¶
func NewAutoRegisterFactory(f Factory, r *Registry, id frameModel.WorkerID) Factory
NewAutoRegisterFactory creates an AutoRegisterFactory.
func NewFactory4Framework ¶
func NewFactory4Framework() Factory
NewFactory4Framework return a Factory for dataflow framework NOTICE: we use auto service label tagged by cloud service to distinguish different dataflow engine or different executor
func NewFactory4FrameworkImpl ¶
NewFactory4FrameworkImpl return a Factory for dataflow framework
func NewFactory4Master ¶
func NewFactory4Master(info tenant.ProjectInfo, jobType engineModel.JobType, jobID engineModel.JobID) Factory
NewFactory4Master return a Factory for jobmaster
func NewFactory4MasterImpl ¶
func NewFactory4MasterImpl(reg *Registry, info tenant.ProjectInfo, prefix string, jobID engineModel.JobID) Factory
NewFactory4MasterImpl return a Factory for jobmaster
func NewFactory4Test ¶
NewFactory4Test return a Factory for test NOTICE: we use testing.T.TempDir() to distinguish different test
func NewFactory4TestImpl ¶
NewFactory4TestImpl return a Factory for test
func NewFactory4Worker ¶
func NewFactory4Worker(info tenant.ProjectInfo, jobType engineModel.JobType, jobID engineModel.JobID, workerID frameModel.WorkerID, ) Factory
NewFactory4Worker return a Factory for worker
func NewFactory4WorkerImpl ¶
func NewFactory4WorkerImpl(reg *Registry, info tenant.ProjectInfo, prefix string, jobID engineModel.JobID, workerID frameModel.WorkerID, ) Factory
NewFactory4WorkerImpl return a Factory for worker
func NewWrappingFactory ¶
func NewWrappingFactory(f Factory, prefix string, labels prometheus.Labels) Factory
NewWrappingFactory creates a WrappingFactory. if `prefix` is not empty, it is added to the metric name to avoid cross app metric conflict, e.g. $prefix_$namespace_$subsystem_$name. `labels` is added to user metric when create metrics.
type PromFactory ¶
type PromFactory struct{}
PromFactory implements Factory by calling prometheus.NewXXX.
func (*PromFactory) NewCounter ¶
func (f *PromFactory) NewCounter(opts prometheus.CounterOpts) prometheus.Counter
NewCounter implements Factory.NewCounter.
func (*PromFactory) NewCounterVec ¶
func (f *PromFactory) NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec
NewCounterVec implements Factory.NewCounterVec.
func (*PromFactory) NewGauge ¶
func (f *PromFactory) NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
NewGauge implements Factory.NewGauge.
func (*PromFactory) NewGaugeVec ¶
func (f *PromFactory) NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec
NewGaugeVec implements Factory.NewGaugeVec.
func (*PromFactory) NewHistogram ¶
func (f *PromFactory) NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
NewHistogram implements Factory.NewHistogram.
func (*PromFactory) NewHistogramVec ¶
func (f *PromFactory) NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec
NewHistogramVec implements Factory.NewHistogramVec.
type RegOnlyRegister ¶
type RegOnlyRegister struct {
// contains filtered or unexported fields
}
RegOnlyRegister can Register collectors but can't Unregister. It's only used in tests.
func (RegOnlyRegister) MustRegister ¶
func (o RegOnlyRegister) MustRegister(collector ...prometheus.Collector)
MustRegister implements prometheus.Registerer.
func (RegOnlyRegister) Register ¶
func (o RegOnlyRegister) Register(collector prometheus.Collector) error
Register implements prometheus.Registerer.
func (RegOnlyRegister) Unregister ¶
func (o RegOnlyRegister) Unregister(collector prometheus.Collector) bool
Unregister implements prometheus.Registerer.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is used for registering metric
func (*Registry) Gather ¶
func (r *Registry) Gather() ([]*dto.MetricFamily, error)
Gather implements Gatherer interface
func (*Registry) MustRegister ¶
func (r *Registry) MustRegister(workerID frameModel.WorkerID, c prometheus.Collector)
MustRegister registers the provided Collector of the specified worker
func (*Registry) Unregister ¶
func (r *Registry) Unregister(workerID frameModel.WorkerID)
Unregister unregisters all Collectors of the specified worker
type UnregOnlyRegister ¶
type UnregOnlyRegister struct {
// contains filtered or unexported fields
}
UnregOnlyRegister can Unregister collectors but can't Register. It's used to protect the global registry.
func (UnregOnlyRegister) MustRegister ¶
func (o UnregOnlyRegister) MustRegister(collector ...prometheus.Collector)
MustRegister implements prometheus.Registerer.
func (UnregOnlyRegister) Register ¶
func (o UnregOnlyRegister) Register(collector prometheus.Collector) error
Register implements prometheus.Registerer.
func (UnregOnlyRegister) Unregister ¶
func (o UnregOnlyRegister) Unregister(collector prometheus.Collector) bool
Unregister implements prometheus.Registerer.
type WrappingFactory ¶
type WrappingFactory struct {
// contains filtered or unexported fields
}
WrappingFactory uses inner Factory to create metrics and attaches some information to the metrics it created. The usage is dataflow engine can wrap prefix and labels for DM, and DM can wrap labels for dumpling/lightning.
func (*WrappingFactory) NewCounter ¶
func (f *WrappingFactory) NewCounter(opts prometheus.CounterOpts) prometheus.Counter
NewCounter works like the function of the same name in the prometheus package except for it will wrap prefix and constLabels. Thread-safe.
func (*WrappingFactory) NewCounterVec ¶
func (f *WrappingFactory) NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec
NewCounterVec works like the function of the same name in the prometheus package except for it will wrap prefix and constLabels. Thread-safe.
func (*WrappingFactory) NewGauge ¶
func (f *WrappingFactory) NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
NewGauge works like the function of the same name in the prometheus package except for it will wrap prefix and constLabels. Thread-safe.
func (*WrappingFactory) NewGaugeVec ¶
func (f *WrappingFactory) NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec
NewGaugeVec works like the function of the same name in the prometheus package except for it will wrap prefix and constLabels. Thread-safe.
func (*WrappingFactory) NewHistogram ¶
func (f *WrappingFactory) NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
NewHistogram works like the function of the same name in the prometheus package except for it will wrap prefix and constLabels. Thread-safe.
func (*WrappingFactory) NewHistogramVec ¶
func (f *WrappingFactory) NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec
NewHistogramVec works like the function of the same name in the prometheus package except for it will wrap prefix and constLabels. Thread-safe.