The generateAggregateAlertFromTemplate() GraphQL query field can generate an unsaved aggregate alert from a yaml template.

For more information on aggregate alerts, see the Aggregate Alerts documentation page.

Syntax

Below is the syntax for the generateAggregateAlertFromTemplate() query field:

graphql
generateAggregateAlertFromTemplate(
      input: GenerateAggregateAlertFromTemplateInput!
   ): UnsavedAggregateAlert!

Given Datatypes

For the input, GenerateAggregateAlertFromTemplateInput, there are a some parameters that may be given. Below is a list of them along with their datatypes and a description of each:

Table: GenerateAggregateAlertFromTemplateInput

ParameterTypeRequired[a]DefaultDescription
viewNameRepoOrViewNameyes Name of the view of the aggregate alert.
yamlTemplateYAMLyes YAML specification of the aggregate alert.

[a] Some arguments may be required, as indicated in this column. For some fields, this column indicates that a result will always be returned for it.


Returned Datatypes

The returned datatype UnsavedAggregateAlert has its own parameters. Below is a list of them along with their datatypes and a description of each:

Table: UnsavedAggregateAlert

ParameterTypeRequired[a]DefaultDescription
namestringyes Name of the aggregate alert.
descriptionstring  Description of the aggregate alert.
queryStringstringyes LogScale query to execute.
actions[Action]yes List of actions to fire on query result.
labels[string]yes Labels attached to the aggregate alert.
enabledbooleanyes Flag indicating whether the aggregate alert is enabled.
throttleTimeSecondslongyes Throttle time in seconds.
throttleFieldstring  A field on which to throttle. Can only be set if throttleTimeSeconds is set.
queryTimestampTypeQueryTimestampTypeyes Timestamp type to use for a query.
triggerModeTriggerModeyes Trigger mode used for triggering the alert.
searchIntervalSecondslongyes Search interval in seconds.

[a] Some arguments may be required, as indicated in this column. For some fields, this column indicates that a result will always be returned for it.