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

com.wavefront.ingester.ReportPointDecoder Maven / Gradle / Ivy

There is a newer version: 2023-22.3
Show newest version
package com.wavefront.ingester;

import javax.annotation.Nullable;
import java.util.List;
import java.util.function.Supplier;

import wavefront.report.ReportPoint;

/**
 * DEPRECATED: use {@link ReportMetricDecoder} instead.
 *
 * Graphite decoder that takes in a point of the type:
 *
 * [metric] [value] [timestamp] [annotations]
 *
 * @author Clement Pang ([email protected]).
 */
@Deprecated
public class ReportPointDecoder implements ReportableEntityDecoder {
  private static final AbstractIngesterFormatter FORMAT =
      ReportPointIngesterFormatter.newBuilder().
          text(ReportPoint::setMetric).
          value(ReportPoint::setValue).
          optionalTimestamp(ReportPoint::setTimestamp).
          annotationMap(ReportPoint::setAnnotations).
          build();
  private final Supplier hostNameSupplier;
  private List customSourceTags;

  public ReportPointDecoder(@Nullable Supplier hostNameSupplier,
                            List customSourceTags) {
    this.hostNameSupplier = hostNameSupplier;
    this.customSourceTags = customSourceTags;
  }

  @Override
  public void decode(String msg, List out, String customerId,
                     IngesterContext ctx) {
    ReportPoint point = FORMAT.drive(msg, hostNameSupplier, customerId, customSourceTags, null, null,
            null, null, null, null,  ctx);
    if (out != null) {
      out.add(point);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy