public class DatadogAgentClient extends Object implements DatadogClient
Modifier and Type | Class and Description |
---|---|
static class |
DatadogAgentClient.ConnectivityResult |
DatadogClient.ClientType, DatadogClient.Status
Modifier and Type | Field and Description |
---|---|
static boolean |
enableValidations |
Modifier | Constructor and Description |
---|---|
protected |
DatadogAgentClient(String hostname,
Integer port,
Integer logCollectionPort,
Integer traceCollectionPort) |
Modifier and Type | Method and Description |
---|---|
static DatadogAgentClient.ConnectivityResult |
checkConnectivity(String host,
int port) |
protected boolean |
checkEvpProxySupportAndUpdateLogic() |
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 API
|
boolean |
finishBuildTrace(BuildData buildData,
Run<?,?> run)
Finish the trace of a certain Jenkins build.
|
void |
flushCounters()
Submit all your counters as rate with 10 seconds intervals.
|
boolean |
gauge(String name,
long value,
String hostname,
Map<String,Set<String>> tags)
Sends a metric to the Datadog API, including the gauge name, and value.
|
String |
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() |
boolean |
incrementCounter(String name,
String hostname,
Map<String,Set<String>> tags)
Increment a counter for the given metrics.
|
boolean |
isDefaultIntakeConnectionBroken() |
boolean |
isEvpProxySupported() |
boolean |
isLogIntakeConnectionBroken() |
boolean |
isWebhookIntakeConnectionBroken() |
boolean |
postWebhook(String payload)
Posts a given payload to the Agent EVP Proxy so it is forwarded to the Webhook Intake.
|
protected boolean |
reinitializeAgentHttpClient(boolean force)
reinitialize the Tracer Client
|
boolean |
sendLogs(String payload)
Send log message.
|
boolean |
sendPipelineTrace(Run<?,?> run,
org.jenkinsci.plugins.workflow.graph.FlowNode flowNode)
Send all traces related to a certain Jenkins pipeline.
|
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 |
setApiKey(Secret apiKey) |
void |
setDefaultIntakeConnectionBroken(boolean defaultIntakeConnectionBroken) |
void |
setHostname(String hostname) |
void |
setLogCollectionPort(Integer logCollectionPort) |
void |
setLogIntakeConnectionBroken(boolean logIntakeConnectionBroken) |
void |
setLogIntakeUrl(String logIntakeUrl) |
void |
setPort(Integer port) |
void |
setUrl(String url) |
void |
setWebhookIntakeConnectionBroken(boolean webhookIntakeConnectionBroken) |
void |
setWebhookIntakeUrl(String webhookIntakeUrl) |
boolean |
startBuildTrace(BuildData buildData,
Run<?,?> run)
Start the trace of a certain Jenkins build.
|
void |
validateConfiguration() |
public static DatadogClient getInstance(String hostname, Integer port, Integer logCollectionPort, Integer traceCollectionPort)
hostname
- - target hostnameport
- - target portlogCollectionPort
- - target log collection porttraceCollectionPort
- - target trace collection portpublic static DatadogAgentClient.ConnectivityResult checkConnectivity(String host, int port)
public void validateConfiguration() throws IllegalArgumentException
IllegalArgumentException
public Set<String> fetchAgentSupportedEndpoints()
public boolean postWebhook(String payload)
postWebhook
in interface DatadogClient
payload
- - A webhooks payload.protected boolean reinitializeAgentHttpClient(boolean force)
force
- - force to reinitializeprotected boolean checkEvpProxySupportAndUpdateLogic()
public String getHostname()
public void setHostname(String hostname)
setHostname
in interface DatadogClient
public Integer getPort()
public void setPort(Integer port)
setPort
in interface DatadogClient
public Integer getLogCollectionPort()
public void setLogCollectionPort(Integer logCollectionPort)
setLogCollectionPort
in interface DatadogClient
public Integer getTraceCollectionPort()
public void setUrl(String url)
setUrl
in interface DatadogClient
public void setLogIntakeUrl(String logIntakeUrl)
setLogIntakeUrl
in interface DatadogClient
public void setWebhookIntakeUrl(String webhookIntakeUrl)
setWebhookIntakeUrl
in interface DatadogClient
public void setApiKey(Secret apiKey)
setApiKey
in interface DatadogClient
public boolean isDefaultIntakeConnectionBroken()
isDefaultIntakeConnectionBroken
in interface DatadogClient
public void setDefaultIntakeConnectionBroken(boolean defaultIntakeConnectionBroken)
setDefaultIntakeConnectionBroken
in interface DatadogClient
public boolean isLogIntakeConnectionBroken()
isLogIntakeConnectionBroken
in interface DatadogClient
public void setLogIntakeConnectionBroken(boolean logIntakeConnectionBroken)
setLogIntakeConnectionBroken
in interface DatadogClient
public boolean isWebhookIntakeConnectionBroken()
isWebhookIntakeConnectionBroken
in interface DatadogClient
public void setWebhookIntakeConnectionBroken(boolean webhookIntakeConnectionBroken)
setWebhookIntakeConnectionBroken
in interface DatadogClient
public boolean isEvpProxySupported()
public boolean event(DatadogEvent event)
DatadogClient
event
in interface DatadogClient
event
- - a DatadogEvent objectpublic boolean incrementCounter(String name, String hostname, Map<String,Set<String>> tags)
DatadogClient
incrementCounter
in interface DatadogClient
name
- - metric namehostname
- - metric hostnametags
- - metric tagspublic void flushCounters()
DatadogClient
flushCounters
in interface DatadogClient
public boolean gauge(String name, long value, String hostname, Map<String,Set<String>> tags)
DatadogClient
gauge
in interface DatadogClient
name
- - A String with the name of the metric to record.value
- - A long containing the value to submit.hostname
- - A String with the hostname to submit.tags
- - A Map containing the tags to submit.public boolean serviceCheck(String name, DatadogClient.Status status, String hostname, Map<String,Set<String>> tags)
DatadogClient
serviceCheck
in interface DatadogClient
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.public boolean sendLogs(String payload)
DatadogClient
sendLogs
in interface DatadogClient
payload
- log payload to submit JSON object as Stringpublic boolean startBuildTrace(BuildData buildData, Run<?,?> run)
DatadogClient
startBuildTrace
in interface DatadogClient
buildData
- build data to use in the pipeline tracerun
- a particular execution of a Jenkins buildpublic boolean finishBuildTrace(BuildData buildData, Run<?,?> run)
DatadogClient
finishBuildTrace
in interface DatadogClient
buildData
- build data to use in the pipeline tracerun
- the run to create a pipeline trace forpublic boolean sendPipelineTrace(Run<?,?> run, org.jenkinsci.plugins.workflow.graph.FlowNode flowNode)
DatadogClient
sendPipelineTrace
in interface DatadogClient
run
- a particular execution of a Jenkins buildflowNode
- current flowNodeCopyright © 2016–2023. All rights reserved.