Class ResourceUtilizationLoggerImpl
- All Implemented Interfaces:
io.deephaven.enterprise.binlog.support.LoggerInfo,ResourceUtilizationLogger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriterThe writer used by thelog(long, java.lang.String, java.lang.String, int, int, int, java.lang.String)method.Fields inherited from interface io.deephaven.enterprise.logger.ResourceUtilizationLogger
NULL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ByteBufferallocateBuffer(int size) Allocate a buffer for logging.voidclose()Closes the underlying writer for this logger.booleanprotected intinitialBufferSize(String LoggingProcessName, String ResourceProcessName, String Comment) Compute the initial size of the buffer for logging the row.initLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter multiPartitionBufferWriter, DateTimeFormatter partitionFormatter) Initialize a logger for the DbInternal.ResourceUtilization table, with log format 2.voidlog(long Timestamp, String LoggingProcessName, String ResourceProcessName, int HeapUsageMB, int HeapAvailableMB, int WorkerCount, String Comment) Logs a row, using the writer passed in to theinitLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter, java.time.format.DateTimeFormatter)method.intCreate a long-lived header buffer.makeRowBuffer(long Timestamp, String LoggingProcessName, String ResourceProcessName, int HeapUsageMB, int HeapAvailableMB, int WorkerCount, String Comment) Allocates and populates a row buffer for the given inputs.Populate a header buffer.populateRowBuffer(ByteBuffer outputBuffer, long Timestamp, String LoggingProcessName, String ResourceProcessName, int HeapUsageMB, int HeapAvailableMB, int WorkerCount, String Comment) Populates the outputBuffer with the parameter values.voidreleaseBuffer(ByteBuffer buffer) Release a buffer previously allocated for logging the row.voidsetMaxEntrySize(int maxEntrySize) Sets The maximum size of a binary log entry.voidsetStringEstimateMultiplier(double stringEstimateMultiplier) Sets For strings that do not use a simple encoding, how many bytes (multiplied by length) should be initially allocated for each string?booleantoString()
-
Field Details
-
writer
protected io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter writerThe writer used by thelog(long, java.lang.String, java.lang.String, int, int, int, java.lang.String)method. This must be set byinitLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter, java.time.format.DateTimeFormatter)before calling the log method.
-
-
Constructor Details
-
ResourceUtilizationLoggerImpl
public ResourceUtilizationLoggerImpl()
-
-
Method Details
-
initialBufferSize
protected int initialBufferSize(String LoggingProcessName, String ResourceProcessName, String Comment) Compute the initial size of the buffer for logging the row. If the buffer is not large enough, then it can be exponentially increased up until the maximum size. The initial size takes into account all fixed fields for the row, and then quickly estimates without actually encoding variable length fields. -
allocateBuffer
Allocate a buffer for logging.This method is protected so that it can be overridden by sub-classes, which may elect to use pooling or another allocation strategy. The buffers returned from this method must be released using
releaseBuffer(java.nio.ByteBuffer)after they are done being used. The logger implementations may retain a buffer for the life of the logger if it will be reused (e.g., header buffers are used across files and connections). -
releaseBuffer
Release a buffer previously allocated for logging the row.This method is protected so that it can be overridden by sub-classes, which may elect to use pooling or another allocation strategy. The logger implementations may retain a buffer for the life of the logger if it will be reused (e.g., header buffers are used across files and connections).
-
setStringEstimateMultiplier
public void setStringEstimateMultiplier(double stringEstimateMultiplier) Sets For strings that do not use a simple encoding, how many bytes (multiplied by length) should be initially allocated for each string? -
setMaxEntrySize
public void setMaxEntrySize(int maxEntrySize) Sets The maximum size of a binary log entry. This defaults to the value of BinaryStoreV2Constants.MAX_ENTRY_SIZE (1048576) at logger generation time. You must ensure that the loggers value is less than or equal to the value of the running system, or it the Data Import Server may not make progress consuming the generated binary log. -
initLog
public ResourceUtilizationLoggerImpl initLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter multiPartitionBufferWriter, DateTimeFormatter partitionFormatter) throws IOException Initialize a logger for the DbInternal.ResourceUtilization table, with log format 2.- Parameters:
multiPartitionBufferWriter- the writer for this logger, required for callinglog(long, java.lang.String, java.lang.String, int, int, int, java.lang.String)@param partitionFormatter A datetime formatter for time based partition using the Timestamp column. You must pass in a formatter that is thread safe, or otherwise externally synchronize this logger.- Throws:
IOException
-
log
public void log(long Timestamp, String LoggingProcessName, String ResourceProcessName, int HeapUsageMB, int HeapAvailableMB, int WorkerCount, String Comment) throws IOException Logs a row, using the writer passed in to theinitLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter, java.time.format.DateTimeFormatter)method.- Specified by:
login interfaceResourceUtilizationLogger- Throws:
IOException
-
close
Closes the underlying writer for this logger.- Specified by:
closein interfaceResourceUtilizationLogger- Throws:
IOException
-
makeRowBuffer
public ByteBuffer makeRowBuffer(long Timestamp, String LoggingProcessName, String ResourceProcessName, int HeapUsageMB, int HeapAvailableMB, int WorkerCount, String Comment) throws IOException Allocates and populates a row buffer for the given inputs.The buffer is allocated with allocateBuffer based on a size estimate, and exponentially doubled up until the value of maxEntrySize. The caller is responsible for calling releaseBuffer after the buffer is no longer necessary.
- Throws:
IOException
-
populateRowBuffer
public ByteBuffer populateRowBuffer(ByteBuffer outputBuffer, long Timestamp, String LoggingProcessName, String ResourceProcessName, int HeapUsageMB, int HeapAvailableMB, int WorkerCount, String Comment) Populates the outputBuffer with the parameter values. The outputBuffer must be sufficiently sized to contain the output. -
makeHeaderBuffer
Create a long-lived header buffer.The header buffer includes all column definitions, constant columns and the application version.
The returned buffer is duplicated after calling
populateHeaderBuffer(), and is owned by the caller. It should not be passed to makeHeaderBuffer. -
populateHeaderBuffer
Populate a header buffer.The header buffer includes all column definitions, constant columns and the application version.
The returned buffer is allocated with allocateBuffer, the caller is responsible for calling releaseBuffer after the buffer is done being used.
-
systemNamespace
public boolean systemNamespace()- Specified by:
systemNamespacein interfaceio.deephaven.enterprise.binlog.support.LoggerInfo
-
namespaceSet
- Specified by:
namespaceSetin interfaceio.deephaven.enterprise.binlog.support.LoggerInfo
-
dynamicPartitions
public boolean dynamicPartitions()- Specified by:
dynamicPartitionsin interfaceio.deephaven.enterprise.binlog.support.LoggerInfo
-
tableName
- Specified by:
tableNamein interfaceio.deephaven.enterprise.binlog.support.LoggerInfo
-
namespace
- Specified by:
namespacein interfaceio.deephaven.enterprise.binlog.support.LoggerInfo
-
logFormat
public int logFormat()- Specified by:
logFormatin interfaceio.deephaven.enterprise.binlog.support.LoggerInfo
-
toString
-