Generates metrics for the instrumentation of this class.
171797
protected void regenerateMetrics() {
    if (isInstrumentationEnabled()) {
      this.readRecordsMeter = Optional.of(this.metricContext.meter(MetricNames.ExtractorMetrics.RECORDS_READ_METER));
      this.dataRecordExceptionsMeter =
          Optional.of(this.metricContext.meter(MetricNames.ExtractorMetrics.RECORDS_FAILED_METER));
      this.extractorTimer = Optional.<Timer>of(this.metricContext.timer(MetricNames.ExtractorMetrics.EXTRACT_TIMER));
    } else {
      this.readRecordsMeter = Optional.absent();
      this.dataRecordExceptionsMeter = Optional.absent();
      this.extractorTimer = Optional.absent();
    }
  }
779398
def _write_metrics(self, iteration:int, last_metrics:MetricsList, start_idx:int=2)->None:
        ""
        recorder = self.learn.recorder
        for i, name in enumerate(recorder.names[start_idx:]):
            if last_metrics is None or len(last_metrics) < i+1: return
            scalar_value = last_metrics[i]
            self._write_scalar(name=name, scalar_value=scalar_value, iteration=iteration)
813752
private void addMetric(
      List<Metric> metrics,
      String name,
      TagList tags,
      Object value) {
    long now = System.currentTimeMillis();
    if (onlyNumericMetrics) {
      value = asNumber(value);
    }
    if (value != null) {

      TagList newTags = counters.matches(MonitorConfig.builder(name).withTags(tags).build())
          ? getTagListWithAdditionalTag(tags, DataSourceType.COUNTER)
          : getTagListWithAdditionalTag(tags, DataSourceType.GAUGE);
      Metric m = new Metric(name, newTags, now, value);
      metrics.add(m);
    }
  }
1047822
def make_log_metric(level=logging.INFO, msg="%d items in %.2f seconds"):
    
    def log_metric(name, count, elapsed):
        log_name = 'instrument.{}'.format(name) if name else 'instrument'
        logging.getLogger(log_name).log(level, msg, count, elapsed)
    return log_metric
1351736
def result_report_class_wise(self):
        

        results = self.results_class_wise_metrics()

        output = self.ui.section_header('Class-wise metrics', indent=2) + '\n'
        output += self.ui.row(
            'Tag', 'Nref', 'Nsys', 'F-score', 'Pre', 'Rec', 'EER',
            widths=[20, 12, 12, 12, 12, 12, 12],
            separators=[True, False, True, False, False, True, False],
            indent=4
        ) + '\n'
        output += self.ui.row('-', '-', '-', '-', '-', '-', '-') + '\n'

        for tag_label in self.tag_label_list:
            if results[tag_label]['f_measure']['f_measure'] is not None:
                f_measure = results[tag_label]['f_measure']['f_measure'] * 100

            else:
                f_measure = None

            if results[tag_label]['f_measure']['precision'] is not None:
                precision = results[tag_label]['f_measure']['precision'] * 100

            else:
                precision = None

            if results[tag_label]['f_measure']['recall'] is not None:
                recall = results[tag_label]['f_measure']['recall'] * 100

            else:
                recall = None

            if results[tag_label]['eer']['eer'] is not None:
                eer = results[tag_label]['eer']['eer'] * 100

            else:
                eer = None

            output += self.ui.row(
                tag_label,
                results[tag_label]['count']['Nref'],
                results[tag_label]['count']['Nsys'],
                f_measure,
                precision,
                recall,
                eer,
                types=['str', 'int', 'int', 'float1_percentage', 'float1', 'float1', 'float1_percentage']
            ) + '\n'

        return output
1140275
def metrics(self):
        
        from vel.metrics.loss_metric import Loss
        from vel.metrics.accuracy import Accuracy
        return [Loss(), Accuracy()]
864940
public void registerMetrics(MetricRegistry metricRegistry) {
        if (id() != null) {
            metricName = MetricRegistry.name(Pipeline.class, id(), "executed");
            executed = metricRegistry.meter(metricName);
        }
    }
1244626
def _gen_indicator_class(self):
        """"""

        for entry in self.tcex.indicator_types_data.values():
            name = entry.get('name')
            class_name = name.replace(' ', '')
            # temp fix for API issue where boolean are returned as strings
            entry['custom'] = self.tcex.utils.to_bool(entry.get('custom'))

            if class_name in globals():
                # skip Indicator Type if a class already exists
                continue

            # Custom Indicator can have 3 values. Only add the value if it is set.
            value_fields = []
            if entry.get('value1Label'):
                value_fields.append(entry['value1Label'])
            if entry.get('value2Label'):
                value_fields.append(entry['value2Label'])
            if entry.get('value3Label'):
                value_fields.append(entry['value3Label'])
            value_count = len(value_fields)

            class_data = {}
            # Add Class for each Custom Indicator type to this module
            custom_class = custom_indicator_class_factory(name, Indicator, class_data, value_fields)
            setattr(module, class_name, custom_class)

            # Add Custom Indicator Method
            self._gen_indicator_method(name, custom_class, value_count)
1341188
def metric(cls, name, count, elapsed):
        

        if name is None:
            warnings.warn("Ignoring unnamed metric", stacklevel=3)
            return

        with cls.lock:
            # register with atexit on first call
            if cls.dump_atexit and not cls.instances:
                atexit.register(cls.dump)

            try:
                self = cls.instances[name]
            except KeyError:
                self = cls.instances[name] = cls(name)

            self.temp.write(self.struct.pack(count, elapsed))
