New RunLLM response generated: >>>*# Question* Th...
# runllm-flyte-trial
a
New RunLLM response generated: >>>*# Question* The monitoring page mentions: β€œThe workflow parameters object that the SDK injects into various tasks has a statsd handle that users should call to emit stats of their workflows not captured by the default metrics.” https://docs.flyte.org/en/latest/deployment/configuration/monitoring.html Can I get more details as to where this parameters object is? # Answer The workflow parameters object is accessible through the
flytekit.ExecutionParameters
class. This object is available in every
@task
method and can be accessed using
flytekit.current_context()
. The
ExecutionParameters
object includes a
stats
attribute, which is a handle to a special statsd object for emitting custom metrics.
Copy code
from flytekit import current_context

@task
def my_task():
    context = current_context()
    stats = context.stats
    # Emit custom stats
    stats.timer("custom_metric").start()
    # Your task logic here
    stats.timer("custom_metric").stop()
For more details, refer to the flytekit.ExecutionParameters documentation. Would you like more detail on how to use this in your workflows? Sources: - flytekit.ExecutionParameters - Flyte Monitoring Slack Link https://flyte-org.slack.com/archives/CP2HDHKE1/p1719413695.426299 πŸ‘ 0 button πŸ‘Ž 0 button πŸ’‘ Hint: Mention @runllm in the thread for followups.