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 StringDATADOG_AGENT_CLIENT_TYPEstatic StringDATADOG_API_CLIENT_TYPEstatic StringDD_CI_HOSTNAMEstatic StringDEFAULT_EVENTSstatic StringSECURITY_EVENTSstatic StringSYSTEM_EVENTSstatic XStream2XSTREAM-
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 booleanconfigure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData)Indicates if this builder can be used with all kinds of project types.FormValidationdoCheckCiInstanceName(String ciInstanceName)FormValidationdoCheckExcluded(String excluded)FormValidationdoCheckIncluded(String included)FormValidationdoTestFilteringConfig(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.FormValidationdoTestHostname(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.StringgetBlacklist()Deprecated.usegetExcluded()StringgetCiInstanceName()Getter function for the ciInstanceName global configuration.protected XmlFilegetConfigFile()StringgetDatadogAppHostname()Collection<DatadogClientConfiguration.DatadogClientConfigurationDescriptor>getDatadogClientConfigOptions()DatadogClientConfigurationgetDatadogClientConfiguration()StringgetDisplayName()Getter function for a human-readable plugin name, used in the configuration screen.booleangetEmitConfigChangeEvents()Deprecated.this configuration property has been removedbooleangetEnableCiVisibility()StringgetExcluded()Getter function for the excluded global configuration, containing a comma-separated list of jobs to exclude from monitoring.StringgetExcludeEvents()Getter function for the included global configuration, containing a comma-separated list of events not to send.StringgetGlobalJobTags()Getter function for the globalJobTags global configuration, containing a comma-separated list of jobs and tags that should be applied to themStringgetGlobalTagFile()Gets the globalTagFile set in the job configuration.StringgetGlobalTags()Getter function for the globalTags global configuration, containing a comma-separated list of tags that should be applied everywhere.StringgetHostname()Getter function for the hostname global configuration.StringgetIncluded()Getter function for the included global configuration, containing a comma-separated list of jobs to include for monitoring.StringgetIncludeEvents()Getter function for the included global configuration, containing a comma-separated list of events to send to agent.StringgetReportWith()Deprecated.SecretgetTargetApiKey()Deprecated.StringgetTargetApiURL()Deprecated.StringgetTargetCredentialsApiKey()Deprecated.StringgetTargetHost()Deprecated.IntegergetTargetLogCollectionPort()Deprecated.StringgetTargetLogIntakeURL()Deprecated.IntegergetTargetPort()Deprecated.IntegergetTargetTraceCollectionPort()Deprecated.StringgetTargetWebhookIntakeURL()Deprecated.StringgetTraceServiceName()Deprecated.StringgetWhitelist()Deprecated.usegetIncluded()booleanisApplicable(Class<? extends AbstractProject> aClass)Indicates if this builder can be used with all kinds of project types.booleanisCacheBuildRuns()booleanisCollectBuildLogs()booleanisCollectBuildTraces()Deprecated.booleanisEmitSecurityEvents()booleanisEmitSystemEvents()booleanisJobExcluded(String jobName)booleanisJobIncluded(String jobName)booleanisRefreshDogstatsdClient()booleanisRetryLogs()Deprecated.This method is here to ensure backward compatibilitybooleanisShowDatadogLinks()booleanisUseAwsInstanceHostname()voidload()voidloadEnvVariables()voidonStartup()protected ObjectreadResolve()Maintains backwards compatibility.voidsetBlacklist(String blacklist)Deprecated.voidsetCacheBuildRuns(boolean cacheBuildRuns)Set the checkbox in the UI, used for Jenkins data bindingvoidsetCiInstanceName(String ciInstanceName)Setter function for the ciInstanceName global configuration.voidsetCollectBuildLogs(boolean collectBuildLogs)Set the checkbox in the UI, used for Jenkins data bindingvoidsetCollectBuildTraces(boolean collectBuildTraces)Deprecated.voidsetDatadogAppHostname(String datadogAppHostname)voidsetDatadogClientConfiguration(DatadogClientConfiguration datadogClientConfiguration)voidsetEmitConfigChangeEvents(boolean ignored)Deprecated.this configuration property has been removedvoidsetEmitSecurityEvents(boolean emitSecurityEvents)Set the checkbox in the UI, used for Jenkins data bindingvoidsetEmitSystemEvents(boolean emitSystemEvents)Set the checkbox in the UI, used for Jenkins data bindingvoidsetEnableCiVisibility(boolean enableCiVisibility)Set the checkbox in the UI, used for Jenkins data binding to enable CI VisibilityvoidsetExcluded(String jobs)Setter function for the excluded jobs global configuration, accepting a comma-separated string of jobs.voidsetExcludeEvents(String events)Setter function for the included global configuration, accepting a comma-separated string of events.voidsetGlobalJobTags(String globalJobTags)Setter function for the globalJobTags global configuration, accepting a comma-separated string of jobs and tags.voidsetGlobalTagFile(String globalTagFile)Setter function for the globalFile global configuration, accepting a comma-separated string of tags.voidsetGlobalTags(String globalTags)Setter function for the globalTags global configuration, accepting a comma-separated string of tags.voidsetHostname(String hostname)Setter function for the hostname global configuration.voidsetIncluded(String jobs)Setter function for the includedd global configuration, accepting a comma-separated string of jobs.voidsetIncludeEvents(String events)Setter function for the included global configuration, accepting a comma-separated string of events.voidsetRefreshDogstatsdClient(boolean refreshDogstatsdClient)Set the checkbox in the UI, used for Jenkins data bindingvoidsetReportWith(String reportWith)Deprecated.voidsetRetryLogs(boolean retryLogs)Deprecated.This method is here to ensure backward compatibilityvoidsetShowDatadogLinks(boolean showDatadogLinks)voidsetTargetApiKey(Secret targetApiKey)Deprecated.voidsetTargetApiURL(String targetApiURL)Deprecated.voidsetTargetCredentialsApiKey(String targetCredentialsApiKey)Deprecated.voidsetTargetHost(String targetHost)Deprecated.voidsetTargetLogCollectionPort(Integer targetLogCollectionPort)Deprecated.voidsetTargetLogIntakeURL(String targetLogIntakeURL)Deprecated.voidsetTargetPort(Integer targetPort)Deprecated.voidsetTargetTraceCollectionPort(Integer targetTraceCollectionPort)Deprecated.voidsetTargetWebhookIntakeURL(String targetWebhookIntakeURL)Deprecated.voidsetTraceServiceName(String traceServiceName)Deprecated.voidsetUseAwsInstanceHostname(boolean useAwsInstanceHostname)Set the checkbox in the UI, used for Jenkins data bindingvoidsetWhitelist(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:
loadin classDescriptor<GlobalConfiguration>
-
getConfigFile
protected XmlFile getConfigFile()
- Overrides:
getConfigFilein 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:
getDisplayNamein 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.FormExceptionIndicates if this builder can be used with all kinds of project types.- Overrides:
configurein 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
Booleanindicating 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
Booleanindicating 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
Booleanindicating 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
Booleanindicating 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
Booleanindicating 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
Booleanindicating 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
Booleanindicating 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.
-
-