コード例 #1
0
def get_available_memory_metric():
    """ Returns a derived gauge for available memory

    Available memory is defined as memory that can be given instantly to
    processes without the system going into swap.

    :rtype: :class:`opencensus.metrics.export.gauge.DerivedLongGauge`
    :return: The gauge representing the available memory metric
    """
    gauge = DerivedLongGauge(AVAILABLE_MEMORY,
                             'Amount of available memory in bytes', 'byte', [])
    gauge.create_default_time_series(get_available_memory)
    return gauge
コード例 #2
0
def get_process_private_bytes_metric():
    """ Returns a derived gauge for private bytes for the current process

    Private bytes for the current process is measured by the Resident Set
    Size, which is the non-swapped physical memory a process has used.

    :rtype: :class:`opencensus.metrics.export.gauge.DerivedLongGauge`
    :return: The gauge representing the private bytes metric
    """
    gauge = DerivedLongGauge(PRIVATE_BYTES,
                             'Amount of memory process has used in bytes',
                             'byte', [])
    gauge.create_default_time_series(get_process_private_bytes)
    return gauge
コード例 #3
0
    def __call__(self):
        """ Returns a derived gauge for private bytes for the current process

        Private bytes for the current process is measured by the Resident Set
        Size, which is the non-swapped physical memory a process has used.

        :rtype: :class:`opencensus.metrics.export.gauge.DerivedLongGauge`
        :return: The gauge representing the private bytes metric
        """
        gauge = DerivedLongGauge(ProcessMemoryMetric.NAME,
                                 'Amount of memory process has used in bytes',
                                 'byte', [])
        gauge.create_default_time_series(ProcessMemoryMetric.get_value)
        return gauge
コード例 #4
0
    def __call__(self):
        """ Returns a derived gauge for available memory

        Available memory is defined as memory that can be given instantly to
        processes without the system going into swap.

        :rtype: :class:`opencensus.metrics.export.gauge.DerivedLongGauge`
        :return: The gauge representing the available memory metric
        """
        gauge = DerivedLongGauge(AvailableMemoryMetric.NAME,
                                 'Amount of available memory in bytes', 'byte',
                                 [])
        gauge.create_default_time_series(AvailableMemoryMetric.get_value)
        return gauge