コード例 #1
0
 def test_meter(self):
     with self.assertRaises(TypeError):
         # pylint: disable=abstract-class-instantiated
         metrics.Meter()  # type:ignore
コード例 #2
0
 def setUp(self):
     self.meter = metrics.Meter()
コード例 #3
0
 def test_meter(self):
     meter = metrics.Meter()
     metric = meter.create_metric("", "", "", float, metrics.Counter)
     self.assertIsInstance(metric, metrics.DefaultMetric)
コード例 #4
0
ファイル: raw.py プロジェクト: ramthi/opentelemetry-python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# pylint: skip-file
from opentelemetry import metrics

METER = metrics.Meter()
MEASURE = metrics.create_measure(
    "idle_cpu_percentage",
    "cpu idle over time",
    "percentage",
    metrics.ValueType.FLOAT,
    ["environment"],
)

# Metrics sent to some exporter
MEASURE_METRIC_TESTING = MEASURE.get_handle("Testing")
MEASURE_METRIC_STAGING = MEASURE.get_handle("Staging")

# record individual measures
STATISTIC = 100
MEASURE_METRIC_STAGING.record(STATISTIC)