Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

/** Builder for sketch timeseries. */
public class SketchMetric extends Metric<SketchMetric> {
private static final int VALUES_PER_SKETCH_POINT = 4;

SketchMetric(PayloadBuilder pb, int type, String name) {
super(pb, type, name);
Expand All @@ -25,7 +24,6 @@ protected SketchMetric self() {
*
* @param timestamp Timestamp of the point in seconds since Unix epoch.
* @param sum Total sum of all observed values.
* @param avg Average of all observed values.
* @param min Minimum observed value.
* @param max Maximum observed value.
* @param cnt Number of observed values.
Expand All @@ -36,7 +34,6 @@ protected SketchMetric self() {
public SketchMetric addPoint(
long timestamp,
double sum,
double avg,
double min,
double max,
long cnt,
Expand All @@ -49,7 +46,6 @@ public SketchMetric addPoint(

pb.timestamps.put(timestamp);
pb.values.put(sum);
pb.values.put(avg);
pb.values.put(min);
pb.values.put(max);
pb.counts.put(cnt);
Expand All @@ -66,6 +62,8 @@ public SketchMetric addPoint(
return this;
}

private static final int VALUES_PER_SKETCH_POINT = 3;

@Override
void encodeValues(ValueType valueType) {
ColumnarBuffer r = pb.currentRecord();
Expand All @@ -88,9 +86,6 @@ void encodeValues(ValueType valueType) {
r.putSint64(
Column.valsSint64,
(long) pb.values.get(VALUES_PER_SKETCH_POINT * i + 2));
r.putSint64(
Column.valsSint64,
(long) pb.values.get(VALUES_PER_SKETCH_POINT * i + 3));
r.putSint64(Column.valsSint64, pb.counts.get(i));
}
break;
Expand All @@ -104,9 +99,6 @@ void encodeValues(ValueType valueType) {
r.putFloat32(
Column.valsFloat32,
(float) pb.values.get(VALUES_PER_SKETCH_POINT * i + 2));
r.putFloat32(
Column.valsFloat32,
(float) pb.values.get(VALUES_PER_SKETCH_POINT * i + 3));
r.putSint64(Column.valsSint64, pb.counts.get(i));
}
break;
Expand All @@ -117,8 +109,6 @@ void encodeValues(ValueType valueType) {
Column.valsFloat64, pb.values.get(VALUES_PER_SKETCH_POINT * i + 1));
r.putFloat64(
Column.valsFloat64, pb.values.get(VALUES_PER_SKETCH_POINT * i + 2));
r.putFloat64(
Column.valsFloat64, pb.values.get(VALUES_PER_SKETCH_POINT * i + 3));
r.putSint64(Column.valsSint64, pb.counts.get(i));
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public void handle(byte[] p) {

b.sketch("ijk")
.setTags(Arrays.asList(new String[] {"foo", "baz"}))
.addPoint(100, 4.75, 2.25, 1.25, 1.75, 3, new int[] {1351, 1373}, new int[] {1, 2})
.addPoint(110, 6.5, 3.5, 2.25, 2.75, 5, new int[] {1389, 1402}, new int[] {2, 3})
.addPoint(100, 4.75, 1.25, 1.75, 3, new int[] {1351, 1373}, new int[] {1, 2})
.addPoint(110, 6.5, 2.25, 2.75, 5, new int[] {1389, 1402}, new int[] {2, 3})
.close();

b.rate("lm").setInterval(10).addPoint(100, 3.14).close();
Expand All @@ -60,7 +60,7 @@ public void handle(byte[] p) {
new int[] {
// MetricData
(3 << 3) | 2,
196,
188,
1,
// dictNameStr
(1 << 3) | 2,
Expand Down Expand Up @@ -195,20 +195,16 @@ public void handle(byte[] p) {
6,
10,
// valsFloat32,
// list(pack('<ffffffff', 4.75, 2.25, 1.25, 1.75, 6.5, 3.5, 2.25, 2.75))
// list(pack('<ffffff', 4.75, 1.25, 1.75, 6.5, 2.25, 2.75))
(18 << 3) | 2,
1,
32,
24,
0,
0,
152,
64,
0,
0,
16,
64,
0,
0,
160,
63,
0,
Expand All @@ -221,10 +217,6 @@ public void handle(byte[] p) {
64,
0,
0,
96,
64,
0,
0,
16,
64,
0,
Expand Down