All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.wavefront.agent.preprocessor.ReportPointAddPrefixTransformer Maven / Gradle / Ivy

There is a newer version: 9999.0
Show newest version
package com.wavefront.agent.preprocessor;

import com.google.common.base.Function;

import javax.annotation.Nullable;

import wavefront.report.ReportPoint;

/**
 * Add prefix transformer. Add a metric name prefix, if defined, to all points.
 *
 * Created by Vasily on 9/15/16.
 */
public class ReportPointAddPrefixTransformer implements Function {

  @Nullable
  private final String prefix;

  public ReportPointAddPrefixTransformer(@Nullable final String prefix) {
    this.prefix = prefix;
  }

  @Nullable
  @Override
  public ReportPoint apply(@Nullable ReportPoint reportPoint) {
    if (reportPoint == null) return null;
    if (prefix != null && !prefix.isEmpty()) {
      reportPoint.setMetric(prefix + "." + reportPoint.getMetric());
    }
    return reportPoint;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy