public static class MetricDumpSerialization.MetricSerializationResult extends Object implements Serializable
The counts are stored separately from the metrics since the final count for any given type can only be determined after all metrics of that type were serialized. Storing them together in a single byte[] would require an additional copy of all serialized metrics, as you would first have to serialize the metrics into a temporary buffer to calculate the counts, write the counts to the final output and copy all metrics from the temporary buffer.
Note that while one could implement the serialization in such a way so that at least 1 byte (a validity flag) is written for each metric, this would require more bandwidth due to the sheer number of metrics.
Modifier and Type | Field and Description |
---|---|
int |
numCounters |
int |
numGauges |
int |
numHistograms |
int |
numMeters |
byte[] |
serializedMetrics |
Constructor and Description |
---|
MetricSerializationResult(byte[] serializedMetrics,
int numCounters,
int numGauges,
int numMeters,
int numHistograms) |
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.