Code refactoring for bpa operator
[icn.git] / cmd / bpa-operator / vendor / go.opencensus.io / metric / metricdata / metric.go
1 // Copyright 2018, OpenCensus Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package metricdata
16
17 import (
18         "time"
19
20         "go.opencensus.io/resource"
21 )
22
23 // Descriptor holds metadata about a metric.
24 type Descriptor struct {
25         Name        string   // full name of the metric
26         Description string   // human-readable description
27         Unit        Unit     // units for the measure
28         Type        Type     // type of measure
29         LabelKeys   []string // label keys
30 }
31
32 // Metric represents a quantity measured against a resource with different
33 // label value combinations.
34 type Metric struct {
35         Descriptor Descriptor         // metric descriptor
36         Resource   *resource.Resource // resource against which this was measured
37         TimeSeries []*TimeSeries      // one time series for each combination of label values
38 }
39
40 // TimeSeries is a sequence of points associated with a combination of label
41 // values.
42 type TimeSeries struct {
43         LabelValues []LabelValue // label values, same order as keys in the metric descriptor
44         Points      []Point      // points sequence
45         StartTime   time.Time    // time we started recording this time series
46 }