docstr: Collect fetches the statistics from OpenCensus
  and delivers them as Prometheus Metrics.
  Collect is invoked every time a prometheus.Gatherer is run
  for example when the HTTP endpoint is invoked by Prometheus.
  
  This method is required as a Prometheus Collector.
docstr_tok: ["Collect","fetches","the","statistics","from","OpenCensus","and","delivers","them","as","Prometheus","Metrics",".","Collect","is","invoked","every","time","a","prometheus.Gatherer","is","run","for","example","when","the","HTTP","endpoint","is","invoked","by","Prometheus",".","This","method","is","required","as","a","Prometheus","Collector","."]
code: def collect(self):  # pragma: NO COVER
      """Collect fetches the statistics from OpenCensus
      and delivers them as Prometheus Metrics.
      Collect is invoked every time a prometheus.Gatherer is run
      for example when the HTTP endpoint is invoked by Prometheus.
  
      This method is required as a Prometheus Collector.
      """
      with self._components_lock:
          metrics_map = {}
          for component in self._components.values():
              for metric in component.metrics.values():
                  for label_values, data in metric.data.items():
                      self.to_metric(
                          metric.name,
                          metric.desc,
                          metric.label_keys,
                          metric.unit,
                          label_values,
                          data,
                          metrics_map,
                      )
  
      for metric in metrics_map.values():
          yield metric
  
imports: import json
  import logging
  import os
  import re
  import threading
  import time
  import traceback
  from collections import namedtuple
  from typing import List, Tuple, Any, Dict
  from prometheus_client.core import CounterMetricFamily, GaugeMetricFamily, HistogramMetricFamily
  from opencensus.metrics.export.value import ValueDouble
  from opencensus.stats import aggregation
  from opencensus.stats import measure
  from opencensus.stats.view_manager import ViewManager
  from opencensus.stats.stats_recorder import StatsRecorder
  from opencensus.stats.base_exporter import StatsExporter
  from prometheus_client.core import Metric
  from opencensus.stats.aggregation_data import CountAggregationData, DistributionAggregationData, LastValueAggregationData
  from opencensus.stats.view import View
  from opencensus.tags import tag_key
  from opencensus.tags import tag_map
  from opencensus.tags import tag_value
  import ray
  from ray._raylet import GcsClient
  from ray.core.generated.metrics_pb2 import Metric
label_desc: Use image node_id 5 for calling the OpenCensusProxyCollector obj's underlying member method code with example usage: obj.collect() without return types