Package io.opencensus.common
Class ServerStatsEncoding
- java.lang.Object
-
- io.opencensus.common.ServerStatsEncoding
-
public final class ServerStatsEncoding extends java.lang.Object
A service class to encode/decodeServerStats
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 Modifier and Type Field Description static byte
CURRENT_VERSION
The current encoding version.
-
Constructor Summary
Constructors Modifier Constructor Description private
ServerStatsEncoding()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
CURRENT_VERSION
public static final byte CURRENT_VERSION
The current encoding version. The value is 0- Since:
- 0.16
- See Also:
- Constant Field Values
-
-
Method Detail
-
toBytes
public static byte[] toBytes(ServerStats stats)
Encodes theServerStats
as per the Opencensus Summary Span specification.- Parameters:
stats
-ServerStats
to encode.- Returns:
- encoded byte array.
- Since:
- 0.16
-
parseBytes
public static ServerStats parseBytes(byte[] serialized) throws ServerStatsDeserializationException
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
-
-