T
- The type of the telemetry being stored in the buffer.public abstract class TelemetryChannelBase<T> extends java.lang.Object implements TelemetryChannel
Constructor and Description |
---|
TelemetryChannelBase()
Deprecated.
|
TelemetryChannelBase(java.util.Map<java.lang.String,java.lang.String> namesAndValues)
Deprecated.
|
TelemetryChannelBase(java.lang.String endpointAddress,
boolean developerMode,
int maxTelemetryBufferCapacity,
int sendIntervalInMillis)
Deprecated.
Use
TelemetryChannelBase(TelemetryConfiguration, String, boolean, int, int, boolean, int) . Use TelemetryConfiguration.setConnectionString(String) to set ingestion endpoint, if needed. |
TelemetryChannelBase(java.lang.String endpointAddress,
java.lang.String maxTransmissionStorageCapacity,
boolean developerMode,
int maxTelemetryBufferCapacity,
int sendIntervalInMillis,
boolean throttling,
int maxInstantRetries)
Deprecated.
Use
TelemetryChannelBase(TelemetryConfiguration, String, boolean, int, int, boolean, int) . Use TelemetryConfiguration.setConnectionString(String) to set ingestion endpoint, if needed. |
TelemetryChannelBase(TelemetryConfiguration configuration) |
TelemetryChannelBase(TelemetryConfiguration configuration,
java.util.Map<java.lang.String,java.lang.String> namesAndValues) |
TelemetryChannelBase(TelemetryConfiguration configuration,
java.lang.String maxTransmissionStorageCapacity,
boolean developerMode,
int maxTelemetryBufferCapacity,
int sendIntervalInMillis,
boolean throttling,
int maxInstantRetries) |
Modifier and Type | Method and Description |
---|---|
protected LimitsEnforcer |
createDefaultMaxTelemetryBufferCapacityEnforcer(java.lang.Integer currentValue) |
protected LimitsEnforcer |
createDefaultSendIntervalInSecondsEnforcer(java.lang.Integer currentValue) |
protected abstract TransmitterFactory<T> |
createTransmitterFactory() |
protected abstract boolean |
doSend(Telemetry telemetry) |
void |
flush()
Flushes the data that the channel might have internally.
|
protected TransmitterFactory<T> |
getTransmitterFactory() |
protected void |
initialize(java.lang.String endpointAddress,
java.lang.String maxTransmissionStorageCapacity,
boolean developerMode,
LimitsEnforcer maxTelemetryBufferCapacityEnforcer,
LimitsEnforcer sendIntervalInSeconds,
boolean throttling,
int maxInstantRetry)
|
protected void |
initialize(TelemetryConfiguration configuration,
java.lang.String endpointAddress,
java.lang.String maxTransmissionStorageCapacity,
boolean developerMode,
LimitsEnforcer maxTelemetryBufferCapacityEnforcer,
LimitsEnforcer sendIntervalInSeconds,
boolean throttling,
int maxInstantRetry) |
boolean |
isDeveloperMode()
Gets value indicating whether this channel is in developer mode.
|
protected void |
makeSureEndpointAddressIsValid(java.lang.String endpointAddress)
The method will throw IllegalArgumentException if the endpointAddress is not
a valid URI.
|
void |
send(Telemetry telemetry)
Sends a Telemetry instance through the channel.
|
void |
setDeveloperMode(boolean developerMode)
Sets value indicating whether this channel is in developer mode.
|
void |
setMaxTelemetriesInBatch(int maxTelemetriesInBatch)
Sets the buffer size
|
void |
setSampler(TelemetrySampler telemetrySampler)
Sets an optional Sampler that can sample out telemetries Currently, we don't
allow to replace a valid telemtry sampler.
|
void |
setTransmitBufferTimeoutInSeconds(int transmitBufferTimeoutInSeconds)
Sets the time tow wait before flushing the internal buffer
|
void |
stop(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Stops on going work
|
public static final int DEFAULT_MAX_INSTANT_RETRY
public static final int DEFAULT_MAX_TELEMETRY_BUFFER_CAPACITY
public static final int DEFAULT_FLUSH_BUFFER_TIMEOUT_IN_SECONDS
public static final int MIN_MAX_TELEMETRY_BUFFER_CAPACITY
public static final int MAX_MAX_TELEMETRY_BUFFER_CAPACITY
public static final int MIN_FLUSH_BUFFER_TIMEOUT_IN_SECONDS
public static final int MAX_FLUSH_BUFFER_TIMEOUT_IN_SECONDS
public static final java.lang.String DEVELOPER_MODE_SYSTEM_PROPRETY_NAME
public static final java.lang.String MAX_TELEMETRY_BUFFER_CAPACITY_NAME
public static final java.lang.String INSTANT_RETRY_NAME
public static final java.lang.String FLUSH_BUFFER_TIMEOUT_IN_SECONDS_NAME
public static final java.lang.String DEVELOPER_MODE_NAME
public static final java.lang.String ENDPOINT_ADDRESS_NAME
public static final java.lang.String MAX_TRANSMISSION_STORAGE_CAPACITY_NAME
public static final int LOG_TELEMETRY_ITEMS_MODULUS
public static final java.lang.String THROTTLING_ENABLED_NAME
protected boolean stopped
protected boolean isInitailized
protected TelemetriesTransmitter<T> telemetriesTransmitter
protected volatile TelemetrySampler telemetrySampler
protected TelemetryBuffer<T> telemetryBuffer
public TelemetryChannelBase(TelemetryConfiguration configuration)
public TelemetryChannelBase(TelemetryConfiguration configuration, java.lang.String maxTransmissionStorageCapacity, boolean developerMode, int maxTelemetryBufferCapacity, int sendIntervalInMillis, boolean throttling, int maxInstantRetries)
configuration
- The telemetry configuration to use for finding endpoints.maxTransmissionStorageCapacity
- This limits the size of the saved telemetry files which encountered an error during sending.developerMode
- 'non-production' mode for easier debugging. This forces maxTelemetryBufferCapacity=1 and when logger is enabled, it prints serialized telemetry to log.maxTelemetryBufferCapacity
- Max number of Telemetries we keep in the buffer, when reached we will send the buffer Note, value should be between TRANSMIT_BUFFER_MIN_TIMEOUT_IN_MILLIS and
TRANSMIT_BUFFER_MAX_TIMEOUT_IN_MILLIS, inclusivesendIntervalInMillis
- The maximum number of milliseconds to wait before we send the buffer Note, value should be between MIN_MAX_TELEMETRY_BUFFER_CAPACITY and MAX_MAX_TELEMETRY_BUFFER_CAPACITY, inclusivethrottling
- enables throttling when truemaxInstantRetries
- number of retries before starting incremental back-off.@Deprecated public TelemetryChannelBase()
TelemetryChannelBase(TelemetryConfiguration)
@Deprecated public TelemetryChannelBase(java.lang.String endpointAddress, boolean developerMode, int maxTelemetryBufferCapacity, int sendIntervalInMillis)
TelemetryChannelBase(TelemetryConfiguration, String, boolean, int, int, boolean, int)
. Use TelemetryConfiguration.setConnectionString(String)
to set ingestion endpoint, if needed.@Deprecated public TelemetryChannelBase(java.lang.String endpointAddress, java.lang.String maxTransmissionStorageCapacity, boolean developerMode, int maxTelemetryBufferCapacity, int sendIntervalInMillis, boolean throttling, int maxInstantRetries)
TelemetryChannelBase(TelemetryConfiguration, String, boolean, int, int, boolean, int)
. Use TelemetryConfiguration.setConnectionString(String)
to set ingestion endpoint, if needed.@Deprecated public TelemetryChannelBase(java.util.Map<java.lang.String,java.lang.String> namesAndValues)
TelemetryChannelBase(TelemetryConfiguration, Map)
.public TelemetryChannelBase(TelemetryConfiguration configuration, java.util.Map<java.lang.String,java.lang.String> namesAndValues)
configuration
- The configuration for the current TelemetryClientnamesAndValues
- Key/Value pairs for channel configuration options@Deprecated protected void initialize(java.lang.String endpointAddress, java.lang.String maxTransmissionStorageCapacity, boolean developerMode, LimitsEnforcer maxTelemetryBufferCapacityEnforcer, LimitsEnforcer sendIntervalInSeconds, boolean throttling, int maxInstantRetry)
protected void initialize(TelemetryConfiguration configuration, java.lang.String endpointAddress, java.lang.String maxTransmissionStorageCapacity, boolean developerMode, LimitsEnforcer maxTelemetryBufferCapacityEnforcer, LimitsEnforcer sendIntervalInSeconds, boolean throttling, int maxInstantRetry)
protected TransmitterFactory<T> getTransmitterFactory()
public boolean isDeveloperMode()
isDeveloperMode
in interface TelemetryChannel
public void setDeveloperMode(boolean developerMode)
setDeveloperMode
in interface TelemetryChannel
developerMode
- true or falsepublic void stop(long timeout, java.util.concurrent.TimeUnit timeUnit)
stop
in interface TelemetryChannel
timeout
- Time to try and stoptimeUnit
- The units of the 'timeout' parameterpublic void setTransmitBufferTimeoutInSeconds(int transmitBufferTimeoutInSeconds)
transmitBufferTimeoutInSeconds
- should be between MIN_FLUSH_BUFFER_TIMEOUT_IN_SECONDS and
MAX_FLUSH_BUFFER_TIMEOUT_IN_SECONDS inclusive if the number is
lower than the minimum then the minimum will be used if the number
is higher than the maximum then the maximum will be usedpublic void setMaxTelemetriesInBatch(int maxTelemetriesInBatch)
maxTelemetriesInBatch
- should be between MIN_MAX_TELEMETRY_BUFFER_CAPACITY and
MAX_MAX_TELEMETRY_BUFFER_CAPACITY inclusive if the number is lower
than the minimum then the minimum will be used if the number is
higher than the maximum then the maximum will be usedpublic void flush()
flush
in interface TelemetryChannel
public void setSampler(TelemetrySampler telemetrySampler)
setSampler
in interface TelemetryChannel
telemetrySampler
- - The samplerpublic void send(Telemetry telemetry)
send
in interface TelemetryChannel
telemetry
- The Telemetry item to send.protected abstract boolean doSend(Telemetry telemetry)
telemetry
- protected abstract TransmitterFactory<T> createTransmitterFactory()
protected LimitsEnforcer createDefaultMaxTelemetryBufferCapacityEnforcer(java.lang.Integer currentValue)
protected LimitsEnforcer createDefaultSendIntervalInSecondsEnforcer(java.lang.Integer currentValue)
protected void makeSureEndpointAddressIsValid(java.lang.String endpointAddress)
endpointAddress
- java.lang.IllegalArgumentException
- if the endpointAddress is invalid