- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
The Expression and Function actions perform custom data transformations within your workflows using JavaScript. Use the values of any context variables available within your workflow as inputs for your JavaScript expressions and functions with the syntax $.Steps.<step_name>.<variable>
. You can also use _
to make use of Lodash in your data transformation actions with the same syntax. For example, to reference the HTTP request status variable (status
) from the HTTP request step (Make_request
), you’d use the following context variable:
$.Steps.Make_request.status
And to determine if an array returned by Array_function
includes the name Bits
, apply the _.includes
Lodash function with the following syntax:
_.includes($.Steps.Array_function.data, "Bits")
The data returned by these actions can then be referenced in subsequent steps of the workflow.
Use expression actions for data transformations that can be accomplished in a single line of code, and do not require variable assignments or multiple standalone operations. For example:
[1, 2, 3].filter(x => x < 3)
To add an expression action:
expression
. Select the Expression action to add it to your workflow.expression
. Select the Expression action to add it to your workflow.The function action allows for variable assignments and data transformations requiring multiple expressions.
To add a function action:
function
. Select the Function action to add it to your workflow.function
. Select the Function action to add it to your workflow.You can use Bits AI to help you write the JavaScript for a Function step. To use this feature, perform the following steps:
To test an expression or function action, click Test in the Inputs section. If the action uses an output variable from a previous step, comment out the variable in your code and replace it with test data. For example, consider the following action that assigns variables to the workflow name and to the Steps.List_monitors
output from a previous step:
let name = $.WorkflowName;
let object = $.Steps.List_monitors;
...
To test the action, comment out the existing variable assignments and replace them with hardcoded test data:
\\ let name = $.WorkflowName;
let name = 'Test workflow'
\\ let object = $.Steps.List_monitors;
let object = {0:{
'name': 'Test monitor'
}}
...
Do you have questions or feedback? Join the #workflows channel on the Datadog Community Slack.