- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
The following variables and parameters are available in workflows:
Creating useful workflows sometimes necessitates passing data from one step to another, or configuring steps that act on data from the workflow’s trigger source. You can perform this kind of data interpolation with context variables.
WorkflowName
: The name of the workflow.WorkflowId
: The ID of the workflow.InstanceId
: The ID of the execution instance of the workflow.The Context Variables tab for each step provides a map of all context variables available to that step.
Access a context variable in a step by enclosing it in double braces ({{
). To access fields within context variables, use Handlebars expression syntax.
Some steps create outputs that are available to subsequent steps in a workflow. Access a step variable with the syntax: Steps.<step_name>.<variable>
. For example, to retrieve the pull request status variable (state
) from the GitHub pull request status step (Get_pull_request_status
), you’d use the following context variable:
{{ Steps.Get_pull_request_status.state }}
If you’re not sure what variable you’re looking for, Datadog suggests existing step outputs as you type. Alternatively, you can consult the Context Variables tab for a list of available variables.
Source object variables are properties of the triggering event that are resolved at execution. The variables available in the workflow depend on the type of trigger that initiated the workflow instance. For example, if the workflow instance is triggered by a monitor, the monitor ID variable is available using {{Source.monitor.id}}
. If the workflow is triggered by a security signal detection or notification rule, the signal ID is available using {{Source.securitySignal.id}}
.
All the variables of the Source object are visible in the Context Variables tab.
Input parameters are immutable key-value pairs that you can use to pass data into a workflow. You can use input parameters in workflows that:
To add an input parameter:
To reference the input parameter in a step, use the syntax {{ Trigger.<parameter name>}}
. For example, to reference an input parameter named user
, use {{Trigger.user}}
.
The Input Parameters section displays the names of all existing input parameters together with a counter. Hover over a counter to see which steps are using the parameter.
You can add an implicit input parameter (a parameter that doesn’t already exist in the workflow) by typing it into a workflow step using the {{ Trigger.<parameter name> }}
syntax. The next time you save the workflow, a dialog appears allowing you to convert the parameter to an explicit parameter. For more information on triggering workflows, see Trigger a workflow.
If you’re looking for an existing input parameter, start typing {{ Trigger.
to see if it appears as a suggestion. Alternatively, consult the Context Variables tab for a list of available parameters.
Output parameters allow you to access the result of a workflow. This is useful when you want to pass the result of a workflow to another workflow or an App Builder app.
To add an output parameter:
The Output Parameters section displays the names of all existing output parameters together with a counter.
For information on passing data between workflows, see Access the result of a child workflow.
For an example of how to use output parameters to pass information between Workflows and App Builder, see return workflow results to an app.
To set a mutable workflow variable, use the Set variable action. You can use this action to declare, update, and access custom variables throughout your workflow, which allows you to perform more complex workflow operations. For example:
To set a custom variable:
{{
if you want to use a workflow context variable.If you need to change the value of a custom variable after setting it, you must add an additional Set variable step and either reassign the variable or create a new variable.
Here is an example of a workflow that demonstrates the Set variable step:
intList
and give it the value [1,2,3,4]
.$.Variables.intList.filter(number => number % 2 === 0)
to filter out the odd numbers.[2,4]
) to a new variable named evenList
.evenList
.You can access a custom variable in your workflow using {{ Variables.variableName }}
. For example, to access a custom variable named DashboardList
, use {{ Variables.DashboardList }}
.
Setting a custom variable inside a For loop allows you store data for use outside of the loop. For example, if you’re making multiple API requests inside a For loop, you can set a custom variable and append the data you need to it on each iteration. Outside of the loop, you can access the custom variable and handle the data you collected.
To avoid a type error resulting from an undefined variable, assign a custom variable before you use it in a loop. In the example below, the custom variable evenList
is set to an empty array before it is used in the loop.
추가 유용한 문서, 링크 및 기사:
Do you have questions or feedback? Join the #workflows channel on the Datadog Community Slack.