This file is indexed.

/usr/lib/python3/dist-packages/aiomeasures/metrics.py is in python3-aiomeasures 0.5.14-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
"""
    We’ll walk through the types of metrics supported by DogStatsD in Python,
    but the principles are easily translated into other languages.
"""

__all__ = [
    'Metric', 'CountingMetric', 'GaugeMetric',
    'HistogramMetric', 'SetMetric', 'TimingMetric'
]


class Metric:

    __slots__ = ('name', 'value', 'rate', 'delta', 'tags')

    def __init__(self, name, value, rate=None, delta=False, tags=None):
        """
        Parameters:
            name (str): name of the metric
            value (obj): value of the metric
            rate (float): sample of metric (optional)
        """

        self.name = name
        self.value = value
        self.rate = rate
        self.delta = delta
        self.tags = tags

    def __eq__(self, other):
        if isinstance(other, Metric):
            other = other.__str__()
        return self.__str__() == other

    def __repr__(self):
        args = ['%s=%s' for attr in ()]
        for attr in ('name', 'value', 'rate', 'delta', 'tags'):
            value = getattr(self, attr, None)
            if value is not None:
                args.append('%s=%r' % (attr, value))
        return '<%s(%s)>' % (self.__class__.__name__, ', '.join(args))


class CountingMetric(Metric):
    """Count things.

    Counters track how many times something happened per second,
    like the number of database requests or page views.
    """


class GaugeMetric(Metric):
    """Measure the value of a particular thing over time.

    Gauges measure the value of a particular thing at a particular time,
    like the amount of fuel in a car’s gas tank or the number of users
    connected to a system.
    """


class HistogramMetric(Metric):
    """Measure the statistical distribution of a set of values.

    Histograms track the statistical distribution of a set of values,
    like the duration of a number of database queries or the size of files
    uploaded by users.
    """


class SetMetric(Metric):
    """Count the number of unique elements in a group.

    Sets are used to count the number of unique elements in a group.
    If you want to track the number of unique visitor to your site,
    sets are a great way to do that.
    """


class TimingMetric(Metric):
    """Measure the statistical distribution of a set of values.

    StatsD only supports histograms for timing, not generic values (like
    the size of uploaded files or the number of rows returned from a query).
    Timers are essentially a special case of histograms, so they are treated
    in the same manner by DogStatsD for backwards compatibility.
    """