code: def test_metrics(self):
      sampler = statesampler.StateSampler("", counters.CounterFactory())
      statesampler.set_current_tracker(sampler)
      state1 = sampler.scoped_state(
          "mystep",
          "myState",
          metrics_container=MetricsContainer("mystep"),
      )
  
      try:
          sampler.start()
          with state1:
              counter = MetricTests.base_metric_group.counter(
                  "my_counter"
              )
              meter = MetricTests.base_metric_group.meter("my_meter")
              distribution = MetricTests.base_metric_group.distribution(
                  "my_distribution"
              )
              container = MetricsEnvironment.current_container()
  
              self.assertEqual(0, counter.get_count())
              self.assertEqual(0, meter.get_count())
              self.assertEqual(
                  DistributionData(0, 0, 0, 0),
                  container.get_distribution(
                      MetricName("[]", "my_distribution")
                  ).get_cumulative(),
              )
              counter.inc(-2)
              meter.mark_event(3)
              distribution.update(10)
              distribution.update(2)
              self.assertEqual(-2, counter.get_count())
              self.assertEqual(3, meter.get_count())
              self.assertEqual(
                  DistributionData(12, 2, 2, 10),
                  container.get_distribution(
                      MetricName("[]", "my_distribution")
                  ).get_cumulative(),
              )
      finally:
          sampler.stop()
  
file_path: flink/flink-python/pyflink/fn_execution/metrics/tests/test_metric.py
imports: from apache_beam.metrics.cells import DistributionData
  from apache_beam.metrics.execution import MetricsContainer
  from apache_beam.metrics.execution import MetricsEnvironment
  from apache_beam.metrics.metricbase import MetricName
  from apache_beam.runners.worker import statesampler
  from apache_beam.utils import counters
  from pyflink.fn_execution.metrics.process.metric_impl import GenericMetricGroup
  from pyflink.metrics.metricbase import MetricGroup
  from pyflink.table import FunctionContext
  from pyflink.testing.test_case_utils import PyFlinkTestCase
label_desc: Use image node_id 6 for calling the MetricTests obj's underlying member method code with example usage: obj.test_metrics() without return types