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
16class BaseMeasure(object):
17    """ A measure is the type of metric that is being recorded with
18    a name, description, and unit
19
20    :type name: str
21    :param name: string representing the name of the measure
22
23    :type description: str
24    :param description: a string representing the description of the measure
25
26    :type unit: str
27    :param unit: the units in which the measure values are measured
28
29    """
30    def __init__(self, name, description, unit=None):
31        self._name = name
32        self._description = description
33        self._unit = unit
34
35    @property
36    def name(self):
37        """The name of the current measure"""
38        return self._name
39
40    @property
41    def description(self):
42        """The description of the current measure"""
43        return self._description
44
45    @property
46    def unit(self):
47        """The unit of the current measure"""
48        return self._unit
49
50
51class MeasureInt(BaseMeasure):
52    """Creates an Integer Measure"""
53    def __init__(self, name, description, unit=None):
54        super(MeasureInt, self).__init__(name, description, unit)
55
56
57class MeasureFloat(BaseMeasure):
58    """Creates a Float Measure"""
59    def __init__(self, name, description, unit=None):
60        super(MeasureFloat, self).__init__(name, description, unit)
61