public static void write004(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) throws IOException {
    /* See http://prometheus.io/docs/instrumenting/exposition_formats/
     * for the output format specification. */
    while(mfs.hasMoreElements()) {
      Collector.MetricFamilySamples metricFamilySamples = mfs.nextElement();
      writer.write("# HELP ");
      writer.write(metricFamilySamples.name);
      writer.write(' ');
      writeEscapedHelp(writer, metricFamilySamples.help);
      writer.write('\n');

      writer.write("# TYPE ");
      writer.write(metricFamilySamples.name);
      writer.write(' ');
      writer.write(typeString(metricFamilySamples.type));
      writer.write('\n');

      for (Collector.MetricFamilySamples.Sample sample: metricFamilySamples.samples) {
        writer.write(sample.name);
        if (sample.labelNames.size() > 0) {
          writer.write('{');
          for (int i = 0; i < sample.labelNames.size(); ++i) {
            writer.write(sample.labelNames.get(i));
            writer.write("=\"");
            writeEscapedLabelValue(writer, sample.labelValues.get(i));
            writer.write("\",");
          }
          writer.write('}');
        }
        writer.write(' ');
        writer.write(Collector.doubleToGoString(sample.value));
        if (sample.timestampMs != null){
          writer.write(' ');
          writer.write(sample.timestampMs.toString());
        }
        writer.write('\n');
      }
    }
  }
public static void write004 ( Writer writer , Enumeration < Collector . MetricFamilySamples > mfs ) throws IOException { while ( mfs . hasMoreElements ( ) ) { Collector . MetricFamilySamples metricFamilySamples = mfs . nextElement ( ) ; writer . write ( "# HELP " ) ; writer . write ( metricFamilySamples . name ) ; writer . write ( ' ' ) ; writeEscapedHelp ( writer , metricFamilySamples . help ) ; writer . write ( '\n' ) ; writer . write ( "# TYPE " ) ; writer . write ( metricFamilySamples . name ) ; writer . write ( ' ' ) ; writer . write ( typeString ( metricFamilySamples . type ) ) ; writer . write ( '\n' ) ; for ( Collector . MetricFamilySamples . Sample sample : metricFamilySamples . samples ) { writer . write ( sample . name ) ; if ( sample . labelNames . size ( ) > 0 ) { writer . write ( '{' ) ; for ( int i = 0 ; i < sample . labelNames . size ( ) ; ++ i ) { writer . write ( sample . labelNames . get ( i ) ) ; writer . write ( "=\"" ) ; writeEscapedLabelValue ( writer , sample . labelValues . get ( i ) ) ; writer . write ( "\"," ) ; } writer . write ( '}' ) ; } writer . write ( ' ' ) ; writer . write ( Collector . doubleToGoString ( sample . value ) ) ; if ( sample . timestampMs != null ) { writer . write ( ' ' ) ; writer . write ( sample . timestampMs . toString ( ) ) ; } writer . write ( '\n' ) ; } } }
Write out the text version 0.0.4 of the given MetricFamilySamples.