Package com.wavefront.agent
Class QueuedAgentService
- java.lang.Object
-
- com.wavefront.agent.QueuedAgentService
-
- All Implemented Interfaces:
ForceQueueEnabledProxyAPI
,WavefrontV2API
,com.wavefront.api.ProxyV2API
,com.wavefront.api.SourceTagAPI
public class QueuedAgentService extends Object implements ForceQueueEnabledProxyAPI
A wrapper for any WavefrontAPI that queues up any result posting if the backend is not available. Current data will always be submitted right away (thus prioritizing live data) while background threads will submit backlogged data.- Author:
- Clement Pang ([email protected])
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QueuedAgentService.PostPushDataResultTask
static class
QueuedAgentService.PostSourceTagResultTask
-
Constructor Summary
Constructors Constructor Description QueuedAgentService(WavefrontV2API service, String bufferFile, int retryThreads, ScheduledExecutorService executorService, boolean purge, UUID agentId, boolean splitPushWhenRateLimited, com.google.common.util.concurrent.RecyclableRateLimiter pushRateLimiter, String token)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description javax.ws.rs.core.Response
appendTag(String id, String tagValue, boolean forceToQueue)
Add a single tag to a source.javax.ws.rs.core.Response
appendTag(String id, String token, String tagValue)
static List<ResubmissionTaskQueue>
createResubmissionTasks(WavefrontV2API wrapped, int retryThreads, String bufferFile, boolean purge, UUID agentId, String token)
static com.squareup.tape.ObjectQueue<ResubmissionTask>
createTaskQueue(UUID agentId, File buffer)
Long
getBytesPerMinute()
long
getQueuedSourceTagTasksCount()
long
getQueuedTasksCount()
boolean
isRunning()
com.wavefront.api.agent.AgentConfiguration
proxyCheckin(UUID agentId, String token, String hostname, String version, Long currentMillis, com.fasterxml.jackson.databind.JsonNode agentMetrics, Boolean ephemeral)
void
proxyConfigProcessed(UUID proxyId)
void
proxyError(UUID proxyId, String details)
javax.ws.rs.core.Response
proxyReport(UUID agentId, String format, String pushData)
javax.ws.rs.core.Response
proxyReport(UUID agentId, String format, String pushData, boolean forceToQueue)
Report batched data (metrics, histograms, spans, etc) to Wavefront servers.javax.ws.rs.core.Response
removeDescription(String id, boolean forceToQueue)
Remove description from a source.javax.ws.rs.core.Response
removeDescription(String id, String token)
javax.ws.rs.core.Response
removeTag(String id, String tagValue, boolean forceToQueue)
Remove a single tag from a source.javax.ws.rs.core.Response
removeTag(String id, String token, String tagValue)
javax.ws.rs.core.Response
setDescription(String id, String desc, boolean forceToQueue)
Set description for a source.javax.ws.rs.core.Response
setDescription(String id, String token, String description)
static void
setRetryBackoffBaseSeconds(com.google.common.util.concurrent.AtomicDouble newSecs)
static void
setSplitBatchSize(AtomicInteger newSize)
Deprecated.javax.ws.rs.core.Response
setTags(String id, String token, List<String> tagValuesToSet)
javax.ws.rs.core.Response
setTags(String id, List<String> tagValuesToSet, boolean forceToQueue)
Sets tags for a host, overriding existing tags.void
setWrappedApi(WavefrontV2API api)
void
shutdown()
void
start()
-
-
-
Constructor Detail
-
QueuedAgentService
public QueuedAgentService(WavefrontV2API service, String bufferFile, int retryThreads, ScheduledExecutorService executorService, boolean purge, UUID agentId, boolean splitPushWhenRateLimited, @Nullable com.google.common.util.concurrent.RecyclableRateLimiter pushRateLimiter, @Nullable String token) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getBytesPerMinute
@Nullable public Long getBytesPerMinute()
- Returns:
- bytes per minute for requests submissions. Null if no data is available yet.
-
start
public void start()
-
createTaskQueue
public static com.squareup.tape.ObjectQueue<ResubmissionTask> createTaskQueue(UUID agentId, File buffer) throws IOException
- Throws:
IOException
-
createResubmissionTasks
public static List<ResubmissionTaskQueue> createResubmissionTasks(WavefrontV2API wrapped, int retryThreads, String bufferFile, boolean purge, UUID agentId, String token) throws IOException
- Throws:
IOException
-
setWrappedApi
public void setWrappedApi(WavefrontV2API api)
-
isRunning
public boolean isRunning()
-
shutdown
public void shutdown()
-
setRetryBackoffBaseSeconds
public static void setRetryBackoffBaseSeconds(com.google.common.util.concurrent.AtomicDouble newSecs)
-
setSplitBatchSize
@Deprecated public static void setSplitBatchSize(AtomicInteger newSize)
Deprecated.
-
getQueuedTasksCount
public long getQueuedTasksCount()
-
getQueuedSourceTagTasksCount
public long getQueuedSourceTagTasksCount()
-
proxyCheckin
public com.wavefront.api.agent.AgentConfiguration proxyCheckin(UUID agentId, String token, String hostname, String version, Long currentMillis, com.fasterxml.jackson.databind.JsonNode agentMetrics, Boolean ephemeral)
- Specified by:
proxyCheckin
in interfacecom.wavefront.api.ProxyV2API
-
proxyReport
public javax.ws.rs.core.Response proxyReport(UUID agentId, String format, String pushData)
- Specified by:
proxyReport
in interfacecom.wavefront.api.ProxyV2API
-
proxyReport
public javax.ws.rs.core.Response proxyReport(UUID agentId, String format, String pushData, boolean forceToQueue)
Description copied from interface:ForceQueueEnabledProxyAPI
Report batched data (metrics, histograms, spans, etc) to Wavefront servers.- Specified by:
proxyReport
in interfaceForceQueueEnabledProxyAPI
- Parameters:
agentId
- Proxy Id reporting the result.format
- The format of the data (wavefront, histogram, trace, spanLogs)pushData
- Push data batch (newline-delimited)forceToQueue
- Whether to bypass posting data to the API and write to queue instead.
-
proxyConfigProcessed
public void proxyConfigProcessed(UUID proxyId)
- Specified by:
proxyConfigProcessed
in interfacecom.wavefront.api.ProxyV2API
-
proxyError
public void proxyError(UUID proxyId, String details)
- Specified by:
proxyError
in interfacecom.wavefront.api.ProxyV2API
-
appendTag
public javax.ws.rs.core.Response appendTag(String id, String token, String tagValue)
- Specified by:
appendTag
in interfacecom.wavefront.api.SourceTagAPI
-
removeTag
public javax.ws.rs.core.Response removeTag(String id, String token, String tagValue)
- Specified by:
removeTag
in interfacecom.wavefront.api.SourceTagAPI
-
removeDescription
public javax.ws.rs.core.Response removeDescription(String id, String token)
- Specified by:
removeDescription
in interfacecom.wavefront.api.SourceTagAPI
-
setTags
public javax.ws.rs.core.Response setTags(String id, String token, List<String> tagValuesToSet)
- Specified by:
setTags
in interfacecom.wavefront.api.SourceTagAPI
-
setDescription
public javax.ws.rs.core.Response setDescription(String id, String token, String description)
- Specified by:
setDescription
in interfacecom.wavefront.api.SourceTagAPI
-
setTags
public javax.ws.rs.core.Response setTags(String id, List<String> tagValuesToSet, boolean forceToQueue)
Description copied from interface:ForceQueueEnabledProxyAPI
Sets tags for a host, overriding existing tags.- Specified by:
setTags
in interfaceForceQueueEnabledProxyAPI
- Parameters:
id
- source ID.tagValuesToSet
- tags to set.forceToQueue
- Whether to bypass posting data to the API and write to queue instead.
-
removeDescription
public javax.ws.rs.core.Response removeDescription(String id, boolean forceToQueue)
Description copied from interface:ForceQueueEnabledProxyAPI
Remove description from a source.- Specified by:
removeDescription
in interfaceForceQueueEnabledProxyAPI
- Parameters:
id
- source ID.forceToQueue
- Whether to bypass posting data to the API and write to queue instead.
-
setDescription
public javax.ws.rs.core.Response setDescription(String id, String desc, boolean forceToQueue)
Description copied from interface:ForceQueueEnabledProxyAPI
Set description for a source.- Specified by:
setDescription
in interfaceForceQueueEnabledProxyAPI
- Parameters:
id
- source ID.desc
- description.forceToQueue
- Whether to bypass posting data to the API and write to queue instead.
-
appendTag
public javax.ws.rs.core.Response appendTag(String id, String tagValue, boolean forceToQueue)
Description copied from interface:ForceQueueEnabledProxyAPI
Add a single tag to a source.- Specified by:
appendTag
in interfaceForceQueueEnabledProxyAPI
- Parameters:
id
- source ID.tagValue
- tag value to add.forceToQueue
- Whether to bypass posting data to the API and write to queue instead.
-
removeTag
public javax.ws.rs.core.Response removeTag(String id, String tagValue, boolean forceToQueue)
Description copied from interface:ForceQueueEnabledProxyAPI
Remove a single tag from a source.- Specified by:
removeTag
in interfaceForceQueueEnabledProxyAPI
- Parameters:
id
- source ID.tagValue
- tag to remove.forceToQueue
- Whether to bypass posting data to the API and write to queue instead.
-
-