Hi All
I’m trying to instrument my Prefect flows with New Relic. Currently We bake our code into a custom docker image based on FROM prefecthq/prefect:3.2.8-python3.12 , our workload pool uses ECS
My goal is to run all my flows through New Relic’s agent (newrelic-admin run-program) so We can track metrics like execution time and errors.
This is what I have tried so far
1. custom decorator wrapping @flow & @task with new relic python's decorator newrelic.agent.BackgroundTask
2. Modify the job pool config command to something like newrelic-admin run-program {{command}}
3. override prefect entrypoint script with our own , changing it to exec "newrelic-admin run-program $@" instead of exec "$@" (
https://github.com/PrefectHQ/prefect/blob/main/scripts/entrypoint.sh#L25C1-L26C1)
approach 1 work fine, but wanted to look to more "holistic" approach that catches everything executed on our workers (and property labeled )
I’d greatly appreciate any advice, examples, or insights from anyone who’s successfully integrated Prefect with New Relic, especially in an ECS /docker environment