Configure the {@link ReturnValue} we are building with the specified
metric.

@param pluginMetric
The metric for which we want to compute the result Status.

@return this
510532
public ReturnValueBuilder withValue(final Metric pluginMetric) {
        if (thresholds.isMetricRequired(pluginMetric.getMetricName())) {
            Status newStatus = thresholds.evaluate(pluginMetric);
            if (newStatus.getSeverity() > status.getSeverity()) {
                status = newStatus;
            }

            IThreshold thr = thresholds.getThreshold(pluginMetric.getMetricName());

            formatResultMessage(pluginMetric);

            retVal.withPerformanceData(pluginMetric, thr);
        }
        return this;
    }
1049479
protected void configureMetrics() {
        setConfigProperty(GatewayConfigProperties.METRICS_CLASS, ESMetrics.class.getName());
        setConfigProperty(GatewayConfigProperties.METRICS_CLASS + ".client.type", "jest");
        setConfigProperty(GatewayConfigProperties.METRICS_CLASS + ".client.protocol", "${apiman.es.protocol}");
        setConfigProperty(GatewayConfigProperties.METRICS_CLASS + ".client.host", "${apiman.es.host}");
        setConfigProperty(GatewayConfigProperties.METRICS_CLASS + ".client.port", "${apiman.es.port}");
        setConfigProperty(GatewayConfigProperties.METRICS_CLASS + ".client.username", "${apiman.es.username}");
        setConfigProperty(GatewayConfigProperties.METRICS_CLASS + ".client.password", "${apiman.es.password}");
        setConfigProperty(GatewayConfigProperties.METRICS_CLASS + ".client.index", "apiman_metrics");
    }
56957
@Override public ModelMetrics.MetricBuilder makeMetricBuilder(String[] domain) {
    switch(_output.getModelCategory()) {
      case Binomial:    return new ModelMetricsBinomial.MetricBuilderBinomial(domain);
      case Multinomial: return new ModelMetricsMultinomial.MetricBuilderMultinomial(domain.length,domain);
      default: throw H2O.unimpl();
    }
  }
813544
protected void newMetricContext(MetricContext context) {
    if (this.contextFilter.matches(context)) {
      this.contextsToReport.add(context.getInnerMetricContext());
    }
  }
476713
@VisibleForTesting
  static MetricDescriptor.ValueType createValueType(Type type) {
    if (type == Type.CUMULATIVE_DOUBLE || type == Type.GAUGE_DOUBLE) {
      return MetricDescriptor.ValueType.DOUBLE;
    } else if (type == Type.GAUGE_INT64 || type == Type.CUMULATIVE_INT64) {
      return MetricDescriptor.ValueType.INT64;
    } else if (type == Type.GAUGE_DISTRIBUTION || type == Type.CUMULATIVE_DISTRIBUTION) {
      return MetricDescriptor.ValueType.DISTRIBUTION;
    }
    return MetricDescriptor.ValueType.UNRECOGNIZED;
  }
28278
public ResultByTime withTotal(java.util.Map<String, MetricValue> total) {
        setTotal(total);
        return this;
    }
947851
@GuardedBy("monitor")
  @VisibleForTesting
  static MetricServiceClient createMetricServiceClient(@Nullable Credentials credentials)
      throws IOException {
    MetricServiceSettings.Builder settingsBuilder =
        MetricServiceSettings.newBuilder()
            .setTransportChannelProvider(
                InstantiatingGrpcChannelProvider.newBuilder()
                    .setHeaderProvider(OPENCENSUS_USER_AGENT_HEADER_PROVIDER)
                    .build());
    if (credentials != null) {
      settingsBuilder.setCredentialsProvider(FixedCredentialsProvider.create(credentials));
    }
    return MetricServiceClient.create(settingsBuilder.build());
  }
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();
    }
  }
138941
public void addMetric(Metric metric)
    {
        if(this.metrics == null)
            this.metrics = new ArrayList<Metric>();
        this.metrics.add(metric);
    }
481272
public void setMetricAlarms(java.util.Collection<MetricAlarm> metricAlarms) {
        if (metricAlarms == null) {
            this.metricAlarms = null;
            return;
        }

        this.metricAlarms = new com.amazonaws.internal.SdkInternalList<MetricAlarm>(metricAlarms);
    }
10527
public MetricBuilder withMinValue(Number value, String prettyPrintFormat) {
        min = new MetricValue(value.toString(), prettyPrintFormat);            
        return this;
    }
255584
private void formatResultMessage(final Metric pluginMetric) {
        if (StringUtils.isEmpty(pluginMetric.getMessage())) {
            return;
        }

        if (StringUtils.isEmpty(retValMessage)) {
            retValMessage = pluginMetric.getMessage();
            return;
        }
        retValMessage += " " + pluginMetric.getMessage();
    }
1092951
public void setMetricsTrackerFactory(MetricsTrackerFactory metricsTrackerFactory)
   {
      if (metricsTrackerFactory != null) {
         this.metricsTracker = new MetricsTrackerDelegate(metricsTrackerFactory.create(config.getPoolName(), getPoolStats()));
      }
      else {
         this.metricsTracker = new NopMetricsTrackerDelegate();
      }
   }
680966
public void record(String metric, double value) {
    mTimeSeries.compute(metric, (metricName, timeSeries) -> {
      if (timeSeries == null) {
        timeSeries = new TimeSeries(metricName);
      }
      timeSeries.record(value);
      return timeSeries;
    });
  }
417527
public List<CustomMeasureDto> selectByMetricKeyAndTextValue(DbSession session, String metricKey, String textValue) {
    return mapper(session).selectByMetricKeyAndTextValue(metricKey, textValue);
  }
1337342
public void setMetric(String metric) {
        SystemAssert.requireArgument(metric != null && !metric.isEmpty(), "Metric cannot be null or empty.");
        this.metric = metric;
    }
824074
public void startMetricReporting(Configuration configuration) {
    Properties props = new Properties();
    for (Map.Entry<String, String> entry : configuration) {
      props.put(entry.getKey(), entry.getValue());
    }
    startMetricReporting(props);
  }