public class DatadogHttpClient extends Object implements DatadogClient
DatadogClient.ClientType, DatadogClient.Status
Modifier and Type | Field and Description |
---|---|
static boolean |
enableValidations |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object) |
boolean |
event(DatadogEvent event)
Sends an event to the Datadog API, including the event payload.
|
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.
|
Secret |
getApiKey() |
static DatadogClient |
getInstance(String url,
String logIntakeUrl,
String webhookIntakeUrl,
Secret apiKey)
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.
|
String |
getLogIntakeUrl() |
String |
getUrl() |
String |
getWebhookIntakeUrl() |
int |
hashCode() |
boolean |
incrementCounter(String name,
String hostname,
Map<String,Set<String>> tags)
Increment a counter for the given metrics.
|
boolean |
isDefaultIntakeConnectionBroken() |
boolean |
isLogIntakeConnectionBroken() |
boolean |
isWebhookIntakeConnectionBroken() |
org.datadog.jenkins.plugins.datadog.clients.DatadogHttpClient.HttpMetrics |
metrics() |
boolean |
postWebhook(String payload)
Posts a given payload to the Datadog Webhook Intake, using the user configured apiKey.
|
boolean |
sendLogs(String payload)
Posts a given payload to the Datadog Logs Intake, using the user configured apiKey.
|
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() |
static boolean |
validateDefaultIntakeConnection(HttpClient client,
String validatedUrl,
Secret apiKey) |
boolean |
validateLogIntakeConnection() |
boolean |
validateWebhookIntakeConnection() |
public static DatadogClient getInstance(String url, String logIntakeUrl, String webhookIntakeUrl, Secret apiKey)
url
- - target urllogIntakeUrl
- - log intake urlapiKey
- - Secret api Keypublic void validateConfiguration() throws IllegalArgumentException
IllegalArgumentException
public String getUrl()
public void setUrl(String url)
setUrl
in interface DatadogClient
public String getLogIntakeUrl()
public void setLogIntakeUrl(String logIntakeUrl)
setLogIntakeUrl
in interface DatadogClient
public String getWebhookIntakeUrl()
public void setWebhookIntakeUrl(String webhookIntakeUrl)
setWebhookIntakeUrl
in interface DatadogClient
public Secret getApiKey()
public void setApiKey(Secret apiKey)
setApiKey
in interface DatadogClient
public void setHostname(String hostname)
setHostname
in interface DatadogClient
public void setPort(Integer port)
setPort
in interface DatadogClient
public void setLogCollectionPort(Integer logCollectionPort)
setLogCollectionPort
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 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 org.datadog.jenkins.plugins.datadog.clients.DatadogHttpClient.HttpMetrics metrics()
metrics
in interface DatadogClient
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)
sendLogs
in interface DatadogClient
payload
- - A String containing a specific subset of a builds metadata.public boolean postWebhook(String payload)
postWebhook
in interface DatadogClient
payload
- - A webhooks payload.public static boolean validateDefaultIntakeConnection(HttpClient client, String validatedUrl, Secret apiKey)
public boolean validateLogIntakeConnection() throws IOException
IOException
public boolean validateWebhookIntakeConnection() throws IOException
IOException
public 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.