コード例 #1
0
    def to_point_value(self):
        """Get a point value conversion of the current value.

        :rtype: :class:`opencensus.metrics.export.value.ValueDouble`
        :return: A converted `ValueDouble`.
        """
        return value_module.ValueDouble(self.value)
コード例 #2
0
    def to_point(self, timestamp):
        """Get a Point conversion of this aggregation.

        :type timestamp: :class: `datetime.datetime`
        :param timestamp: The time to report the point as having been recorded.

        :rtype: :class: `opencensus.metrics.export.point.Point`
        :return: a :class: `opencensus.metrics.export.value.ValueDouble`-valued
        Point with value equal to `sum_data`.
        """
        return point.Point(value.ValueDouble(self.sum_data), timestamp)
コード例 #3
0
    def test_check_points_type(self):
        ts = time_series.TimeSeries(LABEL_VALUES, POINTS, START_TIMESTAMP)
        self.assertTrue(ts.check_points_type(value.ValueLong))

        bad_points = POINTS + (point.Point(value.ValueDouble(6.0),
                                           "2018-10-10T04:33:44.012345Z"), )
        bad_time_series = time_series.TimeSeries(LABEL_VALUES, bad_points,
                                                 START_TIMESTAMP)

        self.assertFalse(bad_time_series.check_points_type(value.ValueLong))
        self.assertFalse(bad_time_series.check_points_type(value.ValueLong))
コード例 #4
0
    def setUp(self):
        self.double_value = value_module.ValueDouble(55.5)
        self.long_value = value_module.ValueLong(9876543210)
        self.timestamp = '2018-10-06T17:57:57.936475Z'

        value_at_percentile = [summary_module.ValueAtPercentile(99.5, 10.2)]
        snapshot = summary_module.Snapshot(10, 87.07, value_at_percentile)
        self.summary = summary_module.Summary(10, 6.6, snapshot)
        self.summary_value = value_module.ValueSummary(self.summary)
        self.distribution_value = value_module.ValueDistribution(
            100,
            1000.0,
            10.0,
            value_module.BucketOptions(
                value_module.Explicit(list(range(1, 10)))),
            [value_module.Bucket(10, None) for ii in range(10)],
        )
コード例 #5
0
ファイル: test_value.py プロジェクト: zyxue/opencensus-python
    def test_create_double_value(self):
        double_value = value_module.ValueDouble(-34.56)

        self.assertIsNotNone(double_value)
        self.assertIsInstance(double_value, value_module.ValueDouble)
        self.assertEqual(double_value.value, -34.56)