Class DatadogGlobalConfiguration
- java.lang.Object
-
- hudson.model.Descriptor<GlobalConfiguration>
-
- jenkins.model.GlobalConfiguration
-
- org.datadog.jenkins.plugins.datadog.DatadogGlobalConfiguration
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<GlobalConfiguration>
,Saveable
,OnMaster
@Extension public class DatadogGlobalConfiguration extends GlobalConfiguration
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class hudson.model.Descriptor
Descriptor.FormException, Descriptor.PropertyType, Descriptor.Self
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static String
DATADOG_AGENT_CLIENT_TYPE
static String
DATADOG_API_CLIENT_TYPE
static String
DD_CI_HOSTNAME
static String
DEFAULT_EVENTS
static String
SECURITY_EVENTS
static String
SYSTEM_EVENTS
static XStream2
XSTREAM
-
Fields inherited from class hudson.model.Descriptor
clazz
-
-
Constructor Summary
Constructors Constructor Description DatadogGlobalConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
configure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData)
Indicates if this builder can be used with all kinds of project types.FormValidation
doCheckCiInstanceName(String ciInstanceName)
FormValidation
doCheckExcluded(String excluded)
FormValidation
doCheckIncluded(String included)
FormValidation
doTestFilteringConfig(boolean emitSecurityEvents, boolean emitSystemEvents, String includeEvents, String excludeEvents)
Checks filtering config for comma-separated list, overlapping include/exclude lists, unrecognizable event names, and redundant inclusion/exclusion.FormValidation
doTestHostname(String hostname)
Tests the hostname field from the configuration screen, to determine if the hostname is of a valid format, according to the RFC 1123.String
getBlacklist()
Deprecated.usegetExcluded()
String
getCiInstanceName()
Getter function for the ciInstanceName global configuration.protected XmlFile
getConfigFile()
String
getDatadogAppHostname()
Collection<DatadogClientConfiguration.DatadogClientConfigurationDescriptor>
getDatadogClientConfigOptions()
DatadogClientConfiguration
getDatadogClientConfiguration()
String
getDisplayName()
Getter function for a human-readable plugin name, used in the configuration screen.boolean
getEmitConfigChangeEvents()
Deprecated.this configuration property has been removedboolean
getEnableCiVisibility()
String
getExcluded()
Getter function for the excluded global configuration, containing a comma-separated list of jobs to exclude from monitoring.String
getExcludeEvents()
Getter function for the included global configuration, containing a comma-separated list of events not to send.String
getGlobalJobTags()
Getter function for the globalJobTags global configuration, containing a comma-separated list of jobs and tags that should be applied to themString
getGlobalTagFile()
Gets the globalTagFile set in the job configuration.String
getGlobalTags()
Getter function for the globalTags global configuration, containing a comma-separated list of tags that should be applied everywhere.String
getHostname()
Getter function for the hostname global configuration.String
getIncluded()
Getter function for the included global configuration, containing a comma-separated list of jobs to include for monitoring.String
getIncludeEvents()
Getter function for the included global configuration, containing a comma-separated list of events to send to agent.String
getReportWith()
Deprecated.Secret
getTargetApiKey()
Deprecated.String
getTargetApiURL()
Deprecated.String
getTargetCredentialsApiKey()
Deprecated.String
getTargetHost()
Deprecated.Integer
getTargetLogCollectionPort()
Deprecated.String
getTargetLogIntakeURL()
Deprecated.Integer
getTargetPort()
Deprecated.Integer
getTargetTraceCollectionPort()
Deprecated.String
getTargetWebhookIntakeURL()
Deprecated.String
getTraceServiceName()
Deprecated.String
getWhitelist()
Deprecated.usegetIncluded()
boolean
isApplicable(Class<? extends AbstractProject> aClass)
Indicates if this builder can be used with all kinds of project types.boolean
isCacheBuildRuns()
boolean
isCollectBuildLogs()
boolean
isCollectBuildTraces()
Deprecated.boolean
isEmitSecurityEvents()
boolean
isEmitSystemEvents()
boolean
isJobExcluded(String jobName)
boolean
isJobIncluded(String jobName)
boolean
isRefreshDogstatsdClient()
boolean
isRetryLogs()
Deprecated.This method is here to ensure backward compatibilityboolean
isShowDatadogLinks()
boolean
isUseAwsInstanceHostname()
void
load()
void
loadEnvVariables()
void
onStartup()
protected Object
readResolve()
Maintains backwards compatibility.void
setBlacklist(String blacklist)
Deprecated.void
setCacheBuildRuns(boolean cacheBuildRuns)
Set the checkbox in the UI, used for Jenkins data bindingvoid
setCiInstanceName(String ciInstanceName)
Setter function for the ciInstanceName global configuration.void
setCollectBuildLogs(boolean collectBuildLogs)
Set the checkbox in the UI, used for Jenkins data bindingvoid
setCollectBuildTraces(boolean collectBuildTraces)
Deprecated.void
setDatadogAppHostname(String datadogAppHostname)
void
setDatadogClientConfiguration(DatadogClientConfiguration datadogClientConfiguration)
void
setEmitConfigChangeEvents(boolean ignored)
Deprecated.this configuration property has been removedvoid
setEmitSecurityEvents(boolean emitSecurityEvents)
Set the checkbox in the UI, used for Jenkins data bindingvoid
setEmitSystemEvents(boolean emitSystemEvents)
Set the checkbox in the UI, used for Jenkins data bindingvoid
setEnableCiVisibility(boolean enableCiVisibility)
Set the checkbox in the UI, used for Jenkins data binding to enable CI Visibilityvoid
setExcluded(String jobs)
Setter function for the excluded jobs global configuration, accepting a comma-separated string of jobs.void
setExcludeEvents(String events)
Setter function for the included global configuration, accepting a comma-separated string of events.void
setGlobalJobTags(String globalJobTags)
Setter function for the globalJobTags global configuration, accepting a comma-separated string of jobs and tags.void
setGlobalTagFile(String globalTagFile)
Setter function for the globalFile global configuration, accepting a comma-separated string of tags.void
setGlobalTags(String globalTags)
Setter function for the globalTags global configuration, accepting a comma-separated string of tags.void
setHostname(String hostname)
Setter function for the hostname global configuration.void
setIncluded(String jobs)
Setter function for the includedd global configuration, accepting a comma-separated string of jobs.void
setIncludeEvents(String events)
Setter function for the included global configuration, accepting a comma-separated string of events.void
setRefreshDogstatsdClient(boolean refreshDogstatsdClient)
Set the checkbox in the UI, used for Jenkins data bindingvoid
setReportWith(String reportWith)
Deprecated.void
setRetryLogs(boolean retryLogs)
Deprecated.This method is here to ensure backward compatibilityvoid
setShowDatadogLinks(boolean showDatadogLinks)
void
setTargetApiKey(Secret targetApiKey)
Deprecated.void
setTargetApiURL(String targetApiURL)
Deprecated.void
setTargetCredentialsApiKey(String targetCredentialsApiKey)
Deprecated.void
setTargetHost(String targetHost)
Deprecated.void
setTargetLogCollectionPort(Integer targetLogCollectionPort)
Deprecated.void
setTargetLogIntakeURL(String targetLogIntakeURL)
Deprecated.void
setTargetPort(Integer targetPort)
Deprecated.void
setTargetTraceCollectionPort(Integer targetTraceCollectionPort)
Deprecated.void
setTargetWebhookIntakeURL(String targetWebhookIntakeURL)
Deprecated.void
setTraceServiceName(String traceServiceName)
Deprecated.void
setUseAwsInstanceHostname(boolean useAwsInstanceHostname)
Set the checkbox in the UI, used for Jenkins data bindingvoid
setWhitelist(String whitelist)
Deprecated.-
Methods inherited from class jenkins.model.GlobalConfiguration
all, getDescriptor, getGlobalConfigPage
-
Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, bindJSON, calcAutoCompleteSettings, calcFillSettings, configure, doHelp, find, find, findByDescribableClassName, findById, getCategory, getCheckMethod, getCheckUrl, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getRequiredGlobalConfigPagePermission, getT, getViewPage, isInstance, isSubTypeOf, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
-
-
-
-
Field Detail
-
XSTREAM
public static final XStream2 XSTREAM
-
SYSTEM_EVENTS
public static final String SYSTEM_EVENTS
- See Also:
- Constant Field Values
-
SECURITY_EVENTS
public static final String SECURITY_EVENTS
- See Also:
- Constant Field Values
-
DEFAULT_EVENTS
public static final String DEFAULT_EVENTS
- See Also:
- Constant Field Values
-
DD_CI_HOSTNAME
public static final String DD_CI_HOSTNAME
- See Also:
- Constant Field Values
-
DATADOG_AGENT_CLIENT_TYPE
public static final String DATADOG_AGENT_CLIENT_TYPE
- See Also:
- Constant Field Values
-
DATADOG_API_CLIENT_TYPE
public static final String DATADOG_API_CLIENT_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
load
public void load()
- Overrides:
load
in classDescriptor<GlobalConfiguration>
-
getConfigFile
protected XmlFile getConfigFile()
- Overrides:
getConfigFile
in classDescriptor<GlobalConfiguration>
-
onStartup
@Initializer(after=SYSTEM_CONFIG_ADAPTED) public void onStartup()
-
loadEnvVariables
public void loadEnvVariables()
-
doTestFilteringConfig
public FormValidation doTestFilteringConfig(@QueryParameter("emitSecurityEvents") boolean emitSecurityEvents, @QueryParameter("emitSystemEvents") boolean emitSystemEvents, @QueryParameter("includeEvents") String includeEvents, @QueryParameter("excludeEvents") String excludeEvents)
Checks filtering config for comma-separated list, overlapping include/exclude lists, unrecognizable event names, and redundant inclusion/exclusion.- Parameters:
emitSecurityEvents
- toggle to send security eventsemitSystemEvents
- toggle to send system eventsincludeEvents
- string of included events list (comma-separated)excludeEvents
- string of excluded events list (comma-separated)- Returns:
- FormValidation.error() if not formatted correctly or overlapping lists, FormValidation.warning() for redundant config, and FormValidation.ok() for all else
-
doTestHostname
public FormValidation doTestHostname(@QueryParameter("hostname") String hostname)
Tests the hostname field from the configuration screen, to determine if the hostname is of a valid format, according to the RFC 1123. It is used in the config.jelly resource file. See method="testHostname"- Parameters:
hostname
- - A String containing the hostname submitted from the form on the configuration screen, which will be used to authenticate a request to the Datadog API.- Returns:
- a FormValidation object used to display a message to the user on the configuration screen.
-
doCheckCiInstanceName
public FormValidation doCheckCiInstanceName(@QueryParameter("ciInstanceName") String ciInstanceName)
-
doCheckIncluded
public FormValidation doCheckIncluded(@QueryParameter("included") String included)
-
doCheckExcluded
public FormValidation doCheckExcluded(@QueryParameter("excluded") String excluded)
-
isApplicable
public boolean isApplicable(Class<? extends AbstractProject> aClass)
Indicates if this builder can be used with all kinds of project types.- Parameters:
aClass
- - An extension of the AbstractProject class representing a specific type of project.- Returns:
- a boolean signifying whether or not a builder can be used with a specific type of project.
-
getDisplayName
@NonNull public String getDisplayName()
Getter function for a human-readable plugin name, used in the configuration screen.- Overrides:
getDisplayName
in classDescriptor<GlobalConfiguration>
- Returns:
- a String containing the human-readable display name for this plugin.
-
configure
public boolean configure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData) throws Descriptor.FormException
Indicates if this builder can be used with all kinds of project types.- Overrides:
configure
in classGlobalConfiguration
- Parameters:
req
- - A StaplerRequest objectformData
- - A JSONObject containing the submitted form data from the configuration screen.- Returns:
- a boolean signifying the success or failure of configuration.
- Throws:
Descriptor.FormException
- if the formData is invalid.
-
getDatadogClientConfiguration
public DatadogClientConfiguration getDatadogClientConfiguration()
-
setDatadogClientConfiguration
public void setDatadogClientConfiguration(DatadogClientConfiguration datadogClientConfiguration)
-
getCiInstanceName
public String getCiInstanceName()
Getter function for the ciInstanceName global configuration.- Returns:
- a String containing the ciInstanceName global configuration.
-
setCiInstanceName
public void setCiInstanceName(String ciInstanceName)
Setter function for the ciInstanceName global configuration.- Parameters:
ciInstanceName
- = A string containing the CI Instance Name
-
getHostname
public String getHostname()
Getter function for the hostname global configuration.- Returns:
- a String containing the hostname global configuration.
-
setHostname
public void setHostname(String hostname)
Setter function for the hostname global configuration.- Parameters:
hostname
- - A String containing the hostname of the Jenkins host.
-
getDatadogAppHostname
public String getDatadogAppHostname()
-
setDatadogAppHostname
public void setDatadogAppHostname(String datadogAppHostname)
-
isJobExcluded
public boolean isJobExcluded(@Nonnull String jobName)
-
getExcluded
public String getExcluded()
Getter function for the excluded global configuration, containing a comma-separated list of jobs to exclude from monitoring.- Returns:
- a String array containing the excluded global configuration.
-
setExcluded
public void setExcluded(String jobs)
Setter function for the excluded jobs global configuration, accepting a comma-separated string of jobs.- Parameters:
jobs
- - a comma-separated list of jobs to exclude from monitoring.
-
isJobIncluded
public boolean isJobIncluded(@Nonnull String jobName)
-
getIncluded
public String getIncluded()
Getter function for the included global configuration, containing a comma-separated list of jobs to include for monitoring.- Returns:
- a String array containing the included global configuration.
-
setIncluded
public void setIncluded(String jobs)
Setter function for the includedd global configuration, accepting a comma-separated string of jobs.- Parameters:
jobs
- - a comma-separated list of jobs to include for monitoring.
-
getGlobalTagFile
public String getGlobalTagFile()
Gets the globalTagFile set in the job configuration.- Returns:
- a String representing the relative path to a globalTagFile
-
setGlobalTagFile
public void setGlobalTagFile(String globalTagFile)
Setter function for the globalFile global configuration, accepting a comma-separated string of tags.- Parameters:
globalTagFile
- - a comma-separated list of tags.
-
getGlobalTags
public String getGlobalTags()
Getter function for the globalTags global configuration, containing a comma-separated list of tags that should be applied everywhere.- Returns:
- a String array containing the globalTags global configuration
-
setGlobalTags
public void setGlobalTags(String globalTags)
Setter function for the globalTags global configuration, accepting a comma-separated string of tags.- Parameters:
globalTags
- - a comma-separated list of tags.
-
getGlobalJobTags
public String getGlobalJobTags()
Getter function for the globalJobTags global configuration, containing a comma-separated list of jobs and tags that should be applied to them- Returns:
- a String array containing the globalJobTags global configuration.
-
setGlobalJobTags
public void setGlobalJobTags(String globalJobTags)
Setter function for the globalJobTags global configuration, accepting a comma-separated string of jobs and tags.- Parameters:
globalJobTags
- - a comma-separated list of jobs to include from monitoring.
-
isRetryLogs
@Deprecated public boolean isRetryLogs()
Deprecated.This method is here to ensure backward compatibility
-
setRetryLogs
@Deprecated @DataBoundSetter public void setRetryLogs(boolean retryLogs)
Deprecated.This method is here to ensure backward compatibility
-
isRefreshDogstatsdClient
public boolean isRefreshDogstatsdClient()
- Returns:
- - A
Boolean
indicating if the user has configured Datadog to refresh the dogstatsd client
-
setRefreshDogstatsdClient
public void setRefreshDogstatsdClient(boolean refreshDogstatsdClient)
Set the checkbox in the UI, used for Jenkins data binding- Parameters:
refreshDogstatsdClient
- - The checkbox status (checked/unchecked)
-
isCacheBuildRuns
public boolean isCacheBuildRuns()
- Returns:
- - A
Boolean
indicating if the user has configured Datadog to cache build runs
-
setCacheBuildRuns
public void setCacheBuildRuns(boolean cacheBuildRuns)
Set the checkbox in the UI, used for Jenkins data binding- Parameters:
cacheBuildRuns
- - The checkbox status (checked/unchecked)
-
isUseAwsInstanceHostname
public boolean isUseAwsInstanceHostname()
- Returns:
- - A
Boolean
indicating if the user has configured Datadog to use AWS instance as hostname
-
setUseAwsInstanceHostname
public void setUseAwsInstanceHostname(boolean useAwsInstanceHostname)
Set the checkbox in the UI, used for Jenkins data binding- Parameters:
useAwsInstanceHostname
- - The checkbox status (checked/unchecked)
-
isShowDatadogLinks
public boolean isShowDatadogLinks()
-
setShowDatadogLinks
public void setShowDatadogLinks(boolean showDatadogLinks)
-
isEmitSecurityEvents
public boolean isEmitSecurityEvents()
- Returns:
- - A
Boolean
indicating if the user has configured Datadog to emit Security related events.
-
setEmitSecurityEvents
public void setEmitSecurityEvents(boolean emitSecurityEvents)
Set the checkbox in the UI, used for Jenkins data binding- Parameters:
emitSecurityEvents
- - The checkbox status (checked/unchecked)
-
isEmitSystemEvents
public boolean isEmitSystemEvents()
- Returns:
- - A
Boolean
indicating if the user has configured Datadog to emit System related events.
-
setEmitSystemEvents
public void setEmitSystemEvents(boolean emitSystemEvents)
Set the checkbox in the UI, used for Jenkins data binding- Parameters:
emitSystemEvents
- - The checkbox status (checked/unchecked)
-
setIncludeEvents
public void setIncludeEvents(String events)
Setter function for the included global configuration, accepting a comma-separated string of events.- Parameters:
events
- - a comma-separated list of events to include for sending to agent.
-
getIncludeEvents
public String getIncludeEvents()
Getter function for the included global configuration, containing a comma-separated list of events to send to agent.- Returns:
- a String array containing the events included global configuration.
-
setExcludeEvents
public void setExcludeEvents(String events)
Setter function for the included global configuration, accepting a comma-separated string of events.- Parameters:
events
- - a comma-separated list of events to exclude for sending to agent.
-
getExcludeEvents
public String getExcludeEvents()
Getter function for the included global configuration, containing a comma-separated list of events not to send.- Returns:
- a String array containing the events included global configuration.
-
isCollectBuildLogs
public boolean isCollectBuildLogs()
- Returns:
- - A
Boolean
indicating if the user has configured Datadog to collect logs.
-
setCollectBuildLogs
public void setCollectBuildLogs(boolean collectBuildLogs)
Set the checkbox in the UI, used for Jenkins data binding- Parameters:
collectBuildLogs
- - The checkbox status (checked/unchecked)
-
getEnableCiVisibility
public boolean getEnableCiVisibility()
- Returns:
- - A
Boolean
indicating if the user has configured Datadog to enable CI Visibility.
-
setEnableCiVisibility
public void setEnableCiVisibility(boolean enableCiVisibility)
Set the checkbox in the UI, used for Jenkins data binding to enable CI Visibility- Parameters:
enableCiVisibility
- - The checkbox status (checked/unchecked)
-
getDatadogClientConfigOptions
public Collection<DatadogClientConfiguration.DatadogClientConfigurationDescriptor> getDatadogClientConfigOptions()
-
setTraceServiceName
public void setTraceServiceName(String traceServiceName)
Deprecated.
-
setBlacklist
public void setBlacklist(String blacklist)
Deprecated.
-
setWhitelist
public void setWhitelist(String whitelist)
Deprecated.
-
setCollectBuildTraces
public void setCollectBuildTraces(boolean collectBuildTraces)
Deprecated.
-
setReportWith
public void setReportWith(String reportWith)
Deprecated.
-
setTargetApiURL
public void setTargetApiURL(String targetApiURL)
Deprecated.
-
setTargetLogIntakeURL
public void setTargetLogIntakeURL(String targetLogIntakeURL)
Deprecated.
-
setTargetWebhookIntakeURL
public void setTargetWebhookIntakeURL(String targetWebhookIntakeURL)
Deprecated.
-
setTargetApiKey
public void setTargetApiKey(Secret targetApiKey)
Deprecated.
-
setTargetCredentialsApiKey
public void setTargetCredentialsApiKey(String targetCredentialsApiKey)
Deprecated.
-
setTargetHost
public void setTargetHost(String targetHost)
Deprecated.
-
setTargetPort
public void setTargetPort(Integer targetPort)
Deprecated.
-
setTargetLogCollectionPort
public void setTargetLogCollectionPort(Integer targetLogCollectionPort)
Deprecated.
-
setTargetTraceCollectionPort
public void setTargetTraceCollectionPort(Integer targetTraceCollectionPort)
Deprecated.
-
setEmitConfigChangeEvents
public void setEmitConfigChangeEvents(boolean ignored)
Deprecated.this configuration property has been removed
-
getTraceServiceName
@Deprecated public String getTraceServiceName()
Deprecated.
-
getBlacklist
@Deprecated public String getBlacklist()
Deprecated.usegetExcluded()
-
getWhitelist
@Deprecated public String getWhitelist()
Deprecated.usegetIncluded()
-
isCollectBuildTraces
@Deprecated public boolean isCollectBuildTraces()
Deprecated.
-
getReportWith
@Deprecated public String getReportWith()
Deprecated.
-
getTargetApiURL
@Deprecated public String getTargetApiURL()
Deprecated.
-
getTargetLogIntakeURL
@Deprecated public String getTargetLogIntakeURL()
Deprecated.
-
getTargetWebhookIntakeURL
@Deprecated public String getTargetWebhookIntakeURL()
Deprecated.
-
getTargetApiKey
@Deprecated public Secret getTargetApiKey()
Deprecated.
-
getTargetCredentialsApiKey
@Deprecated public String getTargetCredentialsApiKey()
Deprecated.
-
getTargetHost
@Deprecated public String getTargetHost()
Deprecated.
-
getTargetPort
@Deprecated public Integer getTargetPort()
Deprecated.
-
getTargetLogCollectionPort
@Deprecated public Integer getTargetLogCollectionPort()
Deprecated.
-
getTargetTraceCollectionPort
@Deprecated public Integer getTargetTraceCollectionPort()
Deprecated.
-
getEmitConfigChangeEvents
@Deprecated public boolean getEmitConfigChangeEvents()
Deprecated.this configuration property has been removed
-
readResolve
protected Object readResolve()
Maintains backwards compatibility. Invoked by XStream when this object is deserialized.
-
-