metrics

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2019 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Copyright 2019 The Kubernetes Authors All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2019 The Kubernetes Authors All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregation

type Aggregation string

Aggregation defines how measurements should be aggregated into data points.

const (
	// LastValue means last measurement overwrites previous measurements (gauge metric).
	LastValue Aggregation = "LastValue"
	// Sum means last measurement will be added onto previous measurements (counter metric).
	Sum Aggregation = "Sum"
)

type FakeInt64Metric

type FakeInt64Metric struct {
	// contains filtered or unexported fields
}

FakeInt64Metric implements Int64MetricInterface. FakeInt64Metric can be used as a test double for Int64MetricInterface, allowing inspection of the metrics.

func NewFakeInt64Metric

func NewFakeInt64Metric(name string, aggregation Aggregation, tagNames []string) *FakeInt64Metric

func (*FakeInt64Metric) ListMetrics

func (fake *FakeInt64Metric) ListMetrics() []Int64MetricRepresentation

ListMetrics returns a snapshot of the current metrics.

func (*FakeInt64Metric) Record

func (fake *FakeInt64Metric) Record(tags map[string]string, measurement int64) error

type Float64Metric

type Float64Metric struct {
	// contains filtered or unexported fields
}

Float64Metric represents an float64 metric.

func NewFloat64Metric

func NewFloat64Metric(name string, description string, unit string, aggregation Aggregation, tagNames []string) (*Float64Metric, error)

NewFloat64Metric create a Float64Metric metrics, returns nil when name is empty.

func (*Float64Metric) Record

func (metric *Float64Metric) Record(tags map[string]string, measurement float64) error

Record records a measurement for the metric, with provided tags as metric labels.

type Int64Metric

type Int64Metric struct {
	// contains filtered or unexported fields
}

Int64Metric represents an int64 metric.

func NewInt64Metric

func NewInt64Metric(name string, description string, unit string, aggregation Aggregation, tagNames []string) (*Int64Metric, error)

NewInt64Metric create a Int64Metric metric, returns nil when name is empty.

func (*Int64Metric) Record

func (metric *Int64Metric) Record(tags map[string]string, measurement int64) error

Record records a measurement for the metric, with provided tags as metric labels.

type Int64MetricInterface

type Int64MetricInterface interface {
	// Record records a measurement for the metric, with provided tags as metric labels.
	Record(tags map[string]string, measurement int64) error
}

Int64MetricInterface is used to create test double for Int64Metric.

type Int64MetricRepresentation

type Int64MetricRepresentation struct {
	// Name is the metric name.
	Name string
	// Labels contains all metric labels in key-value pair format.
	Labels map[string]string
	// Value is the value of the metric.
	Value int64
}

Int64MetricRepresentation represents a snapshot of an int64 metrics. This is used for inspecting fake metrics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL