Package io.opencensus.common
Class ServerStatsEncoding
java.lang.Object
io.opencensus.common.ServerStatsEncoding
A service class to encode/decode
ServerStats
as defined by the spec.
See opencensus-server-stats-specs
for encoding ServerStats
Use ServerStatsEncoding.toBytes(ServerStats stats)
to encode.
Use ServerStatsEncoding.parseBytes(byte[] serialized)
to decode.
- Since:
- 0.16
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ServerStats
parseBytes
(byte[] serialized) Decodes serialized byte array to createServerStats
as per Opencensus Summary Span specification.static byte[]
toBytes
(ServerStats stats) Encodes theServerStats
as per the Opencensus Summary Span specification.
-
Field Details
-
CURRENT_VERSION
public static final byte CURRENT_VERSIONThe current encoding version. The value is 0x0- Since:
- 0.16
- See Also:
-
-
Constructor Details
-
ServerStatsEncoding
private ServerStatsEncoding()
-
-
Method Details
-
toBytes
Encodes theServerStats
as per the Opencensus Summary Span specification.- Parameters:
stats
-ServerStats
to encode.- Returns:
- encoded byte array.
- Since:
- 0.16
-
parseBytes
Decodes serialized byte array to createServerStats
as per Opencensus Summary Span specification.- Parameters:
serialized
- encodedServerStats
in byte array.- Returns:
- decoded
ServerStats
. null if decoding fails. - Throws:
ServerStatsDeserializationException
- Since:
- 0.16
-