Receives new data points and stores them in HBase.
| 34 | * Receives new data points and stores them in HBase. |
| 35 | */ |
| 36 | final class IncomingDataPoints implements WritableDataPoints { |
| 37 | |
| 38 | /** For how long to buffer edits when doing batch imports (in ms). */ |
| 39 | private static final short DEFAULT_BATCH_IMPORT_BUFFER_INTERVAL = 5000; |
| 40 | |
| 41 | /** |
| 42 | * Keep track of the latency (in ms) we perceive sending edits to HBase. We |
| 43 | * want buckets up to 16s, with 2 ms interval between each bucket up to 100 ms |
| 44 | * after we which we switch to exponential buckets. |
| 45 | */ |
| 46 | static final Histogram putlatency = new Histogram(16000, (short) 2, 100); |
| 47 | |
| 48 | /** The {@code TSDB} instance we belong to. */ |
| 49 | private final TSDB tsdb; |
| 50 | |
| 51 | /** Whether or not to allow out of order data. */ |
| 52 | private final boolean allow_out_of_order_data; |
| 53 | |
| 54 | /** |
| 55 | * The row key. Optional salt + 3 bytes for the metric name, 4 bytes for |
| 56 | * the base timestamp, 6 bytes per tag (3 for the name, 3 for the value). |
| 57 | */ |
| 58 | private byte[] row; |
| 59 | |
| 60 | /** |
| 61 | * Qualifiers for individual data points. The last Const.FLAG_BITS bits are |
| 62 | * used to store flags (the type of the data point - integer or floating point |
| 63 | * - and the size of the data point in bytes). The remaining MSBs store a |
| 64 | * delta in seconds from the base timestamp stored in the row key. |
| 65 | */ |
| 66 | private short[] qualifiers; |
| 67 | |
| 68 | /** Each value in the row. */ |
| 69 | private long[] values; |
| 70 | |
| 71 | /** Track the last timestamp written for this series */ |
| 72 | private long last_ts; |
| 73 | |
| 74 | /** Number of data points in this row. */ |
| 75 | private short size; |
| 76 | |
| 77 | /** Are we doing a batch import? */ |
| 78 | private boolean batch_import; |
| 79 | |
| 80 | /** The metric for this time series */ |
| 81 | private String metric; |
| 82 | |
| 83 | /** Copy of the tags given us by the caller */ |
| 84 | private Map<String, String> tags; |
| 85 | |
| 86 | /** |
| 87 | * Constructor. |
| 88 | * |
| 89 | * @param tsdb |
| 90 | * The TSDB we belong to. |
| 91 | */ |
| 92 | IncomingDataPoints(final TSDB tsdb) { |
| 93 | this.tsdb = tsdb; |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…