public class WavefrontDirectSender extends AbstractDirectConnectionHandler implements WavefrontSender
Constructor and Description |
---|
WavefrontDirectSender(String server,
String token)
Creates a new client that connects directly to a given Wavefront service.
|
Modifier and Type | Method and Description |
---|---|
int |
getFailureCount()
Returns the number of failed writes to the server.
|
protected void |
internalFlush() |
void |
run() |
void |
send(String name,
double value)
Send a measurement to Wavefront.
|
void |
send(String name,
double value,
Long timestamp)
Send a measurement to Wavefront.
|
void |
send(String name,
double value,
Long timestamp,
String source)
Send a measurement to Wavefront.
|
void |
send(String name,
double value,
Long timestamp,
String source,
Map<String,String> pointTags)
Send the given measurement to the server.
|
void |
send(String name,
double value,
String source,
Map<String,String> pointTags)
Send the given measurement to the server.
|
close, connect, flush, isConnected, report
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connect, flush, isConnected
public WavefrontDirectSender(String server, String token)
server
- A Wavefront server URL of the form "https://clusterName.wavefront.com"token
- A valid API token with direct ingestion permissionspublic void send(String name, double value) throws IOException
WavefrontSender
send
in interface WavefrontSender
name
- The name of the metric. Spaces are replaced with '-' (dashes) and quotes will be automatically
escaped.value
- The value to be sent.IOException
- Throws if there was an error sending the metric.UnknownHostException
- Throws if there's an error determining the current host.public void send(String name, double value, @Nullable Long timestamp) throws IOException
WavefrontSender
send
in interface WavefrontSender
name
- The name of the metric. Spaces are replaced with '-' (dashes) and quotes will be automatically
escaped.value
- The value to be sent.timestamp
- The timestamp in seconds since the epoch to be sent.IOException
- Throws if there was an error sending the metric.UnknownHostException
- Throws if there's an error determining the current host.public void send(String name, double value, @Nullable Long timestamp, String source) throws IOException
WavefrontSender
send
in interface WavefrontSender
name
- The name of the metric. Spaces are replaced with '-' (dashes) and quotes will be automatically
escaped.value
- The value to be sent.timestamp
- The timestamp in seconds since the epoch to be sent.source
- The source (or host) that's sending the metric.IOException
- if there was an error sending the metric.public void send(String name, double value, String source, @Nullable Map<String,String> pointTags) throws IOException
WavefrontSender
send
in interface WavefrontSender
name
- The name of the metric. Spaces are replaced with '-' (dashes) and quotes will be automatically
escaped.value
- The value to be sent.source
- The source (or host) that's sending the metric. Null to use machine hostname.pointTags
- The point tags associated with this measurement.IOException
- if there was an error sending the metric.public void send(String name, double value, @Nullable Long timestamp, String source, @Nullable Map<String,String> pointTags) throws IOException
WavefrontSender
send
in interface WavefrontSender
name
- The name of the metric. Spaces are replaced with '-' (dashes) and quotes will be automatically
escaped.value
- The value to be sent.timestamp
- The timestamp in seconds since the epoch to be sent. Null to use agent assigned timestamp.source
- The source (or host) that's sending the metric. Null to use machine hostname.pointTags
- The point tags associated with this measurement.IOException
- if there was an error sending the metric.protected void internalFlush() throws IOException
internalFlush
in class AbstractDirectConnectionHandler
IOException
public int getFailureCount()
WavefrontConnectionHandler
getFailureCount
in interface WavefrontConnectionHandler
Copyright © 2019. All rights reserved.