27289
protected void regenerateMetrics() {
    if (isInstrumentationEnabled()) {
      this.datasetsCleanFailureMeter =
          Optional.of(this.metricContext.meter(DatasetCleanerMetrics.DATASETS_CLEAN_FAILURE));
      this.datasetsCleanSuccessMeter =
          Optional.of(this.metricContext.meter(DatasetCleanerMetrics.DATASETS_CLEAN_SUCCESS));
    }
  }
1058271
def process_metrics(self, snmp_data):
        ""
        self.metrics = {}
        for i in range(0, len(snmp_data)):
            mib_name = self.models[self.modem_type]['metrics'][i]
            conv = metric_mib[mib_name]['conv']
            self.metrics[mib_name] = conv(snmp_data[i])
567167
def _generate_metrics(bam_fname, config_file, ref_file,
                      bait_file, target_file):
    
    with open(config_file) as in_handle:
        config = yaml.safe_load(in_handle)
    broad_runner = broad.runner_from_config(config)
    bam_fname = os.path.abspath(bam_fname)
    path = os.path.dirname(bam_fname)
    out_dir = os.path.join(path, "metrics")
    utils.safe_makedir(out_dir)
    with utils.chdir(out_dir):
        with tx_tmpdir() as tmp_dir:
            cur_bam = os.path.basename(bam_fname)
            if not os.path.exists(cur_bam):
                os.symlink(bam_fname, cur_bam)
            gen_metrics = PicardMetrics(broad_runner, tmp_dir)
            gen_metrics.report(cur_bam, ref_file,
                               _bam_is_paired(bam_fname),
                               bait_file, target_file)
    return out_dir
1263727
private void generateOutput() {
    final Filer filer = processingEnv.getFiler();
    writeJsonToFile(filer, "JSONClasses", jsonClasses);
    writeJsonToFile(filer, "debugcrud", debugMessages);

    final List<ResourceMethod> resources = Lists.newArrayList();
    for (ResourceClass klass : resourceClasses.values()) {
      final String path = klass.getPath();

      for (final ResourceMethod method : klass.getMembers()) {
        resources.add(new ResourceMethod("", method.getMethod(),
            computeDisplayPath(path, method.getPath()),
            method.getReturnContentType(), method.getReturnType(), method.getArguments(),
            method.getJavadoc()));
      }
    }
    writeJsonToFile(filer, "RESTEndpoints", resources);
  }
1349233
private void writeMetrics() throws IOException {
        if (metrics.size() > 0) {
            try {
                byte[] payload = pickleMetrics(metrics);
                byte[] header = ByteBuffer.allocate(4).putInt(payload.length).array();

                OutputStream outputStream = socket.getOutputStream();
                outputStream.write(header);
                outputStream.write(payload);
                outputStream.flush();

                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Wrote {} metrics", metrics.size());
                }
            } catch (IOException e) {
                this.failures++;
                throw e;
            } finally {
                // if there was an error, we might miss some data. for now, drop those on the floor and
                // try to keep going.
                metrics.clear();
            }

        }
    }
485808
protected void regenerateMetrics() {
    if (isInstrumentationEnabled()) {
      this.recordsInMeter = Optional.of(this.metricContext.meter(MetricNames.DataWriterMetrics.RECORDS_IN_METER));
      this.successfulWritesMeter =
          Optional.of(this.metricContext.meter(MetricNames.DataWriterMetrics.SUCCESSFUL_WRITES_METER));
      this.failedWritesMeter = Optional.of(this.metricContext.meter(MetricNames.DataWriterMetrics.FAILED_WRITES_METER));
      setRecordsWrittenMeter(isInstrumentationEnabled());
      setBytesWrittenMeter(isInstrumentationEnabled());
      this.dataWriterTimer = Optional.<Timer>of(this.metricContext.timer(MetricNames.DataWriterMetrics.WRITE_TIMER));
    } else {
      this.recordsInMeter = Optional.absent();
      this.successfulWritesMeter = Optional.absent();
      this.failedWritesMeter = Optional.absent();
      setRecordsWrittenMeter(isInstrumentationEnabled());
      setBytesWrittenMeter(isInstrumentationEnabled());
      this.dataWriterTimer = Optional.absent();
    }
  }
1135438
def stats(self):
        
        printDebug("Classes.....: %d" % len(self.classes))
        printDebug("Properties..: %d" % len(self.properties))
1155926
def log_metrics(self, metrics_by_name, info):
        
        if self.metrics is None:
            # If, for whatever reason, the metrics collection has not been set
            # do not try to save anything there.
            return
        for key in metrics_by_name:
            query = {"run_id": self.run_entry['_id'],
                     "name": key}
            push = {"steps": {"$each": metrics_by_name[key]["steps"]},
                    "values": {"$each": metrics_by_name[key]["values"]},
                    "timestamps": {"$each": metrics_by_name[key]["timestamps"]}
                    }
            update = {"$push": push}
            result = self.metrics.update_one(query, update, upsert=True)
            if result.upserted_id is not None:
                # This is the first time we are storing this metric
                info.setdefault("metrics", []) \
                    .append({"name": key, "id": str(result.upserted_id)})