private transformFn()

in glean/src/core/metrics/types/custom_distribution.ts [170:189]


  private transformFn(samples: number[]) {
    return (old?: JSONValue): CustomDistributionMetric => {
      const values = extractAccumulatedValuesFromJsonValue(old);

      const convertedSamples: number[] = [];
      samples.forEach((sample) => {
        if (sample >= 0) {
          convertedSamples.push(sample);
        }
      });

      return new CustomDistributionMetric({
        values: [...values, ...convertedSamples],
        rangeMin: this.rangeMin,
        rangeMax: this.rangeMax,
        bucketCount: this.bucketCount,
        histogramType: this.histogramType
      });
    };
  }