github.com/m3db/m3@v1.5.0/src/query/ts/metadata.go (about)

     1  // Copyright (c) 2020 Uber Technologies, Inc.
     2  //
     3  // Permission is hereby granted, free of charge, to any person obtaining a copy
     4  // of this software and associated documentation files (the "Software"), to deal
     5  // in the Software without restriction, including without limitation the rights
     6  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     7  // copies of the Software, and to permit persons to whom the Software is
     8  // furnished to do so, subject to the following conditions:
     9  //
    10  // The above copyright notice and this permission notice shall be included in
    11  // all copies or substantial portions of the Software.
    12  //
    13  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    14  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    15  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    16  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    17  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    18  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    19  // THE SOFTWARE.
    20  
    21  package ts
    22  
    23  // M3MetricType is the enum for M3 metric types.
    24  // NB: the current use case for this is Graphite metrics. Also see PromMetricType (below).
    25  // In future, it is worth considering a merge of these two enumerations.
    26  type M3MetricType uint8
    27  
    28  const (
    29  	// M3MetricTypeGauge is the gauge metric type.
    30  	M3MetricTypeGauge M3MetricType = iota
    31  
    32  	// M3MetricTypeCounter is the counter metric type.
    33  	M3MetricTypeCounter
    34  
    35  	// M3MetricTypeTimer is the timer metric type.
    36  	M3MetricTypeTimer
    37  )
    38  
    39  // PromMetricType is the enum for Prometheus metric types.
    40  type PromMetricType uint8
    41  
    42  const (
    43  	// PromMetricTypeUnknown is the unknown Prometheus metric type.
    44  	PromMetricTypeUnknown PromMetricType = iota
    45  
    46  	// PromMetricTypeCounter is the counter Prometheus metric type.
    47  	PromMetricTypeCounter
    48  
    49  	// PromMetricTypeGauge is the gauge Prometheus metric type.
    50  	PromMetricTypeGauge
    51  
    52  	// PromMetricTypeHistogram is the histogram Prometheus metric type.
    53  	PromMetricTypeHistogram
    54  
    55  	// PromMetricTypeGaugeHistogram is the gauge histogram Prometheus metric type.
    56  	PromMetricTypeGaugeHistogram
    57  
    58  	// PromMetricTypeSummary is the summary Prometheus metric type.
    59  	PromMetricTypeSummary
    60  
    61  	// PromMetricTypeInfo is the info Prometheus metric type.
    62  	PromMetricTypeInfo
    63  
    64  	// PromMetricTypeStateSet is the state set Prometheus metric type.
    65  	PromMetricTypeStateSet
    66  )
    67  
    68  // SourceType is the enum for metric source types.
    69  type SourceType uint8
    70  
    71  const (
    72  	// SourceTypePrometheus is the prometheus source type.
    73  	SourceTypePrometheus SourceType = iota
    74  
    75  	// SourceTypeGraphite is the graphite source type.
    76  	SourceTypeGraphite
    77  
    78  	// SourceTypeOpenMetrics is the Open Metrics source type.
    79  	SourceTypeOpenMetrics
    80  )
    81  
    82  // SeriesAttributes has attributes about the time series.
    83  type SeriesAttributes struct {
    84  	M3Type            M3MetricType
    85  	PromType          PromMetricType
    86  	Source            SourceType
    87  	HandleValueResets bool
    88  }
    89  
    90  // DefaultSeriesAttributes returns a default series attributes.
    91  func DefaultSeriesAttributes() SeriesAttributes {
    92  	return SeriesAttributes{}
    93  }
    94  
    95  // Metadata is metadata associated with a time series.
    96  type Metadata struct {
    97  	DropUnaggregated bool
    98  }