Class DatadogAgentClient
- java.lang.Object
-
- org.datadog.jenkins.plugins.datadog.clients.DatadogAgentClient
-
- All Implemented Interfaces:
DatadogClient
public class DatadogAgentClient extends Object implements DatadogClient
This class is used to collect all methods that has to do with transmitting data to Datadog.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DatadogAgentClient.ConnectivityResult
-
Nested classes/interfaces inherited from interface org.datadog.jenkins.plugins.datadog.DatadogClient
DatadogClient.ClientType, DatadogClient.Status
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
enableValidations
-
Constructor Summary
Constructors Modifier Constructor Description protected
DatadogAgentClient(String hostname, Integer port, Integer logCollectionPort, Integer traceCollectionPort)
protected
DatadogAgentClient(String hostname, Integer port, Integer logCollectionPort, Integer traceCollectionPort, long evpProxyTimeoutMillis)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DatadogAgentClient.ConnectivityResult
checkConnectivity(String host, int port)
TraceWriteStrategy
createTraceWriteStrategy()
boolean
equals(Object object)
boolean
event(DatadogEvent event)
Sends an event to the Datadog API, including the event payload.Set<String>
fetchAgentSupportedEndpoints()
Fetches the supported endpoints from the Trace Agent /info APIString
getHostname()
static DatadogClient
getInstance(String hostname, Integer port, Integer logCollectionPort, Integer traceCollectionPort)
NOTE: Use ClientFactory.getClient method to instantiate the client in the Jenkins Plugin This method is not recommended to be used because it misses some validations.Integer
getLogCollectionPort()
Integer
getPort()
Integer
getTraceCollectionPort()
int
hashCode()
MetricsClient
metrics()
boolean
sendLogs(String payload)
Send log message.boolean
serviceCheck(String name, DatadogClient.Status status, String hostname, Map<String,Set<String>> tags)
Sends a service check to the Datadog API, including the check name, and status.void
validateConfiguration()
-
-
-
Method Detail
-
getInstance
public static DatadogClient getInstance(String hostname, Integer port, Integer logCollectionPort, Integer traceCollectionPort)
NOTE: Use ClientFactory.getClient method to instantiate the client in the Jenkins Plugin This method is not recommended to be used because it misses some validations.- Parameters:
hostname
- - target hostnameport
- - target portlogCollectionPort
- - target log collection porttraceCollectionPort
- - target trace collection port- Returns:
- an singleton instance of the DogStatsDClient.
-
checkConnectivity
public static DatadogAgentClient.ConnectivityResult checkConnectivity(String host, int port)
-
validateConfiguration
public void validateConfiguration() throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
fetchAgentSupportedEndpoints
public Set<String> fetchAgentSupportedEndpoints()
Fetches the supported endpoints from the Trace Agent /info API- Returns:
- a list of endpoints (if /info wasn't available, it will be empty)
-
getHostname
public String getHostname()
-
getPort
public Integer getPort()
-
getLogCollectionPort
public Integer getLogCollectionPort()
-
getTraceCollectionPort
public Integer getTraceCollectionPort()
-
event
public boolean event(DatadogEvent event)
Description copied from interface:DatadogClient
Sends an event to the Datadog API, including the event payload.- Specified by:
event
in interfaceDatadogClient
- Parameters:
event
- - a DatadogEvent object- Returns:
- a boolean to signify the success or failure of the HTTP POST request.
-
metrics
public MetricsClient metrics()
- Specified by:
metrics
in interfaceDatadogClient
-
serviceCheck
public boolean serviceCheck(String name, DatadogClient.Status status, String hostname, Map<String,Set<String>> tags)
Description copied from interface:DatadogClient
Sends a service check to the Datadog API, including the check name, and status.- Specified by:
serviceCheck
in interfaceDatadogClient
- Parameters:
name
- - A String with the name of the service check to record.status
- - An Status with the status code to record for this service check.hostname
- - A String with the hostname to submit.tags
- - A Map containing the tags to submit.- Returns:
- a boolean to signify the success or failure of the HTTP POST request.
-
sendLogs
public boolean sendLogs(String payload)
Description copied from interface:DatadogClient
Send log message.- Specified by:
sendLogs
in interfaceDatadogClient
- Parameters:
payload
- log payload to submit JSON object as String- Returns:
- a boolean to signify the success or failure of the request.
-
createTraceWriteStrategy
public TraceWriteStrategy createTraceWriteStrategy()
- Specified by:
createTraceWriteStrategy
in interfaceDatadogClient
-
-