Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hello,
I have set up a scenario which returns a Slack message upon completion, along with some standard variables (e.g., ${scenarioName}). By following the documentation here https://doc.dataiku.com/dss/latest/scenarios/variables.html ("Retrieving the value of a metric") I have been able to get the entire output from the metrics computation (${stepOutput_the_metrics}).
However, I would like to limit the content of the Slack message to the number of rows of the dataset (i.e., the value of the COUNT_RECORDS metric). When I try and follow the rest of the documentation, I cannot follow; especially the section "If the goal is to retrieve the value of the metric col_stats:MIN:cost, with a bit of filtering one obtains this status with ${filter(parseJson(stepOutput_the_metrics)[โPROJ.computedโ].computed, x, x.metricId == โcol_stats:MIN:costโ)[0].value}"
I want to replicate this, but for my circumstances, but I am unable to. What does the x refer to here?
If I wanted to the value of the metric "metricId:records:COUNT_RECORDS", how would I do this?
Hi Mark,
Let's assume that inside your scenario, you have one "Compute metrics" step named "the_metrics", which has one dataset called "test" in the project "SANDBOX" with the metric "records:COUNT_RECORDS" configured.
Then you can retrieve the value of the metric using:
${filter(parseJson(stepOutput_the_metrics)[โSANDBOX.testโ].computed, x, x.metricId == โrecords:COUNT_RECORDSโ)[0].value}
I put in bold the parameters that you need to change:
1. Name of the "Compute metrics" step: "the_metrics"
2. Project key: "SANDBOX"
3. Dataset name: "test"
4. Metric identifier: "records:COUNT_RECORDS"
Hope it helps,
Alex