package metricdata
Import Path
go.opencensus.io/metric/metricdata (on go.dev)
Dependency Relation
imports 3 packages, and imported by 7 packages
Involved Source Files
Package metricdata contains the metrics data model.
This is an EXPERIMENTAL package, and may change in arbitrary ways without
notice.
exemplar.go
label.go
metric.go
point.go
type_string.go
unit.go
Package-Level Type Names (total 16, all are exported)
Attachments is a map of extra values associated with a recorded data point.
func go.opencensus.io/plugin/ocgrpc.getSpanCtxAttachment(ctx context.Context) Attachments
func go.opencensus.io/stats.WithAttachments(attachments Attachments) stats.Options
func contrib.go.opencensus.io/exporter/stackdriver.attachmentsToPbAttachments(attachments Attachments, projectID string) []*any.Any
Bucket represents a single bucket (value range) in a distribution.
Count is the number of values in each bucket of the histogram, as described in
bucket_bounds.
Exemplar associated with this bucket (if any).
func contrib.go.opencensus.io/exporter/stackdriver.metricBucketToBucketCountsAndExemplars(buckets []Bucket, projectID string) ([]int64, []*distributionpb.Distribution_Exemplar)
BucketOptions describes the bounds of the histogram buckets in this
distribution.
Bounds specifies a set of bucket upper bounds.
This defines len(bounds) + 1 (= N) buckets. The boundaries for bucket
index i are:
[0, Bounds[i]) for i == 0
[Bounds[i-1], Bounds[i]) for 0 < i < N-1
[Bounds[i-1], +infinity) for i == N-1
Descriptor holds metadata about a metric.
// human-readable description
// label keys
// full name of the metric
// type of measure
// units for the measure
func go.opencensus.io/stats/view.viewToMetricDescriptor(v *view.View) *Descriptor
Distribution contains summary statistics for a population of values. It
optionally contains a histogram representing the distribution of those
values across a set of buckets.
BucketOptions describes the bounds of the histogram buckets in this
distribution.
A Distribution may optionally contain a histogram of the values in the
population.
If nil, there is no associated histogram.
Bucket If the distribution does not have a histogram, then omit this field.
If there is a histogram, then the sum of the values in the Bucket counts
must equal the value in the count field of the distribution.
Count is the number of values in the population. Must be non-negative. This value
must equal the sum of the values in bucket_counts if a histogram is
provided.
Sum is the sum of the values in the population. If count is zero then this field
must be zero.
SumOfSquaredDeviation is the sum of squared deviations from the mean of the values in the
population. For values x_i this is:
Sum[i=1..n]((x_i - mean)^2)
Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition
describes Welford's method for accumulating this sum in one pass.
If count is zero then this field must be zero.
func NewDistributionPoint(t time.Time, val *Distribution) Point
func ValueVisitor.VisitDistributionValue(*Distribution)
Exemplar is an example data point associated with each bucket of a
distribution type aggregation.
Their purpose is to provide an example of the kind of thing
(request, RPC, trace span, etc.) that resulted in that measurement.
// attachments (if any)
// the time the value was recorded
// the value that was recorded
func go.opencensus.io/stats/view.getExemplar(v float64, attachments map[string]interface{}, t time.Time) *Exemplar
func contrib.go.opencensus.io/exporter/stackdriver.metricExemplarToPbExemplar(exemplar *Exemplar, projectID string) *distributionpb.Distribution_Exemplar
LabelKey represents key of a label. It has optional
description attribute.
Description string
Key string
func go.opencensus.io/stats/view.getLabelKeys(v *view.View) []LabelKey
func go.opencensus.io/stats/view.toLabelValues(row *view.Row, expectedKeys []LabelKey) []LabelValue
func contrib.go.opencensus.io/exporter/prometheus.toPromLabels(mls []LabelKey) (labels []string)
func contrib.go.opencensus.io/exporter/stackdriver.metricLabelsToTsLabels(defaults map[string]stackdriver.labelValue, labelKeys []LabelKey, labelValues []LabelValue) (map[string]string, error)
func contrib.go.opencensus.io/exporter/stackdriver.metricLableKeysToLabels(defaults map[string]stackdriver.labelValue, labelKeys []LabelKey) []*labelpb.LabelDescriptor
LabelValue represents the value of a label.
The zero value represents a missing label value, which may be treated
differently to an empty string value by some back ends.
// flag that indicated whether a value is present or not
// string value of the label
func NewLabelValue(val string) LabelValue
func go.opencensus.io/stats/view.toLabelValues(row *view.Row, expectedKeys []LabelKey) []LabelValue
func contrib.go.opencensus.io/exporter/prometheus.toLabelValues(labelValues []LabelValue) (values []string)
func contrib.go.opencensus.io/exporter/stackdriver.metricLabelsToTsLabels(defaults map[string]stackdriver.labelValue, labelKeys []LabelKey, labelValues []LabelValue) (map[string]string, error)
Metric represents a quantity measured against a resource with different
label value combinations.
// metric descriptor
// resource against which this was measured
// one time series for each combination of label values
func go.opencensus.io/metric/metricproducer.Producer.Read() []*Metric
func go.opencensus.io/stats/view.viewToMetric(v *view.viewInternal, r *resource.Resource, now time.Time, startTime time.Time) *Metric
func go.opencensus.io/metric/metricexport.Exporter.ExportMetrics(ctx context.Context, data []*Metric) error
func contrib.go.opencensus.io/exporter/stackdriver.(*Exporter).ExportMetrics(ctx context.Context, metrics []*Metric) error
func contrib.go.opencensus.io/exporter/prometheus.metricName(namespace string, m *Metric) string
func contrib.go.opencensus.io/exporter/prometheus.toPromMetric(desc *prometheus.Desc, metric *Metric, point Point, labelValues []string) (prometheus.Metric, error)
func contrib.go.opencensus.io/exporter/stackdriver.metricDescriptorTypeToMetricKind(m *Metric) (googlemetricpb.MetricDescriptor_MetricKind, googlemetricpb.MetricDescriptor_ValueType)
Point is a single data point of a time series.
Time is the point in time that this point represents in a time series.
Value is the value of this point. Prefer using ReadValue to switching on
the value type, since new value types might be added.
ReadValue accepts a ValueVisitor and calls the appropriate method with the
value of this point.
Consumers of Point should use this in preference to switching on the type
of the value directly, since new value types may be added.
func NewDistributionPoint(t time.Time, val *Distribution) Point
func NewFloat64Point(t time.Time, val float64) Point
func NewInt64Point(t time.Time, val int64) Point
func NewSummaryPoint(t time.Time, val *Summary) Point
func go.opencensus.io/stats/view.(*CountData).toPoint(metricType Type, t time.Time) Point
func go.opencensus.io/stats/view.(*DistributionData).toPoint(metricType Type, t time.Time) Point
func go.opencensus.io/stats/view.(*LastValueData).toPoint(metricType Type, t time.Time) Point
func go.opencensus.io/stats/view.(*SumData).toPoint(metricType Type, t time.Time) Point
func contrib.go.opencensus.io/exporter/prometheus.toPromMetric(desc *prometheus.Desc, metric *Metric, point Point, labelValues []string) (prometheus.Metric, error)
func contrib.go.opencensus.io/exporter/prometheus.toPromValue(point Point) (float64, error)
func contrib.go.opencensus.io/exporter/prometheus.typeMismatchError(point Point) error
func contrib.go.opencensus.io/exporter/stackdriver.metricPointToMpbPoint(startTime *timestamp.Timestamp, pt *Point, projectID string) (*monitoringpb.Point, error)
func contrib.go.opencensus.io/exporter/stackdriver.metricPointToMpbValue(pt *Point, projectID string) (*monitoringpb.TypedValue, error)
Snapshot represents percentiles over an arbitrary time.
The values in this struct can be reset at arbitrary unknown times, with
the requirement that all of them are reset at the same time.
Count is the number of values in the snapshot. Optional since some systems don't
expose this. Set to 0 if not available.
Percentiles is a map from percentile (range (0-100.0]) to the value of
the percentile.
Sum is the sum of values in the snapshot. Optional since some systems don't
expose this. If count is 0 then this field must be zero.
Summary is a representation of percentiles.
Count is the cumulative count (if available).
HasCountAndSum is true if Count and Sum are available.
Snapshot represents percentiles calculated over an arbitrary time window.
The values in this struct can be reset at arbitrary unknown times, with
the requirement that all of them are reset at the same time.
Sum is the cumulative sum of values (if available).
func NewSummaryPoint(t time.Time, val *Summary) Point
func ValueVisitor.VisitSummaryValue(*Summary)
TimeSeries is a sequence of points associated with a combination of label
values.
// label values, same order as keys in the metric descriptor
// points sequence
// time we started recording this time series
func go.opencensus.io/stats/view.rowToTimeseries(v *view.viewInternal, row *view.Row, now time.Time, startTime time.Time) *TimeSeries
Type is the overall type of metric, including its value type and whether it
represents a cumulative total (since the start time) or if it represents a
gauge value.
( T) String() string
T : expvar.Var
T : fmt.Stringer
T : context.stringer
T : runtime.stringer
func go.opencensus.io/stats/view.getType(v *view.View) Type
func go.opencensus.io/stats/view.(*CountData).toPoint(metricType Type, t time.Time) Point
func go.opencensus.io/stats/view.(*DistributionData).toPoint(metricType Type, t time.Time) Point
func go.opencensus.io/stats/view.(*LastValueData).toPoint(metricType Type, t time.Time) Point
func go.opencensus.io/stats/view.(*SumData).toPoint(metricType Type, t time.Time) Point
const TypeCumulativeDistribution
const TypeCumulativeFloat64
const TypeCumulativeInt64
const TypeGaugeDistribution
const TypeGaugeFloat64
const TypeGaugeInt64
const TypeSummary
Unit is a string encoded according to the case-sensitive abbreviations from the
Unified Code for Units of Measure: http://unitsofmeasure.org/ucum.html
func go.opencensus.io/stats/view.convertUnit(v *view.View) Unit
func go.opencensus.io/stats/view.getUnit(unit string) Unit
const UnitBytes
const UnitDimensionless
const UnitMilliseconds
ValueVisitor allows reading the value of a point.
( T) VisitDistributionValue(*Distribution)
( T) VisitFloat64Value(float64)
( T) VisitInt64Value(int64)
( T) VisitSummaryValue(*Summary)
func Point.ReadValue(vv ValueVisitor)
Package-Level Functions (total 5, all are exported)
NewDistributionPoint creates a new Point holding a Distribution value.
NewFloat64Point creates a new Point holding a float64 value.
NewInt64Point creates a new Point holding an int64 value.
NewLabelValue creates a new non-nil LabelValue that represents the given string.
NewSummaryPoint creates a new Point holding a Summary value.
Package-Level Variables (only one, which is unexported)
Package-Level Constants (total 12, in which 11 are exported)
Exemplars keys.
Metric types.
Metric types.
Metric types.
Metric types.
Metric types.
Metric types.
Metric types.
Predefined units. To record against a unit not represented here, create your
own Unit type constant from a string.
Predefined units. To record against a unit not represented here, create your
own Unit type constant from a string.
Predefined units. To record against a unit not represented here, create your
own Unit type constant from a string.
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |