test_class.declarator: logger = LoggerFactory.getLogger(GraphiteFormatterTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger logger = LoggerFactory.getLogger(GraphiteFormatterTest.class);
test_class.type: Logger
test_class.var_name: logger
test_class.file: proxy/src/test/java/com/wavefront/agent/formatter/GraphiteFormatterTest.java
test_class.identifier: GraphiteFormatterTest
test_case.body: @Test
    public void testFieldsToRemove() {
      String format = "2"; // Extract the 2nd field for host name
      String delimiter = "_";
      String remove = "1,3";  // remove the 1st and 3rd fields from metric name
  
      // Test input
      String testString1 = "hosts.host1.collectd.cpu.loadavg.1m 40";
      String testString2 = "hosts.host1.collectd.cpu.loadavg.1m 7 1459527231";
  
      // Test output
      String expected1 = "cpu.loadavg.1m 40 source=host1";
      String expected2 = "cpu.loadavg.1m 7 1459527231 source=host1";
  
      GraphiteFormatter formatter = new GraphiteFormatter(format, delimiter, remove);
      assertEquals(expected1, formatter.apply(testString1));
      assertEquals(expected2, formatter.apply(testString2));
    }
test_case.class_method_signature: GraphiteFormatterTest.testFieldsToRemove()
test_case.full_signature: @Test public void testFieldsToRemove()
test_case.identifier: testFieldsToRemove
test_case.invocations: assertEquals apply assertEquals apply
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFieldsToRemove()
focal_class.declarator: metricMangler
focal_class.modifier: private final
focal_class.original_string: private final MetricMangler metricMangler;
focal_class.type: MetricMangler
focal_class.var_name: metricMangler
focal_class.declarator: ops = new AtomicLong()
focal_class.modifier: private final
focal_class.original_string: private final AtomicLong ops = new AtomicLong();
focal_class.type: AtomicLong
focal_class.var_name: ops
focal_class.file: proxy/src/main/java/com/wavefront/agent/formatter/GraphiteFormatter.java
focal_class.identifier: GraphiteFormatter
focal_class.interfaces: implements Function<String, String>
focal_class.class_method_signature: GraphiteFormatter.GraphiteFormatter(String strFields, String strDelimiters, String strFieldsToRemove)
focal_class.full_signature: public  GraphiteFormatter(String strFields, String strDelimiters, String strFieldsToRemove)
focal_class.identifier: GraphiteFormatter
focal_class.modifiers: public
focal_class.parameters: (String strFields, String strDelimiters, String strFieldsToRemove)
focal_class.signature:  GraphiteFormatter(String strFields, String strDelimiters, String strFieldsToRemove)
focal_class.class_method_signature: GraphiteFormatter.getOps()
focal_class.full_signature: public long getOps()
focal_class.identifier: getOps
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getOps()
focal_class.class_method_signature: GraphiteFormatter.getMetricMangler()
focal_class.full_signature: public MetricMangler getMetricMangler()
focal_class.identifier: getMetricMangler
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: MetricMangler
focal_class.signature: MetricMangler getMetricMangler()
focal_class.class_method_signature: GraphiteFormatter.apply(String mesg)
focal_class.full_signature: @Override public String apply(String mesg)
focal_class.identifier: apply
focal_class.modifiers: @Override public
focal_class.parameters: (String mesg)
focal_class.return: String
focal_class.signature: String apply(String mesg)
focal_method.body: @Override
    public String apply(String mesg) {
      // Resting place for output
      StringBuilder finalMesg = new StringBuilder();
  
      // 1. Extract fields
      String[] regions = mesg.trim().split(" ");
      final MetricMangler.MetricComponents components = metricMangler.extractComponents(regions[0]);
      
      finalMesg.append(components.metric);
      finalMesg.append(" ");
  
      // 2. Add back value, timestamp if existent, etc. We don't assume you have point tags
      //  because your first tag BETTER BE A HOST, BUDDY.
      for (int index = 1; index < regions.length; index++) {
        finalMesg.append(regions[index]);
        finalMesg.append(" ");
      }
  
      // 3. Add source, if available
      if (components.source != null) {
        finalMesg.append("source=");
        finalMesg.append(components.source);
      }
  
      // 4. Add Graphite 1.1+ tags
      if (components.annotations != null) {
        for (int index = 0; index < components.annotations.length; index++) {
          finalMesg.append(" ");
          finalMesg.append(components.annotations[index]);
        }
      }
  
      ops.incrementAndGet();
  
      return finalMesg.toString();
    }
focal_method.class_method_signature: GraphiteFormatter.apply(String mesg)
focal_method.full_signature: @Override public String apply(String mesg)
focal_method.identifier: apply
focal_method.invocations: split trim extractComponents append append append append append append append append incrementAndGet toString
focal_method.modifiers: @Override public
focal_method.parameters: (String mesg)
focal_method.return: String
focal_method.signature: String apply(String mesg